---
name: "onTeamSwitch"
type: command
status: deprecated
groups: ["Team Switch", "Event Handlers"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/onTeamSwitch
revid: 353308
updated: 2024-03-15T17:11:45Z
---

# onTeamSwitch

*Command · Team Switch, Event Handlers · Arma 3 v0.50 · introduced in Arma 2 v1.00*

> [!WARNING]
> This command is deprecated.

## Description

Defines an action performed when the team switch is finished.
Commandset receives the following special variables: *_from* object previous unit, *_to* object current unit.
Consecutive use of onTeamSwitch command will overwrite previously set commandset.

> [!IMPORTANT]
> This command is deprecated. Since **Arma 3** *v1.57* a stackable version of this EH is available: [TeamSwitch](../topics/Mission_Event_Handlers.md#teamswitch)

> [!NOTE]
> When player switches and leaves behind AI unit, you need to enable "TeamSwitch" AI on it (with `onTeamSwitch { _from enableAI "TeamSwitch" };`) so that the unit continues with [waypoints](../commands/waypoints.md).

## Syntax

```sqf
onTeamSwitch commandset
```

**Parameters:**

- `commandset`:  [String](../topics/String.md) or [Code](../topics/Code.md)

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
onTeamSwitch { [_from, _to] execVM "myTeamSwitchScript.sqf"; };
```

## See also

Team Switch · [enableTeamSwitch](../commands/enableTeamSwitch.md) · [onBriefingTeamSwitch](../commands/onBriefingTeamSwitch.md) · [teamSwitch](../commands/teamSwitch.md) · [teamSwitchEnabled](../commands/teamSwitchEnabled.md)

<sub>Source: [BI Community Wiki — onTeamSwitch](https://community.bistudio.com/wiki/onTeamSwitch) (revision 353308).</sub>
