Remote Control Tutorial
Remote Control allows to transfer player control to a unit. By executing remoteControl the movement control is transferred. 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. 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 locally, this is why it is important that all arguments for remoteControl, remoteControlled and isRemoteControlling commands are local.
Exception is the target unit argument for remoteControl command, which can be remote, in which case the unit will be moved to player locality.
When player is controlling the unit, the unit is local to player, if not, then something went terribly wrong.
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. 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. This is unfortunate legacy behaviour we cannot safely change.
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:
and if necessary:
Remote control can also be terminated when only unit is known:
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).