-
Notifications
You must be signed in to change notification settings - Fork 3
/
markerChange.sqf
178 lines (171 loc) · 6.63 KB
/
markerChange.sqf
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
if (!isServer) exitWith {};
private ["_winner","_marcador","_looser","_posicion","_other","_bandera","_banderas","_dist","_texto","_sides"];
_winner = _this select 0;
_marcador = _this select 1;
if ((_winner == "GREENFORSpawn") and (_marcador in aeropuertos) and (tierWar < 3)) exitWith {};
if ((_winner == "GREENFORSpawn") and (lados getVariable [_marcador,sideUnknown] == buenos)) exitWith {};
if ((_winner == "BLUFORSpawn") and (lados getVariable [_marcador,sideUnknown] == malos)) exitWith {};
if ((_winner == "OPFORSpawn") and (lados getVariable [_marcador,sideUnknown] == muyMalos)) exitWith {};
if (_marcador in markersChanging) exitWith {};
markersChanging pushBackUnique _marcador;
_posicion = getMarkerPos _marcador;
_looser = sideUnknown;
_sides = [buenos,malos,muyMalos];
_other = "";
_texto = "";
_bandera = objNull;
_size = [_marcador] call sizeMarker;
if ((!(_marcador in ciudades)) and (spawner getVariable _marcador != 2)) then
{
_banderas = nearestObjects [_posicion, ["FlagCarrier"], _size];
_bandera = _banderas select 0;
};
if (isNil "_bandera") then {_bandera = objNull};
//[_bandera,"remove"] remoteExec ["flagaction",0,_bandera];
if (lados getVariable [_marcador,sideUnknown] == buenos) then
{
_looser = buenos;
_texto = format ["%1 ",nameBuenos];
[] call tierCheck;
}
else
{
if (lados getVariable [_marcador,sideUnknown] == malos) then
{
_looser = malos;
_texto = format ["%1 ",nameMalos];
}
else
{
_looser = muyMalos;
_texto = format ["%1 ",nameMuyMalos];
};
};
garrison setVariable [_marcador,[],true];
if (_winner == "GREENFORSpawn") then
{
lados setVariable [_marcador,buenos,true];
_winner = buenos;
_super = if (_marcador in aeropuertos) then {true} else {false};
[[_marcador,_looser,"",_super],"patrolCA"] call scheduler;
//sleep 15;
[[_marcador],"autoGarrison"] call scheduler;
}
else
{
_soldados = [];
{_soldados pushBack (typeOf _x)} forEach (allUnits select {(_x distance _posicion < (_size*3)) and (_x getVariable [_winner,false]) and (vehicle _x == _x) and (alive _x)});
if (_winner == "BLUFORspawn") then
{
lados setVariable [_marcador,malos,true];
_winner = malos;
}
else
{
lados setVariable [_marcador,muyMalos,true];
_winner = muyMalos;
};
[_soldados,_winner,_marcador,0] remoteExec ["garrisonUpdate",2];
};
_nul = [_marcador] call mrkUpdate;
_sides = _sides - [_winner,_looser];
_other = _sides select 0;
if (_marcador in aeropuertos) then
{
if (_winner == buenos) then
{
[0,10,_posicion] remoteExec ["citySupportChange",2]
}
else
{
server setVariable [_marcador,dateToNumber date,true];
[_marcador,60] call addTimeForIdle;
if (_winner == malos) then
{
[10,0,_posicion] remoteExec ["citySupportChange",2]
}
else
{
[-10,-10,_posicion] remoteExec ["citySupportChange",2]
}
};
["TaskSucceeded", ["", "Airbase Taken"]] remoteExec ["BIS_fnc_showNotification",_winner];
["TaskFailed", ["", "Airbase Lost"]] remoteExec ["BIS_fnc_showNotification",_looser];
["TaskUpdated",["",format ["%1 lost an Airbase",_texto]]] remoteExec ["BIS_fnc_showNotification",_other];
killZones setVariable [_marcador,[],true];
};
if (_marcador in puestos) then
{
if !(_winner == buenos) then {server setVariable [_marcador,dateToNumber date,true]};
["TaskSucceeded", ["", "Outpost Taken"]] remoteExec ["BIS_fnc_showNotification",_winner];
["TaskFailed", ["", "Outpost Lost"]] remoteExec ["BIS_fnc_showNotification",_looser];
["TaskUpdated",["",format ["%1 lost an Outpost",_texto]]] remoteExec ["BIS_fnc_showNotification",_other];
killZones setVariable [_marcador,[],true];
};
if (_marcador in puertos) then
{
["TaskSucceeded", ["", "Seaport Taken"]] remoteExec ["BIS_fnc_showNotification",_winner];
["TaskFailed", ["", "Seaport Lost"]] remoteExec ["BIS_fnc_showNotification",_looser];
["TaskUpdated",["",format ["%1 lost a Seaport",_texto]]] remoteExec ["BIS_fnc_showNotification",_other];
};
if (_marcador in fabricas) then
{
["TaskSucceeded", ["", "Factory Taken"]] remoteExec ["BIS_fnc_showNotification",_winner];
["TaskFailed", ["", "Factory Lost"]] remoteExec ["BIS_fnc_showNotification",_looser];
["TaskUpdated",["",format ["%1 lost a Factory",_texto]]] remoteExec ["BIS_fnc_showNotification",_other];
};
if (_marcador in recursos) then
{
["TaskSucceeded", ["", "Resource Taken"]] remoteExec ["BIS_fnc_showNotification",_winner];
["TaskFailed", ["", "Resource Lost"]] remoteExec ["BIS_fnc_showNotification",_looser];
["TaskUpdated",["",format ["%1 lost a Resource",_texto]]] remoteExec ["BIS_fnc_showNotification",_other];
};
{_nul = [_marcador,_x] spawn deleteControles} forEach controles;
markersChanging = markersChanging - [_marcador];
if (_winner == buenos) then
{
[] call tierCheck;
if (!isNull _bandera) then
{
//[_bandera,"remove"] remoteExec ["flagaction",0,_bandera];
[_bandera,"SDKFlag"] remoteExec ["flagaction",0,_bandera];
[_bandera,"\A3\Data_F_exp\Flags\Flag_Synd_CO.paa"] remoteExec ["setFlagTexture",_bandera];
sleep 2;
//[_bandera,"unit"] remoteExec ["flagaction",[buenos,civilian],_bandera];
//[_bandera,"vehicle"] remoteExec ["flagaction",[buenos,civilian],_bandera];
//[_bandera,"garage"] remoteExec ["flagaction",[buenos,civilian],_bandera];
if (_marcador in puertos) then {[_bandera,"seaport"] remoteExec ["flagaction",[buenos,civilian],_bandera]};
};
waitUntil {sleep 1; ((spawner getVariable _marcador == 2)) or ({((_x getVariable ["BLUFORSpawn",false]) or (_x getVariable ["OPFORSpawn",false])) and ([_x,_marcador] call canConquer)} count allUnits > 3*({(side _x == buenos) and ([_x,_marcador] call canConquer)} count allUnits))};
if (spawner getVariable _marcador != 2) then
{
sleep 10;
[_marcador,buenos] remoteExec ["zoneCheck",2];
};
}
else
{
if (!isNull _bandera) then
{
if (_looser == buenos) then
{
[_bandera,"remove"] remoteExec ["flagaction",0,_bandera];
sleep 2;
[_bandera,"take"] remoteExec ["flagaction",[buenos,civilian],_bandera];
};
if (_winner == malos) then
{
[_bandera,"\A3\Data_F\Flags\Flag_NATO_CO.paa"] remoteExec ["setFlagTexture",_bandera];
}
else
{
[_bandera,"\A3\Data_F\Flags\Flag_CSAT_CO.paa"] remoteExec ["setFlagTexture",_bandera];
};
};
};
if ((_winner != buenos) and (_marcador in aeropuertos) and (_looser != buenos)) then
{
_cercanos = (puertos + puestos + recursos) select {((getMarkerPos _x) distance _posicion < distanciaSPWN) and (lados getVariable [_x,sideUnknown] != buenos)};
if (_looser == malos) then {_cercanos = _cercanos select {lados getVariable [_x,sideUnknown] == malos}; _winner = "OPFORSpawn"} else {_cercanos = _cercanos select {lados getVariable [_x,sideUnknown] == muyMalos}; _winner = "BLUFORSpawn"};
{[_winner,_x] spawn markerChange; sleep 5} forEach _cercanos;
};