API ReferenceGE Extensionsflowgraphnodesvehicleai
AI Flee
- **Node Name:** `AI Flee`
Overview
- Node Name:
AI Flee - Category:
once_p_duration - File:
extensions/flowgraph/nodes/vehicle/ai/flee.lua
Sets a vehicle's AI to flee from another vehicle. The AI will drive away from the target, trying to maximize distance.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
aiVehId | number | - | Vehicle ID to apply AI flee mode (uses player vehicle if empty) |
targetId | number | - | Vehicle ID of the vehicle to flee from (defaults to player vehicle) |
Internals
Key Methods
| Method | Description |
|---|---|
workOnce() | Sets AI mode to "flee" and assigns the target vehicle |
Commands Sent
ai.setMode("flee")
ai.setTargetObjectID(targetId)How It Works
- Resolves the AI vehicle by
aiVehIdor defaults to the player vehicle. - Resolves the target by
targetIdor defaults to player vehicle ID. - Queues two Lua commands: set mode to "flee" and set target object ID.
- Executes once, then the AI continues fleeing autonomously.
Usage Example
-- Make vehicle 5 flee from the player:
-- aiVehId = 5
-- targetId = (empty, defaults to player)
-- Make vehicle 5 flee from vehicle 3:
-- aiVehId = 5
-- targetId = 3Key Dependencies
ai.setMode("flee")- enables flee AI modeai.setTargetObjectID()- sets the vehicle to flee from
See Also
- AI Parameters (Flowgraph Node) - Related reference
- AI Arrive (Flowgraph Node) - Related reference
- AI Chase (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide