API ReferenceGE Extensionsflowgraphnodesvehicle
Set Lightbar
- **Node Name:** `Set Lightbar`
Overview
- Node Name:
Set Lightbar - Category:
repeat_instant - File:
extensions/flowgraph/nodes/vehicle/setLightbar.lua
Sets the lightbar mode for a vehicle (usually the roof-mounted light bar on emergency vehicles). If no vehicle ID is given, the current player vehicle is used.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
vehId | number | ID of the vehicle to affect. If empty, uses player vehicle |
mode | number | Lightbar mode to set |
Hard Templates for mode
| Value | Label |
|---|---|
0 | Off |
1 | On |
2 | Siren |
Internals
Key Methods
| Method | Description |
|---|---|
init() | Empty initialization |
postInit() | Sets up hard templates for the mode pin (Off/On/Siren) |
work() | Resolves vehicle and executes setLightbarMode action via vehicle bridge |
How It Works
- On each tick, resolves the vehicle by
vehIdor falls back togetPlayerVehicle(0). - Calls
core_vehicleBridge.executeAction(veh, 'setLightbarMode', mode)with the selected mode. - Mode 0 = off, 1 = lights on (no siren), 2 = lights + siren.
Usage Example
-- In a flowgraph - activate police siren:
-- [Vehicle ID] → [Set Lightbar].vehId
-- [Number: 2] → [Set Lightbar].mode
-- Direct Lua equivalent:
local veh = getPlayerVehicle(0)
core_vehicleBridge.executeAction(veh, 'setLightbarMode', 2) -- siren
core_vehicleBridge.executeAction(veh, 'setLightbarMode', 0) -- offKey Dependencies
core_vehicleBridge.executeAction(veh, action, ...)- sends actions to the vehicle Lua environmentscenetree.findObjectById()- resolves vehicle by IDgetPlayerVehicle(0)- gets the current player vehicle
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