API ReferenceGE Extensionsflowgraphnodesvehicleai
AI Disable
- **Node Name:** `AI Disable`
Overview
- Node Name:
AI Disable - Category:
repeat_p_duration - File:
extensions/flowgraph/nodes/vehicle/ai/disable.lua
Disables AI mode for a vehicle. Supports two methods: standard AI state disable or script stop with optional handbrake and wheel straightening.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
aiVehId | number | - | Vehicle ID to disable AI for (uses player vehicle if empty) |
Internals
Key Methods
| Method | Description |
|---|---|
init() | Sets up data fields for stop behavior |
work() | Sends the disable command to the vehicle each frame |
Data Fields (auto-serialized)
| Field | Default | Description |
|---|---|---|
useScriptStop | false | Use ai:scriptStop() instead of ai.setState() |
handBrakeWhenFinished | false | Apply handbrake when using script stop |
straightenWheelsWhenFinished | false | Straighten wheels when using script stop |
Disable Methods
- Standard (
useScriptStop = false):ai.setState({mode = "disabled"})- immediately sets AI to disabled. - Script Stop (
useScriptStop = true):ai:scriptStop(handBrake, straightenWheels)- gracefully stops scripted AI driving.
How It Works
- Resolves the vehicle by
aiVehIdor defaults to the player vehicle. - Based on
useScriptStop, sends the appropriate disable command. - Runs every frame (
repeat_p_duration) to ensure the AI stays disabled.
Usage Example
-- Simple AI disable:
-- aiVehId = vehicleId
-- useScriptStop = false (default)
-- Sends: ai.setState({mode = "disabled"})
-- Graceful stop with handbrake:
-- aiVehId = vehicleId
-- useScriptStop = true
-- handBrakeWhenFinished = true
-- Sends: ai:scriptStop(true, false)Key Dependencies
ai.setState()- standard AI state controlai:scriptStop()- scripted AI stop with options
See Also
- AI Parameters (Flowgraph Node) - Related reference
- AI Arrive (Flowgraph Node) - Related reference
- AI Chase (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide