Arma 3 Scripting

Command in AI Behaviour

disableAI

Also available as Markdown and JSON, or read the original wiki page.

Description

Disables parts of the AI behaviour to get a better control over the actions of a unit. If the unit changes locality, this command might need to be executed again at the new locality to maintain effect.

Warning

This command might cause unexpected behaviour when used on a player-controlled unit.

Syntax

unit disableAI feature

Parameters:

Returns: Nothing

Examples

Example 1

MyUnit disableAI "AUTOTARGET";

Multiplayer

Important

The locality of this command is peculiar: the disabling will be stored locally and will apply if the AI is local or becomes local (e.g taking the lead, driving, etc). If the AI changes locality again, that machine's AI setup will prevail.

See also

enableAI · checkAIFeature · enableAIFeature · getUnitState · disableRemoteSensors · vehicleMoveInfo

Community notes

Hardrock

Notes from before the conversion:

The "TARGET" section of the AI is likely different than what you would think. Normally, when an AI group is standing still and sees an enemy, the group will break formation and start moving towards the enemy. If you disable the "TARGET" AI, then the AI units will stay where they are at. Even if you disable the "MOVE" AI, the units will still move out to attack the enemy, unless you disable the "TARGET" AI. Disabling both these AI sections is useful when placing units in defensive positions. This way, you can have them stay behind their cover, and not run out into the open.

This command has also a bug: after mission save or load the effect will be no longer active and you must set it again. It's also good way to detect number of saves and loads (loads can be recognized using time command).

GeneralCarver

Multiplayer Use as of ArmA v1.14: Contrary to the post above, using this command WILL disable A.I. movement ability if used with the "MOVE" parameter. Works even when the A.I. is grouped with other units. I use this command to set up stationary targets at objectives all the time. Works on a dedicated server.

Kenoxite

Beware that disabling "TARGET" AI to units in the player's group will disable the ability to execute engage orders issued by the player.

James

Command is buggy in version 1.64.138497 as it disables the ability to drive vehicles for players. Tested with player disableAI "move". Entering a vehicle is possible, but not starting the engine. player enableAI "move" enables the player to drive again. Feedback Tracker ticket: https://feedback.bistudio.com/T120346

zwobot

In Operation Flashpoint/Cold War Assault, the disabled units are reset after a saveGame is executed or the user manually saves the mission, i. e. the units will behave as if the disableAI command was never applied to them. Also in Operation Flashpoint there is no way to undo this command.

Sa-Matra

Disabled or enabled AI features have no synchronization over the network what so ever, you have to do everything yourself on each client, including JIP. This also applies to setAutonomous which is pretty much multi-call disableAI command for specific set of features.