API ReferenceGE Extensionsflowgraphnodesvehiclespecial
Get Custom Vehicle Value
- **Node Name:** `Get Custom Vehicle Value`
Overview
- Node Name:
Get Custom Vehicle Value - Category: (duration + once behaviour)
- File:
extensions/flowgraph/nodes/vehicle/special/customVehicleGetter.lua
Gets a custom value from a vehicle's Lua environment (e.g., ignition status, hazard lights). The outflow is delayed by a few frames because the value must round-trip through the vehicle Lua and back.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Inflow for this node |
reset | flow (impulse) | Resets the node so it can query again |
VehId | number | ID of the vehicle. If empty, uses player vehicle |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Fires once the value has been returned |
value | any | The raw returned value |
valBool | bool | The value converted to boolean (for numbers: 0 → false, non-zero → true) |
Internals
Built-in Functions
| Name | Description | Vehicle Lua Path |
|---|---|---|
Ignition | Returns the ignition status | electrics.values.ignition |
Hazard Light | Returns the hazard light status | electrics.values.hazard_enabled |
Key Methods
| Method | Description |
|---|---|
init() | Sets default function to the first built-in |
drawCustomProperties() | ImGui dropdown to select which function to query |
work() | Sends the Lua query on first call, then waits for the returned value |
_executionStarted() | Resets returned value and done flag |
getCmd() | Builds the round-trip Lua command string |
returnValue(value) | Callback - deserializes the returned value from vehicle Lua |
Round-Trip Mechanism
The node uses a two-step communication pattern:
- GE → Vehicle Lua:
veh:queueLuaCommand(cmd)sends a command to read a value. - Vehicle Lua → GE: The command serializes the value and sends it back via
obj:queueGameEngineLua(). - The returned value is deserialized and stored in
self.returnedValue.
The generated command looks like:
obj:queueGameEngineLua("local n = core_flowgraphManager.getManagerGraphNode(mgrId, graphId, nodeId) if n then n:returnValue('"..serialize(electrics.values.ignition).."') end")How It Works
- On first
work()call (when notdone), sends the Lua query to the vehicle. - Sets
done = trueto prevent re-sending. - Waits for
self.returnedValueto be populated by thereturnValue()callback. - Once the value arrives, sets output flow to true and populates
valueandvalBoolpins. - The
resetimpulse clearsdoneso the query can be re-sent.
Usage Example
-- In a flowgraph - check if ignition is on:
-- [Trigger] → [Get Custom Vehicle Value].flow
-- [Get Custom Vehicle Value] → (valBool) → [Branch]
-- The underlying round-trip pattern:
local veh = getPlayerVehicle(0)
veh:queueLuaCommand('obj:queueGameEngineLua("callback("..serialize(electrics.values.ignition)..")")')Key Dependencies
veh:queueLuaCommand()- sends Lua code to the vehicle environmentobj:queueGameEngineLua()- sends Lua code back to the game enginecore_flowgraphManager.getManagerGraphNode()- retrieves a flowgraph node for callbacksserialize()/deserialize()- value serialization for cross-environment communication
See Also
- Custom Vehicle Lua (Flowgraph Node) - Related reference
- Custom vlua - Deprecated (Flowgraph Node) - Related reference
- Vehicle Action (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide