RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Align For CouplingApply Velocity to VehicleBoost VehicleSet Vehicle ColorsCustom Parts Config ProviderEnter VehicleFlip UprightFreeze VehicleGenerate License PlateGet Vehicle ActiveGet Electrics ValueGet GearboxmodeGet Powertrain DataGravity ForceDistance From GroundHas Coupler TagIs CoupledIs Player UsableKeep VehicleMove Vehicle ToOn Cannon FiredOn Vehicle DestroyedOn Vehicle ResetOn Vehicle SpawnedOn Vehicle SwitchedPlayer UsableRandom Config ProviderRecover In PlaceRemove VehicleTimeline ReplaySet Vehicle ActiveSet Gearbox ModeSet IgnitionSet License PlateSet LightbarSet LightsShift to Gear IndexSpawn VehicleVehicle StatesTeleport To Last RoadToggle Vehicle ControlsMove To ShowroomVehicle TouchProps TouchStatic Object TouchTrack VehicleTrailer Respawn ControlVehicle Config ProviderGet Vehicle DataGet Vehicle DataGet Vehicle BoundsVehicle PingGet Vehicle Wheel Center
Get Custom Vehicle ValueCustom vlua - deprecatedCustom Vehicle LuaVehicle ActionWheel Distance

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsflowgraphnodesvehiclespecial

Custom Vehicle Lua

- **Node Name:** `Custom Vehicle Lua`

Overview

  • Node Name: Custom Vehicle Lua
  • Category: repeat_p_duration
  • File: extensions/flowgraph/nodes/vehicle/special/customVlua.lua

Calls a custom vehicle Lua function on each tick. Sends arbitrary Lua code to a vehicle's Lua environment via queueLuaCommand.

Pin Schema

Input Pins

PinTypeDescription
vehIdnumberID of vehicle to send the Lua command to. If empty, uses player vehicle
funcstringThe Lua function/code string to execute in vehicle Lua

Output Pins

PinTypeDescription
flowflowOutflow for this node
vehIdnumber (hidden)The vehicle ID this command was sent to

Legacy Pin Mapping

  • in.vehicleId → vehId
  • out.vehicleId → vehId

Internals

Key Methods

MethodDescription
work()Resolves vehicle and sends the Lua command via queueLuaCommand
drawMiddle()Empty middle display
_onDeserialized(data)Migrates legacy data.func to hardcoded pin value

Deserialization Migration

If the node was serialized with data.func (legacy format), it migrates the value to a hardcoded pin:

data.hardcodedPins = {
  func = { value = data.data.func, type = 'string' }
}

How It Works

  1. On each tick, resolves the vehicle by vehId or falls back to getPlayerVehicle(0).
  2. If both vehicle and func are valid, calls veh:queueLuaCommand(func).
  3. The Lua string is executed in the vehicle's Lua environment on the next frame.
  4. Outputs the vehicle ID on vehId.

Usage Example

-- In a flowgraph - activate hazard lights on a vehicle:
-- [Vehicle ID] → [Custom Vehicle Lua].vehId
-- [String: "electrics.setLightsState({hazard_enabled = 1})"] → [Custom Vehicle Lua].func

-- In a flowgraph - lock the parking brake:
-- [String: "input.event('parkingbrake', 1, 1)"] → [Custom Vehicle Lua].func

-- Direct Lua equivalent:
local veh = getPlayerVehicle(0)
veh:queueLuaCommand("electrics.setLightsState({hazard_enabled = 1})")

Key Dependencies

  • veh:queueLuaCommand(luaString) - sends arbitrary Lua to the vehicle environment
  • scenetree.findObjectById() - resolves vehicle by ID
  • getPlayerVehicle(0) - gets the current player vehicle

See Also

  • Get Custom Vehicle Value (Flowgraph Node) - Related reference
  • Custom vlua - Deprecated (Flowgraph Node) - Related reference
  • Vehicle Action (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Custom vlua - deprecated

- **Node Name:** `Custom vlua - deprecated`

Vehicle Action

- **Node Name:** `Vehicle Action`

On this page

OverviewPin SchemaInput PinsOutput PinsLegacy Pin MappingInternalsKey MethodsDeserialization MigrationHow It WorksUsage ExampleKey DependenciesSee Also