{"name":"onTeamSwitch","operator":null,"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","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"commandset","type":"String or Code","optional":false,"default":null,"description":null,"types":["String","Code"],"since":null,"text":"commandset:  String or Code"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"unary","operator":null,"left":null,"right":{"text":"commandset","types":["String","Code"]}}],"examples":[{"text":"```sqf\nonTeamSwitch { [_from, _to] execVM \"myTeamSwitchScript.sqf\"; };\n```","code":["onTeamSwitch { [_from, _to] execVM \"myTeamSwitchScript.sqf\"; };"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["Team Switch","enableTeamSwitch","onBriefingTeamSwitch","teamSwitch","teamSwitchEnabled"],"notes":[],"categories":["Arma 2: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Event Handlers","Command Group: Team Switch","Introduced with Arma 2 version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}