-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPie_Helper_RemoteControl.sqf
More file actions
52 lines (41 loc) · 1.44 KB
/
Pie_Helper_RemoteControl.sqf
File metadata and controls
52 lines (41 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
Helper script to take remote control of a given unit (eg heli pilot for insertion)
Usage:
Pie_Helper_RemoteControl = compileFinal preprocessFileLineNumbers "globalScripts\Pie_Helper_RemoteControl.sqf";
[this, controlledGunner, "true", "Control Tank"] call Pie_Helper_RemoteControl;
*/
_objectToAdd = _this param [0, objNull];
_unitToControl = _this param [1, objNull];
_condition = _this param [2, "true"]; // _target, _this, _originalTarget
_label = _this param [3, "Take Control"];
if(isServer) then
{
[
_objectToAdd, [
_label,
{
params ["_target", "_caller", "_actionId", "_arguments"];
[_target, _caller, _actionId, _arguments] call Pie_RemoteControl_TakeControl;
},
[_unitToControl],
1.5,
true,
true,
"",
_condition,
3
]] remoteExec ["addAction", 0, true];
};
Pie_RemoteControl_TakeControl = {
params ["_target", "_caller", "_actionId", "_arguments"];
_unitToControl = _arguments select 0;
_caller remoteControl _unitToControl;
(vehicle _unitToControl) switchCamera "internal";
_unitToControl setVariable ["Pie_Remote_UnderControl", true, true];
// Drop control when dead or unconcious
waitUntil { sleep 1; (!alive _unitToControl || _unitToControl getVariable ["ACE_isUnconscious", false] || !(_unitToControl getVariable ["Pie_Remote_UnderControl", false])) };
sleep 1;
_unitToControl setVariable ["Pie_Remote_UnderControl", false, true];
objNull remoteControl _unitToControl;
_caller switchCamera "internal";
};