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

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 Extensionsflowgraphnodesvehicle

On Vehicle Switched

- **Node Name:** `On Vehicle Switched`

Overview

  • Node Name: On Vehicle Switched
  • Category: logic
  • File: extensions/flowgraph/nodes/vehicle/onVehicleSwitched.lua

Triggers when the player switches to a different vehicle. Outputs the old vehicle ID, new vehicle ID, and player ID.

Pin Schema

Input Pins

PinTypeDescription
flowflowInflow for this node

Output Pins

PinTypeDescription
flowflow (impulse)Fires once when the player switches vehicles
oldIDnumberID of the previous vehicle
newIDnumberID of the new vehicle
playernumber (hidden)ID of the player who switched

Internals

Key Methods

MethodDescription
init()Empty initialization
_executionStarted()Resets flag and info table
onVehicleSwitched(oid, nid, player)Hook - stores old ID, new ID, and player ID; sets flag
work()If flag is set, outputs all three values and fires impulse, then clears flag
_afterTrigger()Clears the flag for single-frame impulse

How It Works

  1. The node subscribes to the onVehicleSwitched hook.
  2. When the player switches vehicles, the hook receives the old vehicle ID, new vehicle ID, and player index.
  3. On the next work() tick, all three output pins are populated and the flow impulse fires.
  4. The flag is cleared to ensure single-frame impulse behavior.

Usage Example

-- In a flowgraph - detect vehicle switch and update UI:
-- [On Vehicle Switched] → (newID) → [Get Vehicle Data] → [Update HUD]
--                       → (oldID) → [Cleanup Old Vehicle]

-- The engine hook signature:
-- onVehicleSwitched(oldVehicleId, newVehicleId, playerId)

Key Dependencies

  • onVehicleSwitched engine hook - fires when the active player vehicle changes

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

On Vehicle Spawned

- **Node Name:** `On Vehicle Spawned`

Player Usable

- **Node Name:** `Player Usable`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsHow It WorksUsage ExampleKey DependenciesSee Also