API ReferenceGE Extensionsflowgraphnodesvehicleai
AI Random
- **Node Name:** `AI Random`
Overview
- Node Name:
AI Random - Category:
once_p_duration - File:
extensions/flowgraph/nodes/vehicle/ai/random.lua
Sets a vehicle's AI to drive along random roads indefinitely.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
aiVehId | number | Vehicle ID to set to random AI mode. If empty, uses the player vehicle. |
Internals
Key Methods
| Method | Description |
|---|---|
workOnce() | Resolves the vehicle and queues ai.setState({mode = "random"}) on it. |
How It Works
workOnce()fires a single time when the node receives flow.- Resolves the vehicle from
aiVehIdor falls back to the player vehicle. - Sends
ai.setState({mode = "random"})to the vehicle's Lua VM. - The vehicle AI then autonomously navigates random roads on the map.
Usage Example
-- In a flowgraph:
-- [Trigger] → [AI Random (aiVehId=trafficCar)] → continues...
-- Equivalent vehicle-side command:
ai.setState({mode = "random"})Key Dependencies
ai.setState()- vehicle-side AI state setter
See Also
- AI Parameters (Flowgraph Node) - Related reference
- AI Arrive (Flowgraph Node) - Related reference
- AI Chase (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide