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 Path from File

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

Overview

  • Node Name: AI Path from File
  • Category: provider
  • File: extensions/flowgraph/nodes/vehicle/ai/scriptAI/pathFromFile.lua

Loads a ScriptAI path from a .track.json file and provides it as output data. Feed the output into "AI Follow Path from Data" to drive a vehicle along the path.

Pin Schema

Output Pins

PinTypeDescription
pathtable (aiPath)AI path loaded from the selected file.

Internals

Key Methods

MethodDescription
init()Scans /replays/scriptai/tracks/ for .track.json files.
work()Lazily loads the selected file via jsonReadFile() and outputs recording data.
drawCustomProperties()Editor UI with a "Refresh Files" button and file combo selector.
_onSerialize(res)Saves the selected fileName.
_onDeserialized(nodeData)Restores fileName and derives the short display name.

Constants

ConstantValueDescription
trackFilePath/replays/scriptai/tracks/Directory for track files.
trackFileExt.track.jsonFile extension for ScriptAI recordings.

How It Works

  1. On init(), scans the tracks directory using FS:findFiles().
  2. The editor displays a dropdown of available files (short names without path/extension).
  3. On first work() call, lazily loads the JSON file via jsonReadFile().
  4. Outputs self.loadedFile.recording as the path pin - an aiPath table with position/time data.

File Format

ScriptAI track files (.track.json) contain:

{
  "vehicle": "etk800",
  "levelName": "west_coast_usa",
  "recording": {
    "path": [
      {"x": 100.0, "y": 200.0, "z": 50.0, "t": 0.0},
      {"x": 101.5, "y": 201.2, "z": 50.1, "t": 0.5}
    ]
  }
}

Usage Example

-- Flowgraph chain:
-- [AI Path from File] → path → [AI Follow Path from Data] → flow → [Done]

-- Programmatic equivalent:
local data = jsonReadFile("/replays/scriptai/tracks/myTrack.track.json")
local path = data.recording
veh:queueLuaCommand('ai.startFollowing(' .. serialize(path) .. ')')

Key Dependencies

  • FS:findFiles() - filesystem scan for track files
  • jsonReadFile() - JSON file loader
  • ScriptAI recording format ({path = [{x,y,z,t}, ...]})

See Also

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

AI Follow Path from Data

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

Stored AI Path

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

On this page

OverviewPin SchemaOutput PinsInternalsKey MethodsConstantsHow It WorksFile FormatUsage ExampleKey DependenciesSee Also