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

Play ScriptAI Recording

- **Node Name:** `Play ScriptAI Recording`

Overview

  • Node Name: Play ScriptAI Recording
  • Category: repeat_p_duration
  • File: extensions/flowgraph/nodes/vehicle/ai/scriptAI/playRecording.lua

Plays a ScriptAI recording from a file. Supports start/stop impulse control and loop count. Unlike "AI Follow Path from Data", this node loads the file directly by name.

Pin Schema

Input Pins

PinTypeDescription
startflow (impulse)Starts playing the recording.
stopflow (impulse)Stops the recording.
fileNamestringPath to the .track.json file to load.
vehIdnumberVehicle to play recording on. Uses player vehicle if empty.
loopCountnumberNumber of loops (-1 = infinite).

Internals

Key Methods

MethodDescription
init()Initializes with no recording, not running.
postInit()Configures the fileName pin to accept .track.json files in the file browser.
play()Loads the recording, sets loop count/type, sends ai.startFollowing().
stop()Sends ai.stopFollowing() and marks not running.
loadRecording()Attempts multiple path resolutions for the file (relative, tracks dir, with/without extension).
work()Dispatches start and stop impulses.
drawMiddle()Shows recording info: vehicle, level, path count, duration, and optional debug path rendering.

Data Properties

PropertyDefaultDescription
renderDebugfalseDraw path points and prisms in 3D viewport.

File Resolution Order

The node tries to load the file in this order:

  1. Relative path from flowgraph manager
  2. Relative path with .track.json extension appended
  3. /replays/scriptai/tracks/ + filename
  4. /replays/scriptai/tracks/ + filename + .track.json

How It Works

  1. When start impulse fires, play() loads the recording JSON.
  2. Sets loopCount and loopType = "firstOnlyTeleport" on the recording data.
  3. Sends ai.startFollowing(recording) to the vehicle.
  4. When stop impulse fires, sends ai.stopFollowing() to halt playback.

Usage Example

-- Flowgraph:
-- [Button Press] → start → [Play ScriptAI Recording (fileName="myTrack", loopCount=3)]
-- [Another Event] → stop ↗

-- Equivalent vehicle commands:
local data = jsonReadFile("/replays/scriptai/tracks/myTrack.track.json")
data.recording.loopCount = 3
data.recording.loopType = "firstOnlyTeleport"
veh:queueLuaCommand('ai.startFollowing(' .. serialize(data.recording) .. ')')

-- To stop:
veh:queueLuaCommand('ai.stopFollowing()')

Key Dependencies

  • ai.startFollowing() / ai.stopFollowing() - vehicle-side ScriptAI control
  • jsonReadFile() - JSON file loader
  • .track.json format - ScriptAI recording files

See Also

  • AI Follow Path from Data (Flowgraph Node) - Related reference
  • AI Path from File (Flowgraph Node) - Related reference
  • Stored AI Path (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Stored AI Path

- **Node Name:** `Stored AI Path`

Beamstate

- **Node Name:** `Beamstate`

On this page

OverviewPin SchemaInput PinsInternalsKey MethodsData PropertiesFile Resolution OrderHow It WorksUsage ExampleKey DependenciesSee Also