API ReferenceGE Extensionsflowgraphnodesvehicle
On Vehicle Destroyed
- **Node Name:** `On Vehicle Destroyed`
Overview
- Node Name:
On Vehicle Destroyed - Category:
logic - File:
extensions/flowgraph/nodes/vehicle/onVehicleDestroyed.lua
Detects when a vehicle is destroyed and fires an impulse with the destroyed vehicle's ID. This is an event-driven node that listens for the onVehicleDestroyed hook.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Inflow for this node |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow (impulse) | Fires once when a vehicle is destroyed |
vehId | number | ID of the vehicle that was destroyed |
Legacy Pin Mapping
out.vehicleID→vehId
Internals
Key Methods
| Method | Description |
|---|---|
init() | Empty initialization |
_executionStarted() | Resets flag and info table |
onVehicleDestroyed(id) | Hook - stores the destroyed vehicle ID and sets the flag |
work() | If flag is set, outputs the vehicle ID and fires impulse flow, then clears flag |
_afterTrigger() | Clears the flag to ensure single-frame impulse |
How It Works
- The node subscribes to the
onVehicleDestroyedhook automatically. - When any vehicle is destroyed,
onVehicleDestroyed(id)stores the vehicle ID and sets a flag. - On the next
work()tick, the node outputs the vehicle ID onvehIdand fires theflowimpulse. - The flag is cleared immediately after, so the impulse fires for exactly one frame.
Usage Example
-- In a flowgraph:
-- [On Vehicle Destroyed] → (vehId) → [Log / Scoring / Respawn Logic]
-- The hook is called engine-side when a vehicle object is destroyed:
-- onVehicleDestroyed(vehicleId)Key Dependencies
onVehicleDestroyedengine hook - fires when a vehicle object is destroyed
See Also
- Align for Coupling (Flowgraph Node) - Related reference
- Apply Velocity to Vehicle (Flowgraph Node) - Related reference
- Boost Vehicle (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide