remoteControl: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <nowiki>[</nowiki>" to " [<nowiki/>")
m (Text replacement - "[] spawn" to "0 spawn")
 
(49 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma2 |Game name=
|game1= arma2
|version1= 1.00


|1.00|Game version=
|game2= arma2oa
|version2= 1.50


|eff= global|Effects in MP=
|game3= tkoh
|version3= 1.00


|arg= local|Arguments in MP=
|game4= arma3
____________________________________________________________________________________________
|version4= 0.50


| Switches on remote control of the unit. Command needs to be executed locally to the player.
|eff= global
If driver is remote it will get transferred to players PC.
There is currently no getter command for remote control, but it is possible to use a trick described in Example 3. |DESCRIPTION=
____________________________________________________________________________________________


| who [[remoteControl]] whom |SYNTAX=
|arg= local


|p1= who: [[Object]] - controlling unit |PARAMETER1=
|gr1= Remote Control


|p2= whom: [[Object]] - controlled unit |PARAMETER2=
|descr= Switches on remote control of the unit. The command was {{Icon|globalArgument|32}} prior to {{GVI|arma3|2.14}}). For more info see [[Remote Control Tutorial]].


| [[Nothing]] |RETURNVALUE=  
If the drone is remote it will get transferred to the player's PC.
{{Feature|informative|See also [[remoteControlled]], [[isRemoteControlling]], and {{Link|#Example 4}} for a getter workaround for earlier game versions.}}
{{Feature|warning|Always use [[switchCamera]] first (when needed) before using [[remoteControl]] as doing it after may lead to unpredictable results.}}
 
|s1= who [[remoteControl]] whom
 
|p1= who: [[Object]] - controlling unit
 
|p2= whom: [[Object]] - controlled unit
 
|r1= [[Nothing]]


|x1= Set player remote control of driver:
|x1= Set player remote control of driver:
<code>[[player]] [[remoteControl]] [[driver]] UAV;
<sqf>
[[driver]] UAV [[switchCamera]] "Internal"; {{codecomment|// switchCamera required}}
driver UAV switchCamera "Internal"; // switchCamera required
{{codecomment|//sometimes switchCamera is not needed}}
player remoteControl driver UAV;
[[player]] [[remoteControl]] [[driver]] UAV;
// sometimes switchCamera is not needed
</code> |EXAMPLE1=
player remoteControl driver UAV;
</sqf>


|x2= Return control to player: <code>[[objNull]] [[remoteControl]] [[driver]] UAV;</code>|EXAMPLE2=
|x2= Return control to player: <sqf>objNull remoteControl driver UAV;</sqf>


|x3= A dirty hack to return controlling unit because of the absence of dedicated getter:
|x3= {{GVI|arma3|2.14|size= 0.75}} Return control to player:
<code>SQF_fnc_remoteControlledBy =
<sqf>player remoteControl objNull;</sqf>
 
|x4= A dirty hack to return controlling unit because of the absence of dedicated getter:
<sqf>
SQF_fnc_remoteControlledBy =
{
{
[[params]] ["_obj"];
params ["_obj"];
[[if]] (![[isNull]] [[objectParent]] _obj) [[exitWith]] { [[UAVControl]] _obj [[select]] 0 };
if (!isNull objectParent _obj) exitWith { UAVControl _obj select 0 };
[[private]] _res = [<nowiki/>[[objNull]]];
private _res = [objNull];
[[isNil]]
isNil
{
{
[[private]] _pos = [[getPosWorld]] _obj;
private _pos = getPosWorld _obj;
[[private]] _dirUp = [<nowiki/>[[vectorDirVisual]] _obj, [[vectorUpVisual]] _obj];
private _dirUp = [vectorDirVisual _obj, vectorUpVisual _obj];
[[private]] _anim = [[animationState]] _obj;
private _anim = animationState _obj;
[[private]] _dummy = "PaperCar" [[createVehicleLocal]] [0,0,0];
private _dummy = "PaperCar" createVehicleLocal [0,0,0];
_obj [[moveInAny]] _dummy;
_obj moveInAny _dummy;
_res = [[uavControl]] _dummy;
_res = uavControl _dummy;
_obj [[setPosWorld]] _pos;
_obj setPosWorld _pos;
_obj [[setVectorDirAndUp]] _dirUp;
_obj setVectorDirAndUp _dirUp;
_obj [[switchMove]] _anim;
_obj switchMove _anim;
[[deleteVehicle]] _dummy;
deleteVehicle _dummy;
};
};
_res [[select]] 0
_res select 0
};</code>
};
</sqf>
Usage (could be scheduled or unscheduled):
Usage (could be scheduled or unscheduled):
<code>[] [[spawn]]
<sqf>
0 spawn
{
{
[[player]] [[remoteControl]] bob;
player remoteControl bob;
[[systemChat]] [[str]] (bob [[call]] SQF_fnc_remoteControlledBy); {{codecomment|// B Alpha 1-1:1 (KK)}}
systemChat str (bob call SQF_fnc_remoteControlledBy); // B Alpha 1-1:1 (KK)
[[objNull]] [[remoteControl]] bob;
objNull remoteControl bob;
[[systemChat]] [[str]] (bob [[call]] SQF_fnc_remoteControlledBy); {{codecomment|// <NULL-object>}}
systemChat str (bob call SQF_fnc_remoteControlledBy); // <NULL-object>
};</code>|EXAMPLE3=
};
____________________________________________________________________________________________
</sqf>


| [[switchCamera]], [[selectPlayer]], [[UAVControl]] |SEEALSO=
|seealso= [[switchCamera]] [[selectPlayer]] [[UAVControl]] [[remoteControlled]] [[isRemoteControlling]] [[cameraOn]] [[focusOn]]
}}


| |MPBEHAVIOUR=
{{Note
|user= TeRp
|timestamp= 20090604185500
|text= You must use [[switchCamera]] in order to remote control a unit.<br>
You can only [[remoteControl]] characters, e.g. if yo want to remote control a car, you have to add a driver and use
<sqf>player remoteControl driver someVehicle</sqf>
}}
}}


<h3 style='display:none'>Notes</h3>
{{Note
<dl class='command_description'>
|user= Lou Montana
<!-- Note Section BEGIN -->
|timestamp= 20100125143500
<dt class="note">[[User:TeRp|TeRp]]
|text= '''{{arma2}} v1.05''':
<dd class="note">
You must use switchCamera in order to remote control the unit and.<br />
You can only remoteControl characters, e.g. if yo want to remote control a car, you have
to add a driver and use<br>
"player remoteControl driver someVehicle".
 
 
<dd class="notedate">Posted on Jan 25, 2010 - 14:35 (CEST)
<dt class="note">[[User:Lou Montana|Lou Montana]]
<dd class="note">'''Arma 1.05''' :
* You can remoteControl multiple units at the same time.
* You can remoteControl multiple units at the same time.
* It is not needed to [[switchCamera]] to the unit to be able to control it - it is needed to be able to fire with.
* It is not needed to [[switchCamera]] to the unit to be able to control it - it is needed to be able to fire with.
* The switchCamera is fixed : the player can't change internal/external/optics view.
* The switchCamera is fixed : the player can't change internal/external/optics view.
* Do not think about it like a [[selectPlayer]] : it is used to give the control to '''the vehicle role the unit is in'''.
* Do not think about it like a [[selectPlayer]]: it is used to give the control to '''the vehicle role the unit is in'''.
* SwitchCamera to the '''vehicle''' the unit is in ; the camera will go depending the role you are remoteControlling.
* [[switchCamera]] to the '''vehicle''' the unit is in; the camera will go depending the role you are remoteControlling.
* The AI driver won't follow your vehicle move orders.
* The AI driver won't follow your vehicle move orders.
* If the player dies, the death screen will appear, not automatically turning back to the player.
* If the player dies, the death screen will appear, not automatically turning back to the player.
* If you want to stop the remote control, use objNull as remote controller.
* If you want to stop the remote control, use objNull as remote controller.
* Example :
* Example:
<code>[[player]] [[remoteControl [[driver]] jeep1; {{codecomment|// will remoteControl it, you still will have full control of the player}}
<sqf>
jeep1 [[switchCamera]] "internal"; {{codecomment|// fix the camera to the ''vehicle'' and not to (driver jeep1) !}}
player remoteControl driver jeep1; // will remoteControl it, you still will have full control of the player
[[waitUntil]] { !([[alive]] jeep1) || !([[alive]] [[player]]) };
jeep1 switchCamera "internal"; // fix the camera to the vehicle and not to driver jeep1!
[[objNull]] [[remoteControl]] [[driver]] jeep1; {{codecomment|// removes the remoteControlling}}
waitUntil { !(alive jeep1) || !(alive player) };
[[player]] [[switchCamera]] "internal"; {{codecomment|// returns to the player}}</code>
objNull remoteControl driver jeep1; // removes the remoteControlling
player switchCamera "internal"; // returns to the player
</sqf>
|game= arma2
|version= 1.05
}}


<!-- Note Section END -->
{{Note
</dl>
|user= thedawnofallwars
|timestamp= 20200917030100
|text= Far and away the easiest way to check the unit remote controlling an AI through Zeus' Remote Control module is using [[BIS_fnc_moduleRemoteControl_owner]]
This will return the unit in question which you can then run name on to find the controller's name.


<h3 style='display:none'>Bottom Section</h3>
<sqf>
 
private _name = "-";
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
_who = _unit getVariable ["BIS_fnc_moduleRemoteControl_owner", objNull];
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
if (!isNull _who) then
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
{
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
_name = name _who;
[[Category:Command Group: Remote Control]]
};
</sqf>
}}

Latest revision as of 21:24, 2 September 2024

Hover & click on the images for description

Description

Description:
Switches on remote control of the unit. The command was GAGlobal prior to Arma 3 logo black.png2.14). For more info see Remote Control Tutorial. If the drone is remote it will get transferred to the player's PC.
See also remoteControlled, isRemoteControlling, and Example 4 for a getter workaround for earlier game versions.
Always use switchCamera first (when needed) before using remoteControl as doing it after may lead to unpredictable results.
Groups:
Remote Control

Syntax

Syntax:
who remoteControl whom
Parameters:
who: Object - controlling unit
whom: Object - controlled unit
Return Value:
Nothing

Examples

Example 1:
Set player remote control of driver:
driver UAV switchCamera "Internal"; // switchCamera required player remoteControl driver UAV; // sometimes switchCamera is not needed player remoteControl driver UAV;
Example 2:
Return control to player:
objNull remoteControl driver UAV;
Example 3:
Arma 3 logo black.png2.14 Return control to player:
player remoteControl objNull;
Example 4:
A dirty hack to return controlling unit because of the absence of dedicated getter:
SQF_fnc_remoteControlledBy = { params ["_obj"]; if (!isNull objectParent _obj) exitWith { UAVControl _obj select 0 }; private _res = [objNull]; isNil { private _pos = getPosWorld _obj; private _dirUp = [vectorDirVisual _obj, vectorUpVisual _obj]; private _anim = animationState _obj; private _dummy = "PaperCar" createVehicleLocal [0,0,0]; _obj moveInAny _dummy; _res = uavControl _dummy; _obj setPosWorld _pos; _obj setVectorDirAndUp _dirUp; _obj switchMove _anim; deleteVehicle _dummy; }; _res select 0 };
Usage (could be scheduled or unscheduled):
0 spawn { player remoteControl bob; systemChat str (bob call SQF_fnc_remoteControlledBy); // B Alpha 1-1:1 (KK) objNull remoteControl bob; systemChat str (bob call SQF_fnc_remoteControlledBy); // <NULL-object> };

Additional Information

See also:
switchCamera selectPlayer UAVControl remoteControlled isRemoteControlling cameraOn focusOn

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
TeRp - c
Posted on Jun 04, 2009 - 18:55 (UTC)
You must use switchCamera in order to remote control a unit.
You can only remoteControl characters, e.g. if yo want to remote control a car, you have to add a driver and use
player remoteControl driver someVehicle
Lou Montana - c
Posted on Jan 25, 2010 - 14:35 (UTC)

Arma 2 v1.05:

  • You can remoteControl multiple units at the same time.
  • It is not needed to switchCamera to the unit to be able to control it - it is needed to be able to fire with.
  • The switchCamera is fixed : the player can't change internal/external/optics view.
  • Do not think about it like a selectPlayer: it is used to give the control to the vehicle role the unit is in.
  • switchCamera to the vehicle the unit is in; the camera will go depending the role you are remoteControlling.
  • The AI driver won't follow your vehicle move orders.
  • If the player dies, the death screen will appear, not automatically turning back to the player.
  • If you want to stop the remote control, use objNull as remote controller.
  • Example:

player remoteControl driver jeep1; // will remoteControl it, you still will have full control of the player jeep1 switchCamera "internal"; // fix the camera to the vehicle and not to driver jeep1! waitUntil { !(alive jeep1) || !(alive player) }; objNull remoteControl driver jeep1; // removes the remoteControlling player switchCamera "internal"; // returns to the player

thedawnofallwars - c
Posted on Sep 17, 2020 - 03:01 (UTC)
Far and away the easiest way to check the unit remote controlling an AI through Zeus' Remote Control module is using BIS_fnc_moduleRemoteControl_owner This will return the unit in question which you can then run name on to find the controller's name.
private _name = "-"; _who = _unit getVariable ["BIS_fnc_moduleRemoteControl_owner", objNull]; if (!isNull _who) then { _name = name _who; };