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
AI Follow Path from DataAI Path from FileStored AI PathPlay ScriptAI Recording

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 ExtensionsflowgraphnodesvehicleaiscriptAI

AI Follow Path from Data

- **Node Name:** `AI Follow Path from Data`

Overview

  • Node Name: AI Follow Path from Data
  • File: extensions/flowgraph/nodes/vehicle/ai/scriptAI/followPath.lua

Follows a ScriptAI path provided as data (from "AI Path from File" or "Stored AI Path" nodes). Supports looping, timescale adjustment, and reset modes. Outputs flow when the path is complete.

Pin Schema

Input Pins

PinTypeDescription
flowflowInflow for this node.
resetflow (impulse)Resets the node so the path can be followed again.
pathtable (aiPath)AI path data to follow.
vehIdnumberVehicle ID. Uses player vehicle if empty.
loopCountnumberNumber of loops to drive (0 = no looping).

Output Pins

PinTypeDescription
flowflowFires when path following is complete.

Internals

Key Methods

MethodDescription
init()Sets defaults: loopMode = "neverReset", timeScale = 1.0, handbrake/straighten options.
setupAI()Loads path data, applies timescale to timestamps, starts ai.startFollowing().
endAI()Stops the script AI with optional handbrake and wheel straightening.
work()Handles reset, checks completion, polls vehicle for script state.
onVehicleSubmitInfo(id, info, nodeID)Callback - when info is nil, the path is complete.
drawCustomProperties()Editor UI for timescale, reset mode selection, and manual reset button.

Data Properties

PropertyDefaultDescription
handBrakeWhenFinishedfalseApply handbrake when path ends.
straightenWheelsWhenFinishedfalseStraighten wheels when path ends.

Reset Modes

ModeDescription
neverResetNever resets vehicle position at loop boundaries.
alwaysResetResets vehicle position at every loop.
startResetResets only at the start of the first loop.

How It Works

  1. On first work(), calls setupAI() which clones the path data with adjusted timestamps (t / timeScale).
  2. Sends ai.startFollowing(pathData, nil, loopCount, loopType) to the vehicle.
  3. Each frame, polls all vehicles for script AI state via onVehicleSubmitInfo.
  4. When the vehicle reports nil state, the path is complete - endAI() is called and flow outputs.
  5. On _executionStopped(), stops AI if still running.

Usage Example

-- Flowgraph chain:
-- [AI Path from File] → path → [AI Follow Path from Data (vehId, loopCount=2)] → flow → [Done]

-- The vehicle-side call is:
ai.startFollowing({path = {...}}, nil, 2, "neverReset")

-- To stop mid-path:
ai:scriptStop(false, false)  -- (handBrake, straightenWheels)

Key Dependencies

  • ai.startFollowing() - vehicle-side ScriptAI path follower
  • ai:scriptStop() - stops ScriptAI execution
  • ai.scriptState() - returns current script state (nil when finished)
  • onVehicleSubmitInfo hook - receives vehicle state callbacks

See Also

  • AI Path from File (Flowgraph Node) - Related reference
  • Stored AI Path (Flowgraph Node) - Related reference
  • Play ScriptAI Recording (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

AI Traffic

- **Node Name:** `AI Traffic`

AI Path from File

- **Node Name:** `AI Path from File`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsData PropertiesReset ModesHow It WorksUsage ExampleKey DependenciesSee Also