· 6 years ago · Nov 13, 2019, 08:46 AM
1/*
2
3 Remove the comments on the MARMA logs if you want to log the spawns to MARMA.
4
5 The _uid variable MUST be changed to a valid UID that already exists in the account table.
6
7 How it works -
8
9 On server init, the script will count AllMissionObjects (X) on a per vehicle basis listed in the array below. If there is less than the defined amount the server will spawn a persistent vehicle with a random pin number
10 UNLOCKED at the defined or random road position.
11
12 This script can be used to replace the standard EXILE world vehicle spawns, so that the vehicles that are spawned are persistent. Players will not know the pin number, but its still a "benefit" to them as the vehicle they find
13 is persistent. And hey, they might just guess the number..
14
15 This script accounts for ALL vehicles, purchased or other wise. So if players have bought vehicles, and those vehicles exceed the maximum defined number in tbe below array, the server wont spawn anymore.
16
17 Configure the _vehicleArray below
18 Adjust the safePos parameters line 132 - 138
19
20*/
21
22uiSleep 30;
23
24diag_log ["ExileServer - Spawning persistent vehicle spawns"];
25//["ExileServer - Spawning world persistent vehicles"] call MAR_fnc_log;
26
27private ["_count","_uid","_debugForSP","_vehicle","_vehicleArray","_count","_vehicleClass","_position","_positionCount","_pinCode","_vehicleObject","_nearVehicles","_nearVechicleCount","_marker","_cancelSpawn","_isRandomRoadPos","_road","_scriptComplete"];
28
29_scriptComplete = false;
30_debugForSP = false; // If true , when the script is run in the editor it will create markers on the vehicle spawns.
31
32_uid = "76561198079956410"; // Needs to be a valid UID that exists in the account table (best to use a server owners uid)
33
34/*
35 How the vehicle array works -
36
37 Select 0 - Vehicle class name
38 Select 1 - Number - amount limit, will only maintain this many vehicles on the server
39 Select 2 - Array of positions EG [] - Will randomly select one of the positions per vehicle, if the position is occupied it will try for the other positions
40 Select 3 - Boolean - If true, will spawn the vehicle on a random road, if false, will look to the positions above.
41
42*/
43
44_vehicleArray =
45[
46["Exile_Bike_QuadBike_Black",4,[],true],
47["Exile_Bike_QuadBike_Csat",4,[],true],
48["Exile_Car_Van_Box_Black",4,[],true],
49["Exile_Car_Offroad_White",4,[],true],
50["Exile_Car_MB4WDOpen",4,[],true],
51["Exile_Car_MB4WD",4,[],true],
52["Exile_Car_Hatchback_Sport_Red",4,[],true],
53["Exile_Car_ProwlerLight",4,[],true],
54["Exile_Car_ProwlerUnarmed",4,[],true],
55["Exile_Car_QilinUnarmed",4,[],true],
56["Exile_Car_SUV_Black",4,[],true],
57["Exile_Car_SUV_Grey",4,[],true],
58["Exile_Car_SUV_Orange",4,[],true],
59["Exile_Car_Volha_Blue",4,[],true],
60["Exile_Car_Volha_White",4,[],true],
61["Exile_Car_Volha_Black",4,[],true],
62["Exile_Car_Ikarus_Blue",4,[],true],
63["Exile_Car_Zamak",4,[],true],
64["Exile_Car_Ural_Covered_Blue",4,[],true],
65["Exile_Car_Ural_Covered_Yellow",4,[],true],
66["Exile_Car_Ural_Covered_Worker",4,[],true],
67["Exile_Car_Ural_Covered_Military",4,[],true],
68["Exile_Car_LandRover_Red",4,[],true],
69["Exile_Car_LandRover_Urban",4,[],true],
70["Exile_Car_LandRover_Green",4,[],true],
71["Exile_Car_LandRover_Sand",4,[],true],
72["Exile_Car_LandRover_Desert",4,[],true],
73["B_APC_Tracked_02_AA_F",4,[],true],
74["B_APC_Tracked_02_CRV_F",4,[],true],
75["B_APC_Tracked_02_rcws_F",4,[],true],
76["B_MBT_02_TUSK_F",4,[],true],
77["B_MBT_02_arty_F",4,[],true],
78["B_MBT_02_cannon_F",4,[],true],
79["B_MBT_02_mlrs_F",4,[],true],
80["I_APC_tracked_02_cannon_F",4,[],true],
81["I_MBT_02_cannon_F",4,[],true],
82["O_APC_Tracked_02_AA_F",4,[],true],
83["O_APC_Tracked_02_cannon_F",4,[],true],
84["O_APC_Wheeled_02_rcws_F",4,[],true],
85["O_APC_Wheeled_02_rcws_v2_F",4,[],true],
86["B_APC_Wheeled_02_cannon_F",4,[],true],
87["O_MBT_02_arty_F",4,[],true],
88["O_MBT_02_cannon_F",4,[],true],
89["B_MRAP_02_F",4,[],true],
90["B_MRAP_02_hmg_F",4,[],true],
91["B_MRAP_02_gmg_F",4,[],true],
92["O_G_Offroad_02_F",4,[],true],
93["O_G_Offroad_02_armed_F",4,[],true],
94["O_Quadbike_02_F",4,[],true],
95["O_G_Quadbike_02_F",4,[],true],
96["B_Truck_02_covered_F",4,[],true],
97["B_Truck_02_transport_F",4,[],true],
98["O_G_Van_02_transport_F",4,[],true],
99["B_T_MRAP_02_hmg_F",4,[],true],
100["O_T_MRAP_02_hmg_ghex_F",4,[],true],
101["O_T_MRAP_02_gmg_ghex_F",4,[],true],
102["C_Quadbike_02_black_F",4,[],true],
103["O_Truck_02_transport_F",4,[],true],
104["O_Truck_02_covered_F",4,[],true],
105["O_Truck_02_device_F",4,[],true],
106["B_G_Offroad_02_armed_F",4,[],true],
107["B_G_Van_02_transport_F",4,[],true],
108["O_G_Offroad_02_repair_F",4,[],true],
109["B_T_Truck_02_box_F",4,[],true],
110["B_T_Truck_02_medical_F",4,[],true],
111["O_G_Van_02_fuel_F",4,[],true],
112["B_Truck_02_Repair_F",4,[],true],
113["B_T_Truck_02_fuel_F",4,[],true],
114["B_Truck_02_medical_F",4,[],true],
115["RHS_AH2Z",4,[],true],
116["RHS_AH64D",4,[],true],
117["RHS_CH_47F",4,[],true],
118["RHS_UH2Y",4,[],true],
119["RHS_UH60M",4,[],true],
120["RHS_UH60M_MEV",4,[],true],
121["RHS_CH_47F",4,[],true],
122["O_Heli_Light_02_dynamicLoadout_F",4,[],true],
123["O_Heli_Transport_04_covered_black_F",4,[],true],
124["B_Heli_Light_02_F",4,[],true],
125["B_Heli_Transport_02_F",4,[],true],
126["B_Heli_Transport_02_camo_F",4,[],true],
127["B_Heli_Transport_02_camo_F",4,[],true],
128["I_Heli_light_02_dynamicLoadout_F",4,[],true],
129["B_Heli_Transport_02_unarmed_green_F",4,[],true],
130["B_Heli_Transport_02_unarmed_F",4,[],true],
131["B_T_VTOL_02_armed_F",4,[],true],
132["O_T_VTOL_02_vehicle_ghex_F",4,[],true],
133["rhsusf_M2078A2P2_B_M2_WD_fmtv_usarmy",4,[],true],
134["rhsusf_M2078A2P2_B_d_fmtv_usarmy",4,[],true],
135["rhsusf_M2078A2P2_B_wd_fmtv_usarmy",4,[],true],
136["rhsusf_M2078A2P2_d_fmtv_usarmy",4,[],true],
137["rhsusf_M2082A2P2_B_M2_D_fmtv_usarmy",4,[],true],
138["rhsusf_M2082A2P2_B_M2_wd_fmtv_usarmy",4,[],true],
139["rhsusf_M2082A2P2_B_D_fmtv_usarmy",4,[],true],
140["rhsusf_M2084A2P2_D_fmtv_usarmy",4,[],true],
141["rhsusf_M2084A2P2_WD_fmtv_usarmy",4,[],true],
142["rhsusf_m2025_w_mk29",4,[],true],
143["rhsusf_m998_w_2dr",4,[],true],
144["rhsusf_m998_w_4dr",4,[],true],
145["rhsusf_rg22_d",4,[],true],
146["rhsusf_rg22_m2_wd",4,[],true],
147["RHS_M2A2",4,[],true],
148["RHS_M2A2_BUSKI",4,[],true],
149["rhsusf_m209_usarmy",4,[],true],
150["rhsusf_m209d_usarmy",4,[],true],
151["rhsusf_m222_usarmy_M240",4,[],true],
152["rhsusf_m222_usarmy_MK29",4,[],true],
153["rhsusf_m222d_usarmy_medical",4,[],true],
154["rhsusf_m222_usarmy_supply",4,[],true],
155["rhsusf_m222_usarmy_unarmed",4,[],true],
156["rhsusf_m222d_usarmy",4,[],true],
157["rhsusf_m222d_usarmy_M240",4,[],true],
158["rhsusf_m222d_usarmy_MK29",4,[],true],
159["rhsusf_m222d_usarmy_medical",4,[],true],
160["rhsusf_m222d_usarmy_supply",4,[],true],
161["rhsusf_m222d_usarmy_unarmed",4,[],true],
162["rhsusf_m2a2aim_tuski_d",4,[],true],
163["rhsusf_m2a2aim_tuski_wd",4,[],true],
164["rhsusf_m2a2aimd_usarmy",4,[],true],
165["rhsusf_m2a2sep2tuskiwd_usarmy",4,[],true],
166["rhsusf_m2a2fep_d",4,[],true],
167["rhsusf_m2a2fep_od",4,[],true],
168["rhsusf_m2a2fep_wd",4,[],true],
169["rhsusf_m2a2sep2d_usarmy",4,[],true],
170["rhsusf_m2a2sep2tuskid_usarmy",4,[],true],
171["rhsusf_m2a2sep2tuskiid_usarmy",4,[],true],
172["rhsusf_m2a2sep2tuskiiwd_usarmy",4,[],true],
173["rhsusf_m2a2sep2tuskiwd_usarmy",4,[],true],
174["rhsusf_m2a2sep2wd_usarmy",4,[],true],
175["Exile_Chopper_Hellcat_Green",4,[],true],
176["Exile_Chopper_Hummingbird_Green",4,[],true],
177["Exile_Chopper_Mohawk_FIA",4,[],true],
178["Exile_Chopper_Orca_CSAT",4,[],true],
179["Exile_Bike_QuadBike_Black",4,[],true],
180["Exile_Bike_QuadBike_Csat",4,[],true],
181["Exile_Car_Van_Box_Black",4,[],true],
182["Exile_Car_Offroad_White",4,[],true],
183["Exile_Car_MB4WDOpen",4,[],true],
184["Exile_Car_MB4WD",4,[],true],
185["Exile_Car_Hatchback_Sport_Red",4,[],true],
186["Exile_Car_ProwlerLight",4,[],true],
187["Exile_Car_ProwlerUnarmed",4,[],true],
188["Exile_Car_QilinUnarmed",4,[],true],
189["Exile_Car_SUV_Black",4,[],true],
190["Exile_Car_SUV_Grey",4,[],true],
191["Exile_Car_SUV_Orange",4,[],true],
192["Exile_Car_Volha_Blue",4,[],true],
193["Exile_Car_Volha_White",4,[],true],
194["Exile_Car_Volha_Black",4,[],true],
195["Exile_Car_Ikarus_Blue",4,[],true],
196["Exile_Car_Zamak",4,[],true],
197["Exile_Car_Ural_Covered_Blue",4,[],true],
198["Exile_Car_Ural_Covered_Yellow",4,[],true],
199["Exile_Car_Ural_Covered_Worker",4,[],true],
200["Exile_Car_Ural_Covered_Military",4,[],true],
201["Exile_Car_LandRover_Red",4,[],true],
202["Exile_Car_LandRover_Urban",4,[],true],
203["Exile_Car_LandRover_Green",4,[],true],
204["Exile_Car_LandRover_Sand",4,[],true],
205["Exile_Car_LandRover_Desert",4,[],true],
206["B_APC_Tracked_02_AA_F",4,[],true],
207["B_APC_Tracked_02_CRV_F",4,[],true],
208["B_APC_Tracked_02_rcws_F",4,[],true],
209["B_MBT_02_TUSK_F",4,[],true],
210["B_MBT_02_arty_F",4,[],true],
211["B_MBT_02_cannon_F",4,[],true],
212["B_MBT_02_mlrs_F",4,[],true],
213["I_APC_tracked_02_cannon_F",4,[],true],
214["I_MBT_02_cannon_F",4,[],true],
215["O_APC_Tracked_02_AA_F",4,[],true],
216["O_APC_Tracked_02_cannon_F",4,[],true],
217["O_APC_Wheeled_02_rcws_F",4,[],true],
218["O_APC_Wheeled_02_rcws_v2_F",4,[],true],
219["B_APC_Wheeled_02_cannon_F",4,[],true],
220["O_MBT_02_arty_F",4,[],true],
221["O_MBT_02_cannon_F",4,[],true],
222["B_MRAP_02_F",4,[],true],
223["B_MRAP_02_hmg_F",4,[],true],
224["B_MRAP_02_gmg_F",4,[],true],
225["O_G_Offroad_02_F",4,[],true],
226["O_G_Offroad_02_armed_F",4,[],true],
227["O_Quadbike_02_F",4,[],true],
228["O_G_Quadbike_02_F",4,[],true],
229["B_Truck_02_covered_F",4,[],true],
230["B_Truck_02_transport_F",4,[],true],
231["O_G_Van_02_transport_F",4,[],true],
232["B_T_MRAP_02_hmg_F",4,[],true],
233["O_T_MRAP_02_hmg_ghex_F",4,[],true],
234["O_T_MRAP_02_gmg_ghex_F",4,[],true],
235["C_Quadbike_02_black_F",4,[],true],
236["O_Truck_02_transport_F",4,[],true],
237["O_Truck_02_covered_F",4,[],true],
238["O_Truck_02_device_F",4,[],true],
239["B_G_Offroad_02_armed_F",4,[],true],
240["B_G_Van_02_transport_F",4,[],true],
241["O_G_Offroad_02_repair_F",4,[],true],
242["B_T_Truck_02_box_F",4,[],true],
243["B_T_Truck_02_medical_F",4,[],true],
244["O_G_Van_02_fuel_F",4,[],true],
245["B_Truck_02_Repair_F",4,[],true],
246["B_T_Truck_02_fuel_F",4,[],true],
247["B_Truck_02_medical_F",4,[],true],
248["RHS_AH2Z",4,[],true],
249["RHS_AH64D",4,[],true],
250["RHS_CH_47F",4,[],true],
251["RHS_UH2Y",4,[],true],
252["RHS_UH60M",4,[],true],
253["RHS_UH60M_MEV",4,[],true],
254["RHS_CH_47F",4,[],true],
255["O_Heli_Light_02_dynamicLoadout_F",4,[],true],
256["O_Heli_Transport_04_covered_black_F",4,[],true],
257["B_Heli_Light_02_F",4,[],true],
258["B_Heli_Transport_02_F",4,[],true],
259["B_Heli_Transport_02_camo_F",4,[],true],
260["B_Heli_Transport_02_camo_F",4,[],true],
261["I_Heli_light_02_dynamicLoadout_F",4,[],true],
262["B_Heli_Transport_02_unarmed_green_F",4,[],true],
263["B_Heli_Transport_02_unarmed_F",4,[],true],
264["B_T_VTOL_02_armed_F",4,[],true],
265["O_T_VTOL_02_vehicle_ghex_F",4,[],true],
266["rhsusf_M2078A2P2_B_M2_WD_fmtv_usarmy",4,[],true],
267["rhsusf_M2078A2P2_B_d_fmtv_usarmy",4,[],true],
268["rhsusf_M2078A2P2_B_wd_fmtv_usarmy",4,[],true],
269["rhsusf_M2078A2P2_d_fmtv_usarmy",4,[],true],
270["rhsusf_M2082A2P2_B_M2_D_fmtv_usarmy",4,[],true],
271["rhsusf_M2082A2P2_B_M2_wd_fmtv_usarmy",4,[],true],
272["rhsusf_M2082A2P2_B_D_fmtv_usarmy",4,[],true],
273["rhsusf_M2084A2P2_D_fmtv_usarmy",4,[],true],
274["rhsusf_M2084A2P2_WD_fmtv_usarmy",4,[],true],
275["rhsusf_m2025_w_mk29",4,[],true],
276["rhsusf_m998_w_2dr",4,[],true],
277["rhsusf_m998_w_4dr",4,[],true],
278["rhsusf_rg22_d",4,[],true],
279["rhsusf_rg22_m2_wd",4,[],true],
280["RHS_M2A2",4,[],true],
281["RHS_M2A2_BUSKI",4,[],true],
282["rhsusf_m209_usarmy",4,[],true],
283["rhsusf_m209d_usarmy",4,[],true],
284["rhsusf_m222_usarmy_M240",4,[],true],
285["rhsusf_m222_usarmy_MK29",4,[],true],
286["rhsusf_m222d_usarmy_medical",4,[],true],
287["rhsusf_m222_usarmy_supply",4,[],true],
288["rhsusf_m222_usarmy_unarmed",4,[],true],
289["rhsusf_m222d_usarmy",4,[],true],
290["rhsusf_m222d_usarmy_M240",4,[],true],
291["rhsusf_m222d_usarmy_MK29",4,[],true],
292["rhsusf_m222d_usarmy_medical",4,[],true],
293["rhsusf_m222d_usarmy_supply",4,[],true],
294["rhsusf_m222d_usarmy_unarmed",4,[],true],
295["rhsusf_m2a2aim_tuski_d",4,[],true],
296["rhsusf_m2a2aim_tuski_wd",4,[],true],
297["rhsusf_m2a2aimd_usarmy",4,[],true],
298["rhsusf_m2a2sep2tuskiwd_usarmy",4,[],true],
299["rhsusf_m2a2fep_d",4,[],true],
300["rhsusf_m2a2fep_od",4,[],true],
301["rhsusf_m2a2fep_wd",4,[],true],
302["rhsusf_m2a2sep2d_usarmy",4,[],true],
303["rhsusf_m2a2sep2tuskid_usarmy",4,[],true],
304["rhsusf_m2a2sep2tuskiid_usarmy",4,[],true],
305["rhsusf_m2a2sep2tuskiiwd_usarmy",4,[],true],
306["rhsusf_m2a2sep2tuskiwd_usarmy",4,[],true],
307["rhsusf_m2a2sep2wd_usarmy",4,[],true],
308["Exile_Chopper_Hellcat_Green",4,[],true],
309["Exile_Chopper_Hummingbird_Green",4,[],true],
310["Exile_Chopper_Mohawk_FIA",4,[],true],
311["Exile_Chopper_Orca_CSAT",4,[],true],
312["CUP_C_Datsun",4,[],true],
313["CUP_C_Datsun_4seat",4,[],true],
314["CUP_C_Datsun_Plain",4,[],true],
315["CUP_C_Datsun_Covered",4,[],true],
316["CUP_C_Datsun_Tubeframe",4,[],true],
317["CUP_C_Ural_Civ_01",4,[],true],
318["CUP_C_Ural_Civ_02",4,[],true],
319["CUP_C_Ural_Civ_03",4,[],true],
320["CUP_C_Ural_Open_Civ_01",4,[],true],
321["CUP_C_Ural_Open_Civ_02",4,[],true],
322["CUP_C_Ural_Open_Civ_03",4,[],true],
323["CUP_O_Ural_TKA",4,[],true],
324["CUP_O_Ural_RU",4,[],true],
325["CUP_I_Ural_UN",4,[],true],
326["CUP_B_Ural_CDF",4,[],true],
327["CUP_O_Ural_CHDKZ",4,[],true],
328["CUP_O_Ural_SLA",4,[],true],
329["CUP_O_Ural_Open_TKA",4,[],true],
330["CUP_B_Ural_Open_CDF",4,[],true],
331["CUP_O_Ural_Open_RU",4,[],true],
332["CUP_O_Ural_Open_CHDKZ",4,[],true],
333["CUP_O_Ural_Open_SLA",4,[],true],
334["CUP_O_Ural_Empty_SLA",4,[],true],
335["CUP_B_Ural_Empty_CDF",4,[],true],
336["CUP_I_Ural_Empty_UN",4,[],true],
337["CUP_O_Ural_Empty_RU",4,[],true],
338["CUP_O_Ural_Empty_CHDKZ",4,[],true],
339["CUP_O_Ural_Empty_TKA",4,[],true],
340["CUP_O_Ural_Repair_SLA",4,[],true],
341["CUP_O_Ural_Repair_TKA",4,[],true],
342["CUP_O_Ural_Repair_CHDKZ",4,[],true],
343["CUP_O_Ural_Repair_RU",4,[],true],
344["CUP_I_Ural_Repair_UN",4,[],true],
345["CUP_B_Ural_Repair_CDF",4,[],true],
346["CUP_B_Ural_Refuel_CDF",4,[],true],
347["CUP_O_Ural_Refuel_RU",4,[],true],
348["CUP_O_Ural_Refuel_CHDKZ",4,[],true],
349["CUP_O_Ural_Refuel_TKA",4,[],true],
350["CUP_O_Ural_Refuel_SLA",4,[],true],
351["CUP_C_LR_Transport_CTK",4,[],true],
352["CUP_O_LR_Transport_TKA",4,[],true],
353["CUP_O_LR_Transport_TKM",4,[],true],
354["CUP_B_LR_Transport_CZ_W",4,[],true],
355["CUP_B_LR_Transport_CZ_D",4,[],true],
356["CUP_B_LR_Transport_GB_W",4,[],true],
357["CUP_B_LR_Transport_GB_D",4,[],true],
358["CUP_B_LR_Ambulance_CZ_W",4,[],true],
359["CUP_B_LR_Ambulance_CZ_D",4,[],true],
360["CUP_B_LR_Ambulance_GB_W",4,[],true],
361["CUP_B_LR_Ambulance_GB_D",4,[],true],
362["CUP_O_LR_Ambulance_TKA",4,[],true],
363["CUP_C_UAZ_Unarmed_TK_CIV",4,[],true],
364["CUP_O_UAZ_Unarmed_RU",4,[],true],
365["CUP_I_UAZ_Unarmed_UN",4,[],true],
366["CUP_O_UAZ_Unarmed_TKA",4,[],true],
367["CUP_O_UAZ_Unarmed_CHDKZ",4,[],true],
368["CUP_B_UAZ_Unarmed_ACR",4,[],true],
369["CUP_B_UAZ_Unarmed_CDF",4,[],true],
370["CUP_O_UAZ_Open_CHDKZ",4,[],true],
371["CUP_O_UAZ_Open_RU",4,[],true],
372["CUP_O_UAZ_Open_TKA",4,[],true],
373["CUP_I_UAZ_Open_UN",4,[],true],
374["CUP_B_UAZ_Open_ACR",4,[],true],
375["CUP_B_UAZ_Open_CDF",4,[],true],
376["CUP_C_UAZ_Open_TK_CIV",4,[],true],
377["CUP_B_HMMWV_Unarmed_USA",4,[],true],
378["CUP_B_HMMWV_Unarmed_USMC",4,[],true],
379["CUP_B_HMMWV_Ambulance_USMC",4,[],true],
380["CUP_B_HMMWV_Ambulance_USA",4,[],true],
381["CUP_B_HMMWV_Ambulance_ACR",4,[],true],
382["CUP_B_HMMWV_Transport_USA",4,[],true],
383["CUP_I_M113_Med_RACS",4,[],true],
384["CUP_I_M113_Med_UN",4,[],true],
385["CUP_B_MTVR_USA",4,[],true],
386["CUP_B_MTVR_Ammo_USA",4,[],true],
387["CUP_B_MTVR_Refuel_USA",4,[],true],
388["CUP_B_MTVR_Repair_USA",4,[],true],
389["CUP_B_MTVR_USMC",4,[],true],
390["CUP_B_MTVR_Ammo_USMC",4,[],true],
391["CUP_B_MTVR_Refuel_USMC",4,[],true],
392["CUP_B_MTVR_Repair_USMC",4,[],true],
393["CUP_O_LR_MG_TKM",4,[],true],
394["CUP_O_LR_MG_TKA",4,[],true],
395["CUP_I_Datsun_PK",4,[],true],
396["CUP_I_Datsun_PK_Random",4,[],true],
397["CUP_I_Datsun_PK_TK",4,[],true],
398["CUP_I_Datsun_PK_TK_Random",4,[],true],
399["CUP_O_Datsun_PK",4,[],true],
400["CUP_O_Datsun_PK_Random",4,[],true],
401["CUP_O_UAZ_MG_CHDKZ",4,[],true],
402["CUP_O_UAZ_MG_RU",4,[],true],
403["CUP_O_UAZ_MG_TKA",4,[],true],
404["CUP_I_UAZ_MG_UN",4,[],true],
405["CUP_B_UAZ_MG_ACR",4,[],true],
406["CUP_B_UAZ_MG_CDF",4,[],true],
407["CUP_B_UAZ_AGS30_CDF",4,[],true],
408["CUP_O_UAZ_AGS30_CHDKZ",4,[],true],
409["CUP_O_UAZ_AGS30_RU",4,[],true],
410["CUP_O_UAZ_AGS30_TKA",4,[],true],
411["CUP_I_UAZ_AGS30_UN",4,[],true],
412["CUP_I_M113_RACS",4,[],true],
413["CUP_I_M113_UN",4,[],true],
414["CUP_B_BRDM2_HQ_CDF",4,[],true],
415["CUP_I_BRDM2_HQ_UN",4,[],true],
416["CUP_I_BRDM2_HQ_NAPA",4,[],true],
417["CUP_I_BRDM2_HQ_TK_Gue",4,[],true],
418["CUP_O_BRDM2_HQ_TKA",4,[],true],
419["CUP_O_BRDM2_HQ_CHDKZ",4,[],true],
420["CUP_O_BRDM2_CHDKZ",4,[],true],
421["CUP_O_BRDM2_SLA",4,[],true],
422["CUP_O_BRDM2_TKA",4,[],true],
423["CUP_I_BRDM2_NAPA",4,[],true],
424["CUP_I_BRDM2_TK_Gue",4,[],true],
425["CUP_I_BRDM2_UN",4,[],true],
426["CUP_B_BRDM2_CDF",4,[],true],
427["CUP_BAF_Jackal2_L2A1_W",4,[],true],
428["CUP_BAF_Jackal2_L2A1_D",4,[],true],
429["CUP_BAF_Jackal2_GMG_D",4,[],true],
430["CUP_BAF_Jackal2_GMG_W",4,[],true],
431["CUP_B_LR_Special_CZ_W",4,[],true],
432["CUP_B_LR_Special_Des_CZ_D",4,[],true],
433["CUP_B_LR_MG_CZ_W",4,[],true],
434["CUP_B_LR_MG_GB_W",4,[],true],
435["CUP_B_HMMWV_M1114_USMC",4,[],true],
436["CUP_B_HMMWV_M2_USMC",4,[],true],
437["CUP_B_HMMWV_Crows_M2_USA",4,[],true],
438["CUP_B_HMMWV_M2_GPK_USA",4,[],true],
439["CUP_B_HMMWV_M2_USA",4,[],true],
440["CUP_B_HMMWV_DSHKM_GPK_ACR",4,[],true],
441["CUP_B_HMMWV_AGS_GPK_ACR",4,[],true],
442["CUP_B_HMMWV_MK19_USMC",4,[],true],
443["CUP_B_HMMWV_MK19_USA",4,[],true],
444["CUP_B_HMMWV_Crows_MK19_USA",4,[],true],
445["CUP_B_HMMWV_SOV_USA",4,[],true],
446["CUP_B_Ridgback_HMG_GB_D",4,[],true],
447["CUP_B_Ridgback_HMG_GB_W",4,[],true],
448["CUP_B_Ridgback_GMG_GB_D",4,[],true],
449["CUP_B_Ridgback_GMG_GB_W",4,[],true],
450["CUP_B_Ridgback_LMG_GB_D",4,[],true],
451["CUP_B_Ridgback_LMG_GB_W",4,[],true],
452["CUP_B_Wolfhound_HMG_GB_D",4,[],true],
453["CUP_B_Wolfhound_HMG_GB_W",4,[],true],
454["CUP_B_Wolfhound_GMG_GB_D",4,[],true],
455["CUP_B_Wolfhound_GMG_GB_W",4,[],true],
456["CUP_B_Wolfhound_LMG_GB_D",4,[],true],
457["CUP_B_Wolfhound_LMG_GB_W",4,[],true],
458["CUP_B_RG31_M2_USMC",4,[],true],
459["CUP_B_RG31_M2_OD_USMC",4,[],true],
460["CUP_B_RG31_M2_GC_USMC",4,[],true],
461["CUP_B_RG31_Mk19_USMC",4,[],true],
462["CUP_B_RG31_Mk19_OD_USMC",4,[],true],
463["CUP_B_RG31E_M2_USMC",4,[],true],
464["CUP_O_GAZ_Vodnik_BPPU_RU",4,[],true],
465["CUP_O_GAZ_Vodnik_PK_RU",4,[],true],
466["CUP_B_CH53E_USMC",4,[],true],
467["CUP_B_UH1Y_UNA_F",4,[],true],
468["CUP_B_UH1Y_MEV_F",4,[],true],
469["CUP_C_Mi17_Civilian_RU",4,[],true],
470["CUP_B_Mi17_CDF",4,[],true],
471["CUP_O_Mi17_TK",4,[],true],
472["CUP_B_Mi17_medevac_CDF",4,[],true],
473["CUP_B_Mi171Sh_Unarmed_ACR",4,[],true],
474["CUP_O_Mi8_medevac_CHDKZ",4,[],true],
475["CUP_O_Mi8_medevac_RU",4,[],true],
476["CUP_Merlin_HC3_FFV",4,[],true],
477["CUP_Merlin_HC3",4,[],true],
478["CUP_Merlin_HC3_MED",4,[],true],
479["CUP_B_MH60S_USMC",4,[],true],
480["CUP_B_MH60S_FFV_USMC",4,[],true],
481["CUP_B_AW159_Unarmed_BAF",4,[],true],
482["CUP_B_CH47F_USA",4,[],true],
483["CUP_B_CH47F_GB",4,[],true],
484["CUP_B_UH60M_US",4,[],true],
485["CUP_B_UH60L_US",4,[],true],
486["CUP_B_UH60M_FFV_US",4,[],true],
487["CUP_B_UH60L_FFV_US",4,[],true],
488["CUP_B_UH60M_Unarmed_US",4,[],true],
489["CUP_B_UH60L_Unarmed_US",4,[],true],
490["CUP_B_UH60M_Unarmed_FFV_US",4,[],true],
491["CUP_B_UH60L_Unarmed_FFV_US",4,[],true],
492["CUP_B_UH60M_Unarmed_FFV_MEV_US",4,[],true],
493["CUP_B_UH60L_Unarmed_FFV_MEV_US",4,[],true],
494["CUP_I_UH60L_RACS",4,[],true],
495["CUP_I_UH60L_FFV_RACS",4,[],true],
496["CUP_I_UH60L_Unarmed_RACS",4,[],true],
497["CUP_I_UH60L_Unarmed_FFV_Racs",4,[],true],
498["CUP_I_UH60L_Unarmed_FFV_MEV_Racs",4,[],true],
499["CUP_B_AH1Z_NoWeapons",4,[],true],
500["CUP_C_DC3_CIV",4,[],true],
501["CUP_C_C47_CIV",4,[],true],
502["CUP_B_MV22_USMC",4,[],true],
503["CUP_B_AV8B_Empty",4,[],true]
504];
505
506
507{
508 for "_i" from 0 to (_x select 1) do
509 {
510 _cancelSpawn = false;
511 _obj = _x select 0;
512 _count = count allMissionObjects _obj;
513 _positionCount = (count (_x select 2));
514 _isRandomRoadPos = _x select 3;
515
516 if !(_count >= _x select 1) then
517 {
518 _vehicleClass = _x select 0;
519 _position = selectRandom (_x select 2);
520
521 if !(_isRandomRoadPos) then
522 {
523 _foundSafePos = false;
524 _failSafe = 15;
525 _checks = 0;
526 waitUntil
527 {
528 _position = selectRandom (_x select 2);
529 _nearVehicles = nearestObjects [_position, ["car","air"], 10];
530 _nearVechicleCount = count _nearVehicles;
531 if (_nearVechicleCount == 0) then
532 {
533 _foundSafePos = true;
534 };
535 _checks = _checks + 1;
536 if (_checks >= _failSafe) then {_cancelSpawn = true; _foundSafePos = true;};
537 _foundSafePos
538 };
539 }
540 else
541 {
542 _foundSafePos = false;
543 waitUntil
544 {
545 _spawnCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition"); //Center of your map
546 _min = 15 // minimum distance from the center position (Number) in meters
547 _max = 175561; // maximum distance from the center position (Number) in meters
548 _mindist = 5; // minimum distance from the nearest object (Number) in meters, ie. spawn at least this distance away from anything within x meters..
549 _water = 0; // water mode 0: cannot be in water , 1: can either be in water or not , 2: must be in water
550 _shoremode = 0; // 0: does not have to be at a shore , 1: must be at a shore
551 _blackList = [[[0, 0],[0,0]]];
552
553 _startPosRoad = [_spawnCenter,_min,_max,_mindist,_water,10,_shoremode,_blackList] call BIS_fnc_findSafePos; //Find random spot on the map
554 //_onRoadCheck = _startPosRoad nearRoads 100; //Find road objects 100m from spot
555 //_countPossibleRoads = count _onRoadCheck; // count road objects
556
557 //if (_countPossibleRoads == 0) then
558 //{
559 //}
560 //else
561 //{
562 // _road = _onRoadCheck select 0;
563 // _position = getPos _road;
564 // _foundSafePos = true;
565 //};
566 _startPosRoad pushBack 0;
567 _position = _startPosRoad;
568 _foundSafePos = true;
569 uiSleep 0.1;
570 _foundSafePos
571 };
572 };
573 if !(_cancelSpawn) then
574 {
575 if !(_debugForSP) then
576 {
577 _pinCode = format ["%1%2%3%4",round (random 8 +1),round (random 8 +1),round (random 8 +1),round (random 8 +1)];
578 _vehicleObject = [_vehicleClass, _position, (random 360), true,_pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
579 _vehicleObject setDamage 0.6;
580 _vehicleObject setFuel round (random 15 +10);
581
582 if !((_x select 0) isKindOf "AIR") then
583 {
584 _wheels = ["HitLF2Wheel","HitLFWheel","HitRFWheel","HitRF2Wheel"];
585 {
586 if (random 1 > 0.5) then
587 {
588 _vehicleObject setHitPointDamage [_x,1];
589 };
590 } forEach _wheels;
591 };
592 _vehicleObject setVariable ["ExileOwnerUID", _uid];
593 _vehicleObject setVariable ["ExileIsLocked",0];
594 _vehicleObject lock 0;
595 _vehicleObject call ExileServer_object_vehicle_database_insert;
596 _vehicleObject call ExileServer_object_vehicle_database_update;
597
598 diag_log format ["[Event: Persistent Spawns] -- Spawned a %1 at location: %2 -- Max allowed: %3",_x select 0,_position, _x select 1];
599 //[format["[Event: Persistent Spawns] -- Spawned a %1 at location: %2 -- Max allowed: %3",_x select 0,_position, _x select 1]] call MAR_fnc_log;
600 }
601 else
602 {
603 _vehicleObject = createVehicle [_vehicleClass,_position,[], 0, "NONE"];
604
605 if !((_x select 0) isKindOf "AIR") then
606 {
607 _wheels = ["HitLF2Wheel","HitLFWheel","HitRFWheel","HitRF2Wheel"];
608 {
609 _vehicleObject setHitPointDamage [_x,1];
610 } forEach _wheels;
611 };
612
613 _marker = createMarker [format["HeliCrash%1", diag_tickTime], _position];
614 _marker setMarkerType "mil_dot";
615 _marker setMarkerText "Vehicle";
616 };
617 }
618 else
619 {
620 if !(_debugForSP) then
621 {
622 //[format["[Event: Persistent Spawns] -- Could not find valid spawn position for %1 at position %2 -- exiting try for this vehicle",_x select 0,_position]] call MAR_fnc_log;
623 diag_log format["[Event: Persistent Spawns] -- Could not find valid spawn position for %1 at position %2 -- exiting try for this vehicle",_x select 0,_position];
624 }
625 else
626 {
627 hint format["[Event: Persistent Spawns] -- Could not find valid spawn position for %1 at position %2 -- exiting try for this vehicle",_x select 0,_position];
628 };
629 };
630 };
631 };
632
633} forEach _vehicleArray;
634
635_scriptComplete = true;
636
637waitUntil
638{
639 diag_log format ["ExileServer - Finished spawning world vehicles"];
640 //["ExileServer - Finished spawning world vehicles"] call MAR_fnc_log;
641 _scriptComplete
642};