---
name: "AI Group Vehicle Management"
type: topic
source: https://community.bistudio.com/wiki/AI_Group_Vehicle_Management
revid: 330316
updated: 2022-08-31T15:05:00Z
---

# AI Group Vehicle Management

Real Virtuality games' AI groups all work the same way with vehicles. Aside from game-specific commands, this page applies from Operation Flashpoint to Arma 3.

### System

- A group has a "vehicle pool" that is an array of vehicles it can use. A group can "own" multiple vehicles.
- A vehicle can be in the vehicle pool of **multiple groups** at once. A vehicle itself has no "group pool".

- A vehicle can be added to a group with [addVehicle](../commands/addVehicle.md).
- A vehicle can be assigned (added) to a group with none of its units assigned to any of its vehicle role.
  - A group leader will most likely assign its units to the vehicle if need be.
- A unit can be unassigned from its role from a vehicle with [unassignVehicle](../commands/unassignVehicle.md). However, as the vehicle itself remains in the group's vehicle pool, the leader may at one point order the unit back in (a) seat.
  - To prevent a unit from being reassigned, [allowGetIn](../commands/allowGetIn.md) can be used.
- A vehicle can be removed from the group's vehicle pool with [leaveVehicle](../commands/leaveVehicle.md), unassigning any units from their role in the process.

#### AI Decisions

- The AI choosing what vehicle to use based on the vehicle's [cost](../topics/CfgVehicles_Config_Reference.md#cost) value. The distance from the vehicle may also play a role.
- When deciding whether to board a vehicle, AI leaders seem to only consider the transport benefit of a vehicle, ignoring any combat benefits the vehicle may provide.
- An AI group leader can be forced to order his group to board the specified vehicle with [orderGetIn](../commands/orderGetIn.md) [true](../commands/true.md). Setting to [false](../commands/false.md) will cancel the order, but the AI will first enter to get out again immediately thereafter. To immediately (potentially temporarily) halt the AI moving to the vehicle one can use [allowGetIn](../commands/allowGetIn.md) [false](../commands/false.md).
- When a vehicle is added this way, it can appear as a target for the enemy - even if the vehicle currently has no crew.Clarify
- If used on a vehicle already driven by a member of another group, the driver will continue under his own group's orders, which may not benefit the [addVehicle](../commands/addVehicle.md)'d group.
- Seems to have no affect on AI under player command - at least as long as the player remains the GL.Clarify

### Commands

#### Assign/MoveIn Commands (Unit specific)

| assign setter commands | moveIn setter commands | assign getter commands |
|---|---|---|
| - [assignAsDriver](../commands/assignAsDriver.md)<br>- [assignAsGunner](../commands/assignAsGunner.md)<br>- [assignAsCommander](../commands/assignAsCommander.md)<br>- [assignAsTurret](../commands/assignAsTurret.md)<br>- [assignAsCargo](../commands/assignAsCargo.md)<br>- [assignAsCargoIndex](../commands/assignAsCargoIndex.md)<br>- [unassignVehicle](../commands/unassignVehicle.md) | - [moveInDriver](../commands/moveInDriver.md)<br>- [moveInGunner](../commands/moveInGunner.md)<br>- [moveInCommander](../commands/moveInCommander.md)<br>- [moveInTurret](../commands/moveInTurret.md)<br>- [moveInCargo](../commands/moveInCargo.md)<br>- [moveInAny](../commands/moveInAny.md)<br>- [moveOut](../commands/moveOut.md) | - [assignedVehicle](../commands/assignedVehicle.md)<br>- [assignedVehicleRole](../commands/assignedVehicleRole.md) |

#### Other Commands (Group specific)

- [addVehicle](../commands/addVehicle.md)
- [leaveVehicle](../commands/leaveVehicle.md)

#### Shared Commands

- [fullCrew](../commands/fullCrew.md) Since Arma 3 v2.12 the output of the command includes vehicle's assigned units

---

from [assignedVehicle](../commands/assignedVehicle.md)

- The assignment happens via the various assignAsXXX/moveInXXX commands, or player/AI GL getIn radio commands, getIn waypoint, or when units start in vehicles or get moved in to a vehicle by Zeus/via Eden.
- [addVehicle](../commands/addVehicle.md) indirectly may also add the vehicle, however only if an AI GL assigns [vehicle roles](../commands/assignedVehicleRole.md) (which depends on various things).
- [vehicle](../commands/vehicle.md) returns the current vehicles an AI is in, while with [assignedVehicle](../commands/assignedVehicle.md) the AI may not (yet) be in the said vehicle (still in transit or held of by waypoints or other SQF commands).
- To make AI under AI GL enter a vehicle, use [orderGetIn](../commands/orderGetIn.md) [true](../commands/true.md).
- While [unassignVehicle](../commands/unassignVehicle.md) works, if the group is under AI command, the AI GL may re-assign the vehicle immediately. To stop the AI from re-entering at least, use [orderGetIn](../commands/orderGetIn.md) or [allowGetIn](../commands/allowGetIn.md) [false](../commands/false.md), or permanently remove the assignment vi a [leaveVehicle](../commands/leaveVehicle.md).
- For player GL lead AI [assignedVehicle](../commands/assignedVehicle.md) seems not to be really reliable/behaves strange. Disembark radio command seems to [unassign](../commands/unassignVehicle.md) though.

from [assignedVehicleRole](../commands/assignedVehicleRole.md)

- When an unit enters a vehicle crew position, it gets assigned the vehicle role automatically for the given crew position.
- The unit does not have to be in the vehicle when getting the role assignment (ie via assignAsXXX or human/AI GL getIn radio commands).
- GL getIn radio commands result in instant assignment - the unit does not yet have to occupy the crew position.
- Dying units will let go of the assigned role after a few seconds - seems the delay is independent of being in the vehicle or not.
- An unit will hold on to its assigned role after exiting the vehicle.
- One has to use [unassignVehicle](../commands/unassignVehicle.md) (and stop an AI GL to assign vehicle positions again) or [leaveVehicle](../commands/leaveVehicle.md) to remove the assignment - or assigned to another vehicle.
- A vehicle position/role can only be assigned to one unit at a time. So even when not (visually) occupied, the "seat" may be blocked/reserved by another unit.
- A player can still get into the vehicle position already assigned if not already taken, or switch seats with AI (if [leader](../commands/leader.md) or [effectiveCommander](../commands/effectiveCommander.md) for those AI).

from [unassignVehicle](../commands/unassignVehicle.md)

- Important is to understand the basic system first:

1. [addVehicle](../commands/addVehicle.md) creates a vehicle pool for the AI group to use.
1. [leaveVehicle](../commands/leaveVehicle.md) removes a vehicle from the pool (and makes AI disembark when in that vehicle).
1. However there is also [assignedVehicle](../commands/assignedVehicle.md). This is about the *current vehicle in use* essentially. The assignment happens via the various assignAsXXX/moveInXXX commands, or player/AI GL getIn radio commands, getIn waypoint, or when units start in vehicles or get moved in to a vehicle by Zeus/via Eden.
1. So the idea of [unassignVehicle](../commands/unassignVehicle.md) is to remove the *current vehicle in use*.
1. However as long as the vehicle is still part of the vehicle pool of the group the AI GL may order the AI to re-enter the vehicle immediately.
1. To stop this from happening, one can use [orderGetIn](../commands/orderGetIn.md)/[allowGetIn](../commands/allowGetIn.md) [false](../commands/false.md) to (temporarily) disallow the AI from entering any vehicle.

- If you use [leaveVehicle](../commands/leaveVehicle.md) on an AI group not in the vehicle, only the AI GL will get the vehicle removed from [assignedVehicle](../commands/assignedVehicle.md). However when you now apply [unassignVehicle](../commands/unassignVehicle.md) on the whole group, it will stick/the AI GL not order to re-enter immediately - as the AI GL no longer has the vehicle in his pool for the group.
- For player GL lead AI, the command removes the assignment. However it won't make the AI disembark the vehicle.

from [orderGetIn](../commands/orderGetIn.md)

- The command has no effect on AI lead by a player Group Leader (GL)
- A vehicle needs be assigned via [addVehicle](../commands/addVehicle.md) or assignAsXXX or moveInXXX first for the command to have any effect. [orderGetIn](../commands/orderGetIn.md) [true](../commands/true.md) makes the AI to board the vehicle. Or the AI GL orders them due to other means (ie getIn, guard waypoints).
- However one can initially set [orderGetIn](../commands/orderGetIn.md) [false](../commands/false.md), add one or more vehicles and only once/when the AI is to enter, you set [orderGetIn](../commands/orderGetIn.md) [true](../commands/true.md) for AI to start moving to the vehicle(s) or getting in the vehicle(s).
- [orderGetIn](../commands/orderGetIn.md) [false](../commands/false.md) makes AI also leave a vehicle when inside already. However it does not affect [assignedVehicleRole](../commands/assignedVehicleRole.md) nor [assignedVehicle](../commands/assignedVehicle.md). Only [leaveVehicle](../commands/leaveVehicle.md) will remove both
- [orderGetIn](../commands/orderGetIn.md) [false](../commands/false.md) even makes AI eject while the vehicle positions are locked (([lockDriver](../commands/lockDriver.md), [lockTurret](../commands/lockTurret.md), [lockCargo](../commands/lockCargo.md) - however [orderGetIn](../commands/orderGetIn.md) [true](../commands/true.md) will not override the position lock to make them enter
- AI units on the way to enter the vehicle won't stop on the way if [orderGetIn](../commands/orderGetIn.md) [false](../commands/false.md) set but continue to the vehicle and just stop short without entering - [allowGetIn](../commands/allowGetIn.md) false instead will make the AI stop instantly (same as [unassignVehicle](../commands/unassignVehicle.md) when combined with [orderGetIn](../commands/orderGetIn.md) [false](../commands/false.md))
- One can combine [orderGetIn](../commands/orderGetIn.md) [false](../commands/false.md) and [allowGetIn](../commands/allowGetIn.md) [false](../commands/false.md) to manage when exactly AI is to enter vehicles
- [orderGetIn](../commands/orderGetIn.md) is persistent/a general group behavior setting - don't forget previous changes with future vehicle use!
- If you want to make a vehicle no longer used by a group, you need to remove the vehicle from the group's vehicle pool via [leaveVehicle](../commands/leaveVehicle.md).

### Dis/Embarking Behaviour

**Courtesy of ffur2007slx2_5**

| Command | Remote Control | Behaviour | Role Unassigning |
|---|---|---|---|
| [orderGetIn](../commands/orderGetIn.md) | ✗ | [orderGetIn](../commands/orderGetIn.md) won't take effect on [player](../commands/player.md) controlled AI units, and which needs to be used together with assaignAs command family. Generally speaking, [orderGetIn](../commands/orderGetIn.md) is a Role Excuator. | When [orderGetIn](../commands/orderGetIn.md) was disabled it won't automatically unassign unit's vehicle role but will force the unit get out of the vehicle and stop him re-entering until it was enabled again. [orderGetIn](../commands/orderGetIn.md) [false](../commands/false.md) won't stop a unit when he is embarking a vehicle in the half way but [unassignVehicle](../commands/unassignVehicle.md) will do. [orderGetIn](../commands/orderGetIn.md) [false](../commands/false.md) will wait to fire until the unit enter a vehicle. |
| [allowGetIn](../commands/allowGetIn.md) | ✗ | [allowGetIn](../commands/allowGetIn.md) won't take effect on [player](../commands/player.md) controlled AI units. Different from [orderGetIn](../commands/orderGetIn.md), this command is a Role Holder, it can control the unit's movement in the half way set by [orderGetIn](../commands/orderGetIn.md) but not by [setWaypointType](../commands/setWaypointType.md), unit will be forced to get out from a vehicle by [allowGetIn](../commands/allowGetIn.md) [false](../commands/false.md) and won't automatically re-enter the vehicle until [allowGetIn](../commands/allowGetIn.md) [true](../commands/true.md) | [allowGetIn](../commands/allowGetIn.md) won't do anything with unit's vehicle role |
| [doGetOut](../commands/doGetOut.md) | ✓ | Works on player controlled ai silently, unit will automatically get back to the vehicle after disembarkation. (Unit won't get out until vehicle is stopped or landed) | false |
| [commandGetOut](../commands/commandGetOut.md) | ✓ | Same as [doGetOut](../commands/doGetOut.md) with radio message. (Unit won't get out until vehicle is stopped or landed) | false |
| [leaveVehicle](../commands/leaveVehicle.md) | ✗ | [leaveVehicle](../commands/leaveVehicle.md) can't force a player controlled AI disembark | true |
| [action](../commands/action.md) ["GetOut", _veh] | ✓ | Eject immediately without parachute | false |
| [action](../commands/action.md) ["Eject", _veh] | ✓ | Eject immediately with parachute if needed | false |
| [setWaypointType](../commands/setWaypointType.md) "GETIN" | ✗ | Waypoint won't be affected by [orderGetIn](../commands/orderGetIn.md) [false](../commands/false.md) or [allowGetIn](../commands/allowGetIn.md) [false](../commands/false.md) until the unit is on the vehicle. | N/A |

<sub>Source: [BI Community Wiki — AI Group Vehicle Management](https://community.bistudio.com/wiki/AI_Group_Vehicle_Management) (revision 330316).</sub>
