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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
//--- Global Init, first file called.
diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_JIPCompatible.sqf: Executing the JIP script..",diag_frameno,diag_tickTime];
//--- Client Init.
if (!isServer || local player) then {
diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_JIPCompatible.sqf: Client detected... waiting for non null result...",diag_frameno,diag_tickTime];
waitUntil {!isNull(player)};
diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_JIPCompatible.sqf: Client is not null...",diag_frameno,diag_tickTime];
/* Client Init - Begin the blackout on Layer 1 */
12452 cutText [(localize 'STR_WF_Loading')+"...","BLACK"];
isHostedServer = if (!isMultiplayer || (isServer && local player)) then {true} else {false};
isClient = true;
} else {
if (isNil 'EastMHQ' || isNil 'WestMHQ') exitWith {};
isHostedServer = if (!isMultiplayer || (isServer && local player)) then {true} else {false};
diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] Init_JIPCompatible.sqf: Server detected...",diag_frameno,diag_tickTime];
isClient = false;
};
//--- Server & Client default View Distance.
setViewDistance 1000;
clientInitComplete = false;
commonInitComplete = false;
serverInitComplete = false;
gameOver = false;
townInit = false;
towns = [];
//--- Define which 'part' of the game to run.
#include "version.sqf"
WF_A2_Vanilla = false;
#ifdef VANILLA
WF_A2_Vanilla = true;
#endif
WF_A2_Arrowhead = false;
#ifdef ARROWHEAD
WF_A2_Arrowhead = true;
#endif
WF_A2_CombinedOps = false;
#ifdef COMBINEDOPS
WF_A2_CombinedOps = true;
#endif
WF_Debug = false;
#ifdef WF_DEBUG
WF_Debug = true;
#endif
WF_Camo = false;
#ifdef WF_CAMO
WF_Camo = true;
#endif
WF_ACE = false;
#ifdef ACE
WF_ACE = true;
#endif
mysql=false;
//--- Gameplay variables.
paramMobileRespawn = true;
paramBalancing = false;
paramAI = true;
paramAIcom = true;
paramRestrictionKamov = false;
paramShowUID = true;
paramArty = true;
paramArtyUI = false;
paramTrackAI = true;
paramTrackPlayer = true;
paramRes = true;
paramOccup = true;
paramGearRespawn = true;
paramGearRestriction = false;
paramHangars = true;
paramAARadar = false;
paramCounterMeasures = false;
paramVolumClouds = true;
paramICBM = true;
paramHighCommand = true;
paramBaseArea = true;
paramSpawnRestriction = true;
paramUpgradesEast = true;
paramUpgradesWest = true;
paramKickTeamswappers = true;
paramRespawnMASH = true;
paramResReinf = false;
paramOccReinf = false;
paramPurchaseInfDepot = true;
paramHandleFF = false;
paramBoundaries = true;
paramBasePatrols = false;
paramAlice = false;
paramEASA = true;
paramDLCBAF = true;
paramDLCPMC = true;
paramBounty = true;
paramResVehLock = false;
paramExtendedInventory = false;
paramSecondaryMissions = true;
paramUPSMON = true;
paramDefenseCollide = true;
paramKeepCamps = true;
paramUseWorkers = false;
paramMandoMissiles = false;
paramMoneyOnly = false;
//--- Multiplayers Parameter, the order it the same as Parameters.hpp
if !(isNil "paramsArray") then {
Private['_u'];
_u = 0;
missionNamespace setVariable ['WFBE_MAXGROUPSIZEAI',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_MAXGROUPSIZE',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramKeepAI = false} else {paramKeepAI = true};_u = _u + 1; //--- Keep AI Units over JIP.
if ((paramsArray select _u) == 0) then {paramAI = false} else {paramAI = true};_u = _u + 1; //--- AI Enabled.
if ((paramsArray select _u) == 0) then {paramArty = false} else {paramArty = true};_u = _u + 1; //--- Enable Artillery.
if !(WF_A2_Vanilla) then {missionNamespace setVariable ['WFBE_ARTILLERYCOMPUTER',(paramsArray select _u)];_u = _u + 1};
if ((paramsArray select _u) == 0) then {paramArtyUI = false} else {paramArtyUI = true};_u = _u + 1; //--- Enable Artillery Interface (Artillery Module).
missionNamespace setVariable ['WFBE_ARTILLERYMAXRANGE',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramAIcom = false} else {paramAIcom = true};_u = _u + 1; //--- AI Commander Enabled.
if !(WF_A2_Arrowhead) then {missionNamespace setVariable ['WFBE_ALLIES',(paramsArray select _u)];_u = _u + 1};
if ((paramsArray select _u) == 0) then {paramAARadar = false} else {paramAARadar = true};_u = _u + 1; //--- Anti Air Radar.
if ((paramsArray select _u) == 0) then {paramBaseArea = false} else {paramBaseArea = true};_u = _u + 1; //--- Base Area.
missionNamespace setVariable ['WFBE_BASEAREAMAX',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_AIDEFENSE',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_DEFENSEMANRANGE',(paramsArray select _u)];_u = _u + 1;
//--- Building Limits.
missionNamespace setVariable ['WFBE_BUILDINGMAXBARRACKS',(paramsArray select _u)];
missionNamespace setVariable ['WFBE_BUILDINGMAXLIGHT',(paramsArray select _u)];
missionNamespace setVariable ['WFBE_BUILDINGMAXCOMMANDCENTER',(paramsArray select _u)];
missionNamespace setVariable ['WFBE_BUILDINGMAXHEAVY',(paramsArray select _u)];
missionNamespace setVariable ['WFBE_BUILDINGMAXAIRCRAFT',(paramsArray select _u)];
missionNamespace setVariable ['WFBE_BUILDINGMAXSERVICEPOINT',(paramsArray select _u)*2];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramUseWorkers = false} else {paramUseWorkers = true};_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramDefenseCollide = false} else {paramDefenseCollide = true};_u = _u + 1;
missionNamespace setVariable ['WFBE_HQDEPLOYPRICE',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_HQDEPLOYRANGE',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramBasePatrols = false} else {paramBasePatrols = true};_u = _u + 1; //--- Base patrols.
if ((paramsArray select _u) == 0) then {paramSpawnRestriction = false} else {paramSpawnRestriction = true};_u = _u + 1; //--- Restrict the Spawn logic to 2km within a town.
missionNamespace setVariable ['WFBE_SIDESTARTINGDISTANCE',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_STARTINGLOCATIONMODE',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramMoneyOnly = false} else {paramMoneyOnly = true};_u = _u + 1;
missionNamespace setVariable ['WFBE_INCOMEINTERVAL',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_INCOMESYSTEM',(paramsArray select _u)];_u = _u + 1;
//--- Funds.
missionNamespace setVariable ['WFBE_EASTSTARTINGMONEY',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_WESTSTARTINGMONEY',(paramsArray select _u)];_u = _u + 1;
//--- Supply.
EastSupplies = (paramsArray select _u);_u = _u + 1;
WestSupplies = (paramsArray select _u);_u = _u + 1;
missionNamespace setVariable ['WFBE_SUPPLYSYSTEM',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_FASTTIMERATE', paramsArray select _u];_u = _u + 1;
if (time < 2) then {setDate [(date select 0),(date select 1),(date select 2),(paramsArray select _u),(date select 3)]};_u = _u + 1; //--- Time of Day.
missionNamespace setVariable ['WFBE_WEATHER',(paramsArray select _u)];_u = _u + 1;
if !(WF_A2_Vanilla) then {if ((paramsArray select _u) == 0) then {paramDLCBAF = false} else {paramDLCBAF = true};_u = _u + 1};
if !(WF_A2_Vanilla) then {if ((paramsArray select _u) == 0) then {paramDLCPMC = false} else {paramDLCPMC = true};_u = _u + 1};
if ((paramsArray select _u) == 0) then {paramAlice = false} else {paramAlice = true};_u = _u + 1; //--- Ambient Civilians.
if ((paramsArray select _u) == 0) then {paramHangars = false} else {paramHangars = true};_u = _u + 1; //--- Airport Hangars.
missionNamespace setVariable ['WFBE_UNITREMOVEDLAY',(paramsArray select _u)];_u = _u + 1;
if (WF_ACE) then {paramDefenseReloading = (paramsArray select _u);_u = _u + 1};
missionNamespace setVariable ['WFBE_ABANDONVEHICLETIMER', paramsArray select _u];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramExtendedInventory = false} else {paramExtendedInventory = true};_u = _u + 1;
missionNamespace setVariable ['WFBE_FASTTRAVEL',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramHandleFF = false} else {paramHandleFF = true};_u = _u + 1; //--- Base Friendly Fire.
missionNamespace setVariable ['WFBE_MAXCLUTTERDISTANCE',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramKickTeamswappers = false} else {paramKickTeamswappers = true};_u = _u + 1; //--- Kick teamswappers.
if ((paramsArray select _u) == 0) then {paramBoundaries = false} else {paramBoundaries = true};_u = _u + 1; //--- Prevent players from going outside of the map, they're killed after x seconds.
missionNamespace setVariable ['WFBE_MAPCOLORATION',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_INCOMINGMISSILEMAXRANGE',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramSecondaryMissions = false} else {paramSecondaryMissions = true};_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramShowUID = false} else {paramShowUID = true};_u = _u + 1; //--- Show User ID.
missionNamespace setVariable ['WFBE_BALANCEPRICE',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_THERMALIMAGING',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramTrackAI = false} else {paramTrackAI = true};_u = _u + 1; //--- Track AI (Yellow dots) on map.
if ((paramsArray select _u) == 0) then {paramTrackPlayer = false} else {paramTrackPlayer = true};_u = _u + 1; //--- Track players.
if ((paramsArray select _u) == 0) then {paramBalancing = false} else {paramBalancing = true};_u = _u + 1; //--- Balance the given units weapon loadout.
if ((paramsArray select _u) == 0) then {paramBounty = false} else {paramBounty = true};_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramUpgradesEast = false} else {paramUpgradesEast = true};_u = _u + 1; //--- Upgrades.
if ((paramsArray select _u) == 0) then {paramUpgradesWest = false} else {paramUpgradesWest = true};_u = _u + 1; //--- Upgrades.
missionNamespace setVariable ['WFBE_VICTORYCONDITION',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_MAXVIEWDISTANCE',(paramsArray select _u)];_u = _u + 1;
if (WF_ACE) then {if ((paramsArray select _u) == 0) then {paramAceWounds = false} else {paramAceWounds = true};_u = _u + 1;} else {paramAceWounds = false}; //--- ACE Wounds
if (WF_A2_Vanilla) then {if ((paramsArray select _u) == 0) then {paramCounterMeasures = false} else {paramCounterMeasures = true};_u = _u + 1}; //--- Countermeasures.
if ((paramsArray select _u) == 0) then {paramEASA = false} else {paramEASA = true};_u = _u + 1; //--- EASA.
if ((paramsArray select _u) == 0) then {paramHighCommand = false} else {paramHighCommand = true};_u = _u + 1; //--- High Command.
if ((paramsArray select _u) == 0) then {paramICBM = false} else {paramICBM = true};_u = _u + 1; //--- ICBM.
missionNamespace setVariable ['WFBE_ISIS',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramVolumClouds = false} else {paramVolumClouds = true};_u = _u + 1; //--- Volumetric Clouds.
missionNamespace setVariable ['WFBE_RESPAWNCAMPSMODE',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_RESPAWNCAMPSRULEMODE',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_RESPAWNDELAY',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramRespawnMASH = false} else {paramRespawnMASH = true};_u = _u + 1; //--- MASH respawn's enabled.
if ((paramsArray select _u) == 0) then {paramMobileRespawn = false} else {paramMobileRespawn = true};_u = _u + 1; //--- Mobile respawn's enabled.
missionNamespace setVariable ['WFBE_RESPAWNPENALTY',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_RESPAWNRANGE',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_RESTRICTIONADVAIR',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramGearRestriction = false} else {paramGearRestriction = true};_u = _u + 1; //--- Player have a gear restriction in camps.
if !(WF_A2_Arrowhead) then {if ((paramsArray select _u) == 0) then {paramRestrictionKamov = false} else {paramRestrictionKamov = true};_u = _u + 1}; //--- Kamov enabled.
_u = _u + 1; //--- Town Amount System, leave blank.
missionNamespace setVariable ['WFBE_RESSTRIKER',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramKeepCamps = false} else {paramKeepCamps = true};_u = _u + 1;
missionNamespace setVariable ['WFBE_TOWNCAPTUREMODE',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_CIVILIANFACTION',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_TOWNCONQUESTMODE',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_TOWNGEAR',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramOccup = false} else {paramOccup = true};_u = _u + 1; //--- Town Occupation.
missionNamespace setVariable ['WFBE_TOWNOCCUPATIONDIFFICULTY',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_OCCUPATIONEASTFACTION',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_OCCUPATIONWESTFACTION',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramOccReinf = false} else {paramOccReinf = true};_u = _u + 1; //--- Town Occupation Reinforcement.
missionNamespace setVariable ['WFBE_RESPATROL',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_TOWNBUILDPROTECTIONRANGE',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramPurchaseInfDepot = false} else {paramPurchaseInfDepot = true};_u = _u + 1; //--- Town Milita Purchase.
if ((paramsArray select _u) == 0) then {paramRes = false} else {paramRes = true};_u = _u + 1; //--- Town Resistance.
missionNamespace setVariable ['WFBE_TOWNRESISTANCEDIFFICULTY',(paramsArray select _u)];_u = _u + 1;
missionNamespace setVariable ['WFBE_RESISTANCEFACTION',(paramsArray select _u)];_u = _u + 1;
if ((paramsArray select _u) == 0) then {paramResReinf = false} else {paramResReinf = true};_u = _u + 1; //--- Town Resistance Reinforcement.
if ((paramsArray select _u) == 0) then {paramResVehLock = false} else {paramResVehLock = true};_u = _u + 1; //--- Town Resistance Vehicles Lock.
missionNamespace setVariable ['WFBE_TOWNSTARTINGMODE',(paramsArray select _u)];_u = _u + 1;
};
//--- Debug.
if (WF_Debug) then {
paramUpgradesEast = false;
paramUpgradesWest = false;
paramRes = false;
paramOccup = false;
};
//--- All parameters are set and ready.
initJIP = true;
//---- Server store the groups once in for all.
if (isServer) then {
//--- BUG workaround: "attempt" to ensure that the client is really a client and not a server
if !(isNil "WFBE_EASTTEAMS") exitWith {};
WFBE_EASTTEAMS = [Group EastSlot1,Group EastSlot2,Group EastSlot3,Group EastSlot4,Group EastSlot5,Group EastSlot6,Group EastSlot7,Group EastSlot8,Group EastSlot9,Group EastSlot10,Group EastSlot11,Group EastSlot12,Group EastSlot13,Group EastSlot14,Group EastSlot15,Group EastSlot16];
WFBE_WESTTEAMS = [Group WestSlot1,Group WestSlot2,Group WestSlot3,Group WestSlot4,Group WestSlot5,Group WestSlot6,Group WestSlot7,Group WestSlot8,Group WestSlot9,Group WestSlot10,Group WestSlot11,Group WestSlot12,Group WestSlot13,Group WestSlot14,Group WestSlot15,Group WestSlot16];
for '_i' from 0 to count(WFBE_EASTTEAMS)-1 do {
if (isNil {WFBE_WESTTEAMS select _i}) then {WFBE_WESTTEAMS set [_i, grpNull]};
if (isNil {WFBE_EASTTEAMS select _i}) then {WFBE_EASTTEAMS set [_i, grpNull]};
};
publicVariable "WFBE_EASTTEAMS";
publicVariable "WFBE_WESTTEAMS";
diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] init_JIPCompatible.sqf: Server East teams set and sent %3",diag_frameno,diag_tickTime,WFBE_EASTTEAMS];
diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] init_JIPCompatible.sqf: Server West teams set and sent %3",diag_frameno,diag_tickTime,WFBE_WESTTEAMS];
};
//--- Cli Exec - Wait for sync.
// if (!isServer) then {
diag_log format ["client waiting for broadcasted teams!"];
waitUntil{!isNil 'WFBE_EASTTEAMS' && !isNil 'WFBE_WESTTEAMS'};
diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] init_JIPCompatible.sqf: Received Teams West %3",diag_frameno,diag_tickTime,WFBE_WESTTEAMS];
diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] init_JIPCompatible.sqf: Received Teams East %3",diag_frameno,diag_tickTime,WFBE_EASTTEAMS];
// };
missionNamespace setVariable ['WFBE_EASTTEAMS', WFBE_EASTTEAMS];
missionNamespace setVariable ['WFBE_WESTTEAMS', WFBE_WESTTEAMS];
//--- Slot names.
{
Private ["_temp"];
_temp = [];
{_temp = _temp + [if !(isNull _x) then {vehicleVarName (leader _x)} else {""}]} forEach (_x select 0);
missionNamespace setVariable [_x select 1, _temp];
} forEach [[WFBE_EASTTEAMS,"WFBE_EASTSLOTNAMES"],[WFBE_WESTTEAMS,"WFBE_WESTSLOTNAMES"]];
//--- Maximum players, try to keep the same amount of player on east & west.
maxPlayers = count (missionNamespace getVariable 'WFBE_EASTTEAMS');
//--- Execute the common files.
ExecVM "Common\Init\Init_Common.sqf";
//--- Execute the towns file.
ExecVM "Common\Init\Init_Towns.sqf";
//--- Run the client's part.
if (isClient) then {
diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] init_JIPCompatible.sqf: Executing Client Initialization...",diag_frameno,diag_tickTime];
ExecVM "Client\Init\Init_Client.sqf";
};
//--- Run the server's part.
if (isServer) then {
if (isNil 'EastMHQ' || isNil 'WestMHQ') exitWith {diag_log Format["[WFBE (FATAL ERROR)][frameno:%1 | ticktime:%2] init_JIPCompatible.sqf: The client has attempted to trigger the server part!",diag_frameno,diag_tickTime];};
diag_log Format["[WFBE (INIT)][frameno:%1 | ticktime:%2] init_JIPCompatible.sqf: Executing Server Initialization...",diag_frameno,diag_tickTime];
ExecVM "Server\Init\Init_Server.sqf";
};
//--- Fast Get/Set.
_i = 1;
{if !(isNil '_x') then {_x setVariable ["identification", Format["EastSlot%1",_i]]};_i = _i + 1} forEach (missionNamespace getVariable 'WFBE_EASTTEAMS');
_i = 1;
{if !(isNil '_x') then {_x setVariable ["identification", Format["WestSlot%1",_i]]};_i = _i + 1} forEach (missionNamespace getVariable 'WFBE_WESTTEAMS');
|