API Reference GE Extensions flowgraph nodes vehicle ai scriptAI AI Follow Path from Data - **Node Name:** `AI Follow Path from Data`
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 Type Description flowflow Inflow for this node. resetflow (impulse) Resets the node so the path can be followed again. pathtable (aiPath) AI path data to follow. vehIdnumber Vehicle ID. Uses player vehicle if empty. loopCountnumber Number of loops to drive (0 = no looping).
Pin Type Description flowflow Fires when path following is complete.
Method Description 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.
Property Default Description handBrakeWhenFinishedfalseApply handbrake when path ends. straightenWheelsWhenFinishedfalseStraighten wheels when path ends.
Mode Description neverResetNever resets vehicle position at loop boundaries. alwaysResetResets vehicle position at every loop. startResetResets only at the start of the first loop.
On first work(), calls setupAI() which clones the path data with adjusted timestamps (t / timeScale).
Sends ai.startFollowing(pathData, nil, loopCount, loopType) to the vehicle.
Each frame, polls all vehicles for script AI state via onVehicleSubmitInfo.
When the vehicle reports nil state, the path is complete - endAI() is called and flow outputs.
On _executionStopped(), stops AI if still running.
-- 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)
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