{"name":"Remote Control Tutorial","title":"Remote Control Tutorial","type":"topic","url":"https://community.bistudio.com/wiki/Remote_Control_Tutorial","revid":347150,"updated":"2023-09-02T14:58:56Z","aliases":[],"markdown":"**Remote Control** allows a player (remote-controller) to take control of another unit (drone, or remote-controlled) that is different from the local player unit.\n\n- only a human player can remote-control another unit.\n- players cannot remote-control other players.\n- only one unit can be controlled at the same time; remote control has to be terminated before controlling another unit.\n- when a player takes control of a unit that is controlled by another player, the unit is transferred to the new owner and the previous player control is terminated.\n\nThe remote control is handled locally, which is why it is important that all arguments for remoteControl, remoteControlled and isRemoteControlling commands are Local argument local.\nException is remoteControl's *target* argument, for which locality Global argument does not matter, in which case the unit will be moved to the controlling player machine's locality.\nWhen the player is controlling the unit, the unit is local to player.\n\n### How To\n\n#### Take Control\n\nExecuting remoteControl transfers the movement control. In order to take full control, the camera also has to be transferred - using switchCamera and ideally *before* remoteControl usage;\nthe point of view and the firing control are then transferred.\nIn some cases remoteControl is enough and the cameraOn transfer happens automatically.\n\n```sqf\notherUnit switchCamera \"INTERNAL\";\nplayer remoteControl otherUnit;\n```\n\n#### Obtain Remote Control Information (Arma 3 v2.14)\n\nThe remoteControlled command works for both cases and can return either the player controlling the provided UAV or the UAV controlled by the provided player, depending on the argument used.\n\n> [!NOTE]\n> Before Arma 3 v2.14 and remoteControlled, see remoteControl examples for a workaround.\n\n##### Get the Remote Controller\n\n```sqf\nprivate _drone = remoteControlled player;\n```\n\n##### Get the Remote Controlled Unit\n\n```sqf\nprivate _player = remoteControlled _drone;\n```\n\n#### Ensure Proper Disconnection\n\nRemote Control termination can automatically transfer the camera back to the player but might need to be forced in some cases.\n\nWhen player controls a unit and the unit dies, the control stays with that unit.\nAfter a short time, the dead unit is removed from its group.\nThis will make remoteControlled on this unit return objNull, but isRemoteControlling for the controlling player will still return true and the player will remain stuck in remote control mode.\nTo exit this mode, the following can be used:\n\n```sqf\nplayer remoteControl objNull;\nswitchCamera player; // if needed\n\n// remote control can also be terminated when only the drone is known\nobjNull remoteControl _drone;\n```\n\n### See Also\n\n- Multiplayer Scripting - Locality\n- local\n- Command Group: Remote Control","sections":[{"heading":null,"level":1,"markdown":"**Remote Control** allows a player (remote-controller) to take control of another unit (drone, or remote-controlled) that is different from the local player unit.\n\n- only a human player can remote-control another unit.\n- players cannot remote-control other players.\n- only one unit can be controlled at the same time; remote control has to be terminated before controlling another unit.\n- when a player takes control of a unit that is controlled by another player, the unit is transferred to the new owner and the previous player control is terminated.\n\nThe remote control is handled locally, which is why it is important that all arguments for remoteControl, remoteControlled and isRemoteControlling commands are Local argument local.\nException is remoteControl's *target* argument, for which locality Global argument does not matter, in which case the unit will be moved to the controlling player machine's locality.\nWhen the player is controlling the unit, the unit is local to player."},{"heading":"How To","level":3,"markdown":""},{"heading":"Take Control","level":4,"markdown":"Executing remoteControl transfers the movement control. In order to take full control, the camera also has to be transferred - using switchCamera and ideally *before* remoteControl usage;\nthe point of view and the firing control are then transferred.\nIn some cases remoteControl is enough and the cameraOn transfer happens automatically.\n\n```sqf\notherUnit switchCamera \"INTERNAL\";\nplayer remoteControl otherUnit;\n```"},{"heading":"Obtain Remote Control Information (Arma 3 v2.14)","level":4,"markdown":"The remoteControlled command works for both cases and can return either the player controlling the provided UAV or the UAV controlled by the provided player, depending on the argument used.\n\n> [!NOTE]\n> Before Arma 3 v2.14 and remoteControlled, see remoteControl examples for a workaround."},{"heading":"Get the Remote Controller","level":5,"markdown":"```sqf\nprivate _drone = remoteControlled player;\n```"},{"heading":"Get the Remote Controlled Unit","level":5,"markdown":"```sqf\nprivate _player = remoteControlled _drone;\n```"},{"heading":"Ensure Proper Disconnection","level":4,"markdown":"Remote Control termination can automatically transfer the camera back to the player but might need to be forced in some cases.\n\nWhen player controls a unit and the unit dies, the control stays with that unit.\nAfter a short time, the dead unit is removed from its group.\nThis will make remoteControlled on this unit return objNull, but isRemoteControlling for the controlling player will still return true and the player will remain stuck in remote control mode.\nTo exit this mode, the following can be used:\n\n```sqf\nplayer remoteControl objNull;\nswitchCamera player; // if needed\n\n// remote control can also be terminated when only the drone is known\nobjNull remoteControl _drone;\n```"},{"heading":"See Also","level":3,"markdown":"- Multiplayer Scripting - Locality\n- local\n- Command Group: Remote Control"}],"categories":["Arma Scripting Tutorials"],"groups":["Scripting"]}