API ReferenceGE Extensionsflowgraphnodesvehicle
Get Electrics Value
- **Node Name:** `Get Electrics Value`
Overview
- Node Name:
Get Electrics Value - Category:
once_f_duration - File:
extensions/flowgraph/nodes/vehicle/getElectricsValue.lua
Gets an electrics system value from a vehicle (throttle, RPM, brake, gear, etc.). Uses the vehicle bridge to register for value change notifications and reads cached data each frame.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
vehId | number | ID of the vehicle. Defaults to player vehicle |
key | string | Electrics value key (e.g. throttle, rpm, brake) |
Output Pins
| Pin | Type | Description |
|---|---|---|
value | any | The returned electrics value |
Key Templates (Suggestions)
throttle, throttle_input, rpm, brake, brake_input, parkingbrake, parkingbrake_input, gear, clutch
Internals
Key Methods
| Method | Description |
|---|---|
postInit() | Populates hard templates for the key pin with common electrics values |
workOnce() | Registers a value change notification for the specified key via core_vehicleBridge.registerValueChangeNotification |
work() | Reads the cached value via core_vehicleBridge.getCachedVehicleData. When a value arrives, sets duration to finished |
clearNotification() | Unregisters the value change notification when the node resets |
onNodeReset() | Sets duration state to inactive and clears notifications |
How It Works
workOnce()resolves the vehicle and registers for change notifications on the specified key.- The node stores setup data (
vehId,key) for cleanup. - Each frame,
work()checkscore_vehicleBridge.getCachedVehicleData(vehId, key). - When a non-nil value is returned, it outputs the value and sets the duration state to
finished. - On reset or execution stop,
clearNotification()unregisters the listener.
Usage Example
-- In a flowgraph:
-- [Get Electrics Value (key="rpm")] → value → [Display RPM]
-- Programmatic equivalent:
local veh = getPlayerVehicle(0)
core_vehicleBridge.registerValueChangeNotification(veh, 'rpm')
-- Later each frame:
local rpm = core_vehicleBridge.getCachedVehicleData(veh:getId(), 'rpm')Key Dependencies
core_vehicleBridge.registerValueChangeNotification()- subscribes to vehicle data changescore_vehicleBridge.unregisterValueChangeNotification()- unsubscribes from changescore_vehicleBridge.getCachedVehicleData()- reads cached electrics values
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