This repository was archived by the owner on Jun 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsquad_teleport.sqf
More file actions
161 lines (128 loc) · 4.62 KB
/
squad_teleport.sqf
File metadata and controls
161 lines (128 loc) · 4.62 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
Original Script:
https://forums.bohemia.net/forums/topic/135262-insurgency-style-respawn/
Modified to work with ACE by [Keko] Grille
_actionId = this addAction ["<t color='#FF0000' size='2'>Teleport to squad</t>", "squad_teleport.sqf"];
*/
_unit = _this select 1;
//-------------------Night Vision-----------------------------//
if (currentVisionMode player == 1) then
{
camUseNVG true;
}else{
camUseNVG false;
};
////////////////////////////////////////////////////////////////
//------------------------------------------------------------//
if (_unit == player) then {
waituntil {alive player};
player setPos getPos glbase;
_squad = group player;
lck_livingmates = [];
{
if (alive _x and _x!=player and !([_x] call ace_medical_fnc_getUnconsciousCondition)) then {lck_livingmates = lck_livingmates + [_x];};
} foreach units _squad;
//Check if no living squadmates
lvng_mates = count lck_livingmates;
if(lvng_mates > 0) then {
lck_actualmate = 0;
keyout = 0;
openMap false;
0 fadesound 0;
disableserialization;
keyspressed = compile preprocessFile "scripts\lib\keydown.sqf";
_displayID = (findDisplay 46) displayAddEventHandler ["KeyDown","_this call keyspressed"];
_cam = "camera" camcreate [0,0,0];
_cam cameraeffect ["internal", "back"] ;
showCinemaBorder true;
_cam camsettarget (lck_livingmates select lck_actualmate);
_cam camsetrelpos [0,-5,2.5];
_cam camcommit 0;
_ido=0;
while {_ido<=25000} do {
if (_ido mod 500 == 0) then {
TitleText["\n \n \nRight Arrow = next squadmate\nLeft Arrow = previous squadmate\nEnter = respawn","PLAIN",10];
};
if (keyout > 0) exitwith {};
_currentmate = lck_livingmates select lck_actualmate;
_tempcnt=0;
if (_ido mod 50 == 0) then {
cutText[["<t color='#00ff00' size='2'>",name _currentmate,"</t>"] joinString " ", "PLAIN",0, false, true];
};
lck_livingmates = [];
{
if (alive _x and _x != player and !([_x] call ace_medical_fnc_getUnconsciousCondition)) then {
lck_livingmates = lck_livingmates + [_x];
if (_x ==_currentmate) then {
lck_actualmate = _tempcnt;
};
_tempcnt = _tempcnt + 1;
};
} foreach units _squad;
if (count lck_livingmates == 0) exitwith {};
_cam camsettarget (lck_livingmates select lck_actualmate);
_cam camsetrelpos [0,-5,2.5];
_cam camcommit 0;
waituntil{camCommitted _cam};
_ido = _ido + 1;
sleep 0.02;
};
(findDisplay 46) displayRemoveEventHandler ["keyDown",_displayID];
_ido=0;
while {_ido<=90} do {
_cam camsettarget (lck_livingmates select lck_actualmate);
_cam camsetrelpos [0,-5,2.5];
_cam camcommit 0;
TitleText["","PLAIN DOWN"];
waituntil{camCommitted _cam};
_ido = _ido + 1;
sleep 0.02;
};
_newpos = getPos glbase;
if (keyout > 0) then {
_newpos = getPos (lck_livingmates select lck_actualmate);
if ((_newpos select 0)>50 and (_newpos select 1)>50) then {
//?
} else {
_newpos = getPos glbase;
};
} else {
_newpos = getPos glbase;
};
//-----------------Vehicle Spawn-----------------------------//
if (vehicle (lck_livingmates select lck_actualmate) != (lck_livingmates select lck_actualmate)) then
{
if ((vehicle (lck_livingmates select lck_actualmate)) emptyPositions "cargo"==0) then
{
null = ['dummy',player] execVM "scripts\teleport.sqf"; //No space in vehicle
}else{
player moveincargo vehicle (lck_livingmates select lck_actualmate);
camdestroy _cam;
player cameraEffect ["terminate","back"];
0 fadesound 1;
};
} else {
//////////////////////////////////////////////////////////////////
//------------------Set Unit Stance-----------------------------//
_return = stance (lck_livingmates select lck_actualmate);
if (_return == "stand") then {_return = "amovpknlmstpsraswrfldnon";};
sleep 0.02;
if (_return == "crouch") then {_return = "amovpknlmstpsraswrfldnon";};
sleep 0.02;
if (_return == "prone") then {_return = "AmovPpneMstpSrasWrflDnon";};
player switchMove _return;
//////////////////////////////////////////////////////////////////
player cameraEffect ["terminate","back"];
camdestroy _cam;
0 fadesound 1;
//------------------Show spawning screen-----------------------------//
titleText [format ["Spawning on %1", lck_livingmates select lck_actualmate], "BLACK FADED"];sleep 2;
titleText [format ["Spawning on %1", lck_livingmates select lck_actualmate], "BLACK in",2];
///////////////////////////////////////////////////////////////////////
player setPos _newpos;
};//if vehicle
cutText["", "PLAIN",-1, false, true];
}else{
hint "No teammate alive";
};
};