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
AI ParametersAI ArriveAI ChaseAI Directly ToAI DisableAI FleeAI FollowAI Follow WaypointsGet AI ModeAI Go To The End LineAI RandomFollow DecalroadAI StopAI Traffic

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 Extensionsflowgraphnodesvehicleai

Get AI Mode

- **Node Name:** `Get AI Mode`

Overview

  • Node Name: Get AI Mode
  • Category: repeat_p_duration
  • File: extensions/flowgraph/nodes/vehicle/ai/getAIMode.lua

Queries the current AI mode of a vehicle. Returns the mode string (e.g. "disabled", "random", "traffic", "manual", "stop", "span").

Pin Schema

Input Pins

PinTypeDescription
vehIdnumberID of the vehicle. If empty, uses the player vehicle.

Output Pins

PinTypeDescription
aiModestringThe current AI mode on the vehicle.

Internals

Key Methods

MethodDescription
work()Queues a Lua command on the vehicle to retrieve the AI state, then outputs the cached mode.
_executionStarted()Resets returnedMode to nil.
getCmd()Builds the cross-VM command string that queries ai.getState().mode on the vehicle and sends the result back to GE via queueGameEngineLua.
getAIMode(mode)Callback invoked from the vehicle VM - caches the mode string in self.returnedMode.

How It Works

  1. Each frame, work() sends a Lua command to the vehicle via veh:queueLuaCommand().
  2. On the vehicle side, ai.getState().mode is read and forwarded back to the GE node via queueGameEngineLua.
  3. The GE-side callback getAIMode(mode) stores the result in self.returnedMode.
  4. On the next work() call the cached mode is output on the aiMode pin.

Note: Because of the cross-VM round-trip, the output lags by one frame.

Usage Example

-- In a flowgraph:
-- [Get AI Mode (vehId=myVeh)] → aiMode → [String Compare] → "random" → [Branch]

-- The underlying vehicle-side query is equivalent to:
local mode = ai.getState().mode  -- returns e.g. "disabled", "random", "traffic"

Key Dependencies

  • ai.getState() - vehicle-side AI state accessor
  • core_flowgraphManager.getManagerGraphNode() - resolves the node for the GE callback

See Also

  • AI Parameters (Flowgraph Node) - Related reference
  • AI Arrive (Flowgraph Node) - Related reference
  • AI Chase (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

AI Follow Waypoints

- **Node Name:** `AI Follow Waypoints`

AI Go To The End Line

- **Node Name:** `AI Go To The End Line`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsHow It WorksUsage ExampleKey DependenciesSee Also