Remote Control Tutorial: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Page creation from killzone_kid contribution on Command Group: Remote Control)
 
m (Some wiki formatting)
 
Line 1: Line 1:
'''Remote Control''' allows to transfer player control to a unit. By executing [[remoteControl]] the movement control is transferred.
{{TOC|side}}
In order to take full control the camera has to be transferred as well with [[switchCamera]] in this case the view and the firing control is transferred too.
'''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.
In some cases [[remoteControl]] is enough and the [[cameraOn]] transfer happens automatically.
Same goes for termination of the remote control and the camera transfer back to player can happen automatically or might need to be forced.


The remote control is handled [[local]]ly, this is why it is important that all arguments for [[remoteControl]], [[remoteControlled]] and [[isRemoteControlling]] commands are [[local]].
* only a [[isPlayer|human player]] can remote-control another unit.
Exception is the target unit argument for [[remoteControl]] command, which can be remote, in which case the unit will be moved to [[player]] [[local]]ity.
* <!-- since Arma 3 & selectPlayer fix -->players cannot remote-control other players.
When player is controlling the unit, the unit is [[local]] to player, if not, then something went terribly wrong.<br><br>
* only one unit can be controlled at the same time; remote control has to be terminated before controlling another unit.
* 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.


Only [[isPlayer]] players can control units. Players cannot control other players. A player controlling a unit cannot initiate control of a different unit without terminating current remote control first.
The remote control is handled [[local]]ly, which is why it is important that all arguments for [[remoteControl]], [[remoteControlled]] and [[isRemoteControlling]] commands are {{Icon|localArgument|32}} local.
When a player takes control of a unit that is controlled by another player, the unit is transferred to the new owner and previous player control is terminated.
Exception is [[remoteControl]]'s ''target'' argument, for which locality {{Icon|globalArgument|32}} does not matter, in which case the unit will be moved to the controlling player machine's locality.
This is unfortunate legacy behaviour we cannot safely change.
When the player is controlling the unit, the unit is [[local]] to player.<!-- ''If not, then something went terribly wrong''. -->


When player controls a unit and the unit dies, the control stays with that unit (another legacy behaviour).
After a short time, dead unit leaves its group, in which case [[remoteControlled]] for this unit will return [[objNull]], but [[isRemoteControlling]] for the player controlling the unit will still return [[true]] and the player will remain in remote control mode and appear to be stuck.
To exit this mode, the user can execute:
<sqf>player remoteControl objNull;</sqf>
and if necessary:
<sqf>switchCamera player;</sqf>
Remote control can also be terminated when only unit is known:
<sqf>objNull remoteControl _unit;</sqf>


The [[remoteControlled]] script command works both ways and can return either the controlling player or contrilled unit depending on the argument used (see command description).
== How To ==
 
=== Take Control ===
 
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;
the point of view and the firing control are then transferred.
In some<!-- which? --> cases [[remoteControl]] is enough and the [[cameraOn]] transfer happens automatically.
 
<sqf>
otherUnit switchCamera "INTERNAL";
player remoteControl otherUnit;
</sqf>
 
{{ArgTitle|3|Obtain Remote Control Information|{{GVI|arma3|2.14}}}}
 
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.
{{Feature|informative|Before {{GVI|arma3|2.14|size= 0.75}} and [[remoteControlled]], see [[remoteControl]] examples for a workaround.}}
 
==== Get the Remote Controller ====
<sqf>private _drone = remoteControlled player;</sqf>
 
==== Get the Remote Controlled Unit ====
<sqf>private _player = remoteControlled _drone;</sqf>
 
=== Ensure Proper Disconnection ===
 
Remote Control termination can automatically transfer the camera back to the player but might need to be forced in some<!-- which? --> cases.
 
When player controls a unit and the unit dies, the control stays with that unit.
After a short time, the dead unit is removed from its group.
This 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.
To exit this mode, the following can be used:
<sqf>
player remoteControl objNull;
switchCamera player; // if needed
 
// remote control can also be terminated when only the drone is known
objNull remoteControl _drone;
</sqf>
 
 
== See Also ==
 
* {{Link|Multiplayer Scripting#Locality}}
* [[local]]
* [[:Category:Command Group: Remote Control|Command Group: Remote Control]]




[[Category:Arma Scripting Tutorials]]
[[Category:Arma Scripting Tutorials]]

Latest revision as of 15:58, 2 September 2023

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.

  • only a human player can remote-control another unit.
  • players cannot remote-control other players.
  • only one unit can be controlled at the same time; remote control has to be terminated before controlling another unit.
  • 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.

The remote control is handled locally, which is why it is important that all arguments for remoteControl, remoteControlled and isRemoteControlling commands are LALocal local. Exception is remoteControl's target argument, for which locality GAGlobal does not matter, in which case the unit will be moved to the controlling player machine's locality. When the player is controlling the unit, the unit is local to player.


How To

Take Control

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; the point of view and the firing control are then transferred. In some cases remoteControl is enough and the cameraOn transfer happens automatically.

otherUnit switchCamera "INTERNAL"; player remoteControl otherUnit;

Obtain Remote Control Information

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.

Before Arma 3 logo black.png2.14 and remoteControlled, see remoteControl examples for a workaround.

Get the Remote Controller

Get the Remote Controlled Unit

private _player = remoteControlled _drone;

Ensure Proper Disconnection

Remote Control termination can automatically transfer the camera back to the player but might need to be forced in some cases.

When player controls a unit and the unit dies, the control stays with that unit. After a short time, the dead unit is removed from its group. This 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. To exit this mode, the following can be used:

player remoteControl objNull; switchCamera player; // if needed // remote control can also be terminated when only the drone is known objNull remoteControl _drone;


See Also