{"name":"onTeamSwitch","title":"onTeamSwitch","type":"command","url":"https://community.bistudio.com/wiki/onTeamSwitch","revid":353308,"updated":"2024-03-15T17:11:45Z","groups":["Team Switch","Event Handlers"],"status":"deprecated","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","description":"Defines an action performed when the team switch is finished.\nCommandset receives the following special variables: *_from* object previous unit, *_to* object current unit.\nConsecutive use of onTeamSwitch command will overwrite previously set commandset.\n\n> [!IMPORTANT]\n> This command is deprecated. Since **Arma 3** *v1.57* a stackable version of this EH is available: TeamSwitch\n\n> [!NOTE]\n> 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.","syntaxes":[{"syntax":"onTeamSwitch commandset","params":[{"name":"commandset","type":"String or Code","type_expr":"String | Code"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"unary","right":{"text":"commandset"}}],"examples":[{"code":["onTeamSwitch { [_from, _to] execVM \"myTeamSwitchScript.sqf\"; };"]}],"see_also":["Team Switch","enableTeamSwitch","onBriefingTeamSwitch","teamSwitch","teamSwitchEnabled"]}