· 6 years ago · Nov 12, 2019, 03:30 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 [[0,0,0].[0,0,0]] - 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,[[0,0,0].[0,0,0]],false],
47["Exile_Bike_QuadBike_Csat",4,[[0,0,0].[0,0,0]],false],
48["Exile_Car_Van_Box_Black",4,[[0,0,0].[0,0,0]],false],
49["Exile_Car_Offroad_White",4,[[0,0,0].[0,0,0]],false],
50["Exile_Car_MB4WDOpen",4,[[0,0,0].[0,0,0]],false],
51["Exile_Car_MB4WD",4,[[0,0,0].[0,0,0]],false],
52["Exile_Car_Hatchback_Sport_Red",4,[[0,0,0].[0,0,0]],false],
53["Exile_Car_ProwlerLight",4,[[0,0,0].[0,0,0]],false],
54["Exile_Car_ProwlerUnarmed",4,[[0,0,0].[0,0,0]],false],
55["Exile_Car_QilinUnarmed",4,[[0,0,0].[0,0,0]],false],
56["Exile_Car_SUV_Black",4,[[0,0,0].[0,0,0]],false],
57["Exile_Car_SUV_Grey",4,[[0,0,0].[0,0,0]],false],
58["Exile_Car_SUV_Orange",4,[[0,0,0].[0,0,0]],false],
59["Exile_Car_Volha_Blue",4,[[0,0,0].[0,0,0]],false],
60["Exile_Car_Volha_White",4,[[0,0,0].[0,0,0]],false],
61["Exile_Car_Volha_Black",4,[[0,0,0].[0,0,0]],false],
62["Exile_Car_Ikarus_Blue",4,[[0,0,0].[0,0,0]],false],
63["Exile_Car_Zamak",4,[[0,0,0].[0,0,0]],false],
64["Exile_Car_Ural_Covered_Blue",4,[[0,0,0].[0,0,0]],false],
65["Exile_Car_Ural_Covered_Yellow",4,[[0,0,0].[0,0,0]],false],
66["Exile_Car_Ural_Covered_Worker",4,[[0,0,0].[0,0,0]],false],
67["Exile_Car_Ural_Covered_Military",4,[[0,0,0].[0,0,0]],false],
68["Exile_Car_LandRover_Red",4,[[0,0,0].[0,0,0]],false],
69["Exile_Car_LandRover_Urban",4,[[0,0,0].[0,0,0]],false],
70["Exile_Car_LandRover_Green",4,[[0,0,0].[0,0,0]],false],
71["Exile_Car_LandRover_Sand",4,[[0,0,0].[0,0,0]],false],
72["Exile_Car_LandRover_Desert",4,[[0,0,0].[0,0,0]],false],
73["B_APC_Tracked_02_AA_F",4,[[0,0,0].[0,0,0]],false],
74["B_APC_Tracked_02_CRV_F",4,[[0,0,0].[0,0,0]],false],
75["B_APC_Tracked_02_rcws_F",4,[[0,0,0].[0,0,0]],false],
76["B_MBT_02_TUSK_F",4,[[0,0,0].[0,0,0]],false],
77["B_MBT_02_arty_F",4,[[0,0,0].[0,0,0]],false],
78["B_MBT_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
79["B_MBT_02_mlrs_F",4,[[0,0,0].[0,0,0]],false],
80["I_APC_tracked_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
81["I_MBT_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
82["O_APC_Tracked_02_AA_F",4,[[0,0,0].[0,0,0]],false],
83["O_APC_Tracked_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
84["O_APC_Wheeled_02_rcws_F",4,[[0,0,0].[0,0,0]],false],
85["O_APC_Wheeled_02_rcws_v2_F",4,[[0,0,0].[0,0,0]],false],
86["B_APC_Wheeled_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
87["O_MBT_02_arty_F",4,[[0,0,0].[0,0,0]],false],
88["O_MBT_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
89["B_MRAP_02_F",4,[[0,0,0].[0,0,0]],false],
90["B_MRAP_02_hmg_F",4,[[0,0,0].[0,0,0]],false],
91["B_MRAP_02_gmg_F",4,[[0,0,0].[0,0,0]],false],
92["O_G_Offroad_02_F",4,[[0,0,0].[0,0,0]],false],
93["O_G_Offroad_02_armed_F",4,[[0,0,0].[0,0,0]],false],
94["O_Quadbike_02_F",4,[[0,0,0].[0,0,0]],false],
95["O_G_Quadbike_02_F",4,[[0,0,0].[0,0,0]],false],
96["B_Truck_02_covered_F",4,[[0,0,0].[0,0,0]],false],
97["B_Truck_02_transport_F",4,[[0,0,0].[0,0,0]],false],
98["O_G_Van_02_transport_F",4,[[0,0,0].[0,0,0]],false],
99["B_T_MRAP_02_hmg_F",4,[[0,0,0].[0,0,0]],false],
100["O_T_MRAP_02_hmg_ghex_F",4,[[0,0,0].[0,0,0]],false],
101["O_T_MRAP_02_gmg_ghex_F",4,[[0,0,0].[0,0,0]],false],
102["C_Quadbike_02_black_F",4,[[0,0,0].[0,0,0]],false],
103["O_Truck_02_transport_F",4,[[0,0,0].[0,0,0]],false],
104["O_Truck_02_covered_F",4,[[0,0,0].[0,0,0]],false],
105["O_Truck_02_device_F",4,[[0,0,0].[0,0,0]],false],
106["B_G_Offroad_02_armed_F",4,[[0,0,0].[0,0,0]],false],
107["B_G_Van_02_transport_F",4,[[0,0,0].[0,0,0]],false],
108["O_G_Offroad_02_repair_F",4,[[0,0,0].[0,0,0]],false],
109["B_T_Truck_02_box_F",4,[[0,0,0].[0,0,0]],false],
110["B_T_Truck_02_medical_F",4,[[0,0,0].[0,0,0]],false],
111["O_G_Van_02_fuel_F",4,[[0,0,0].[0,0,0]],false],
112["B_Truck_02_Repair_F",4,[[0,0,0].[0,0,0]],false],
113["B_T_Truck_02_fuel_F",4,[[0,0,0].[0,0,0]],false],
114["B_Truck_02_medical_F",4,[[0,0,0].[0,0,0]],false],
115["RHS_AH2Z",4,[[0,0,0].[0,0,0]],false],
116["RHS_AH64D",4,[[0,0,0].[0,0,0]],false],
117["RHS_CH_47F",4,[[0,0,0].[0,0,0]],false],
118["RHS_UH2Y",4,[[0,0,0].[0,0,0]],false],
119["RHS_UH60M",4,[[0,0,0].[0,0,0]],false],
120["RHS_UH60M_MEV",4,[[0,0,0].[0,0,0]],false],
121["RHS_CH_47F",4,[[0,0,0].[0,0,0]],false],
122["O_Heli_Light_02_dynamicLoadout_F",4,[[0,0,0].[0,0,0]],false],
123["O_Heli_Transport_04_covered_black_F",4,[[0,0,0].[0,0,0]],false],
124["B_Heli_Light_02_F",4,[[0,0,0].[0,0,0]],false],
125["B_Heli_Transport_02_F",4,[[0,0,0].[0,0,0]],false],
126["B_Heli_Transport_02_camo_F",4,[[0,0,0].[0,0,0]],false],
127["B_Heli_Transport_02_camo_F",4,[[0,0,0].[0,0,0]],false],
128["I_Heli_light_02_dynamicLoadout_F",4,[[0,0,0].[0,0,0]],false],
129["B_Heli_Transport_02_unarmed_green_F",4,[[0,0,0].[0,0,0]],false],
130["B_Heli_Transport_02_unarmed_F",4,[[0,0,0].[0,0,0]],false],
131["B_T_VTOL_02_armed_F",4,[[0,0,0].[0,0,0]],false],
132["O_T_VTOL_02_vehicle_ghex_F",4,[[0,0,0].[0,0,0]],false],
133["rhsusf_M2078A2P2_B_M2_WD_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
134["rhsusf_M2078A2P2_B_d_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
135["rhsusf_M2078A2P2_B_wd_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
136["rhsusf_M2078A2P2_d_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
137["rhsusf_M2082A2P2_B_M2_D_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
138["rhsusf_M2082A2P2_B_M2_wd_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
139["rhsusf_M2082A2P2_B_D_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
140["rhsusf_M2084A2P2_D_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
141["rhsusf_M2084A2P2_WD_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
142["rhsusf_m2025_w_mk29",4,[[0,0,0].[0,0,0]],false],
143["rhsusf_m998_w_2dr",4,[[0,0,0].[0,0,0]],false],
144["rhsusf_m998_w_4dr",4,[[0,0,0].[0,0,0]],false],
145["rhsusf_rg22_d",4,[[0,0,0].[0,0,0]],false],
146["rhsusf_rg22_m2_wd",4,[[0,0,0].[0,0,0]],false],
147["RHS_M2A2",4,[[0,0,0].[0,0,0]],false],
148["RHS_M2A2_BUSKI",4,[[0,0,0].[0,0,0]],false],
149["rhsusf_m209_usarmy",4,[[0,0,0].[0,0,0]],false],
150["rhsusf_m209d_usarmy",4,[[0,0,0].[0,0,0]],false],
151["rhsusf_m222_usarmy_M240",4,[[0,0,0].[0,0,0]],false],
152["rhsusf_m222_usarmy_MK29",4,[[0,0,0].[0,0,0]],false],
153["rhsusf_m222d_usarmy_medical",4,[[0,0,0].[0,0,0]],false],
154["rhsusf_m222_usarmy_supply",4,[[0,0,0].[0,0,0]],false],
155["rhsusf_m222_usarmy_unarmed",4,[[0,0,0].[0,0,0]],false],
156["rhsusf_m222d_usarmy",4,[[0,0,0].[0,0,0]],false],
157["rhsusf_m222d_usarmy_M240",4,[[0,0,0].[0,0,0]],false],
158["rhsusf_m222d_usarmy_MK29",4,[[0,0,0].[0,0,0]],false],
159["rhsusf_m222d_usarmy_medical",4,[[0,0,0].[0,0,0]],false],
160["rhsusf_m222d_usarmy_supply",4,[[0,0,0].[0,0,0]],false],
161["rhsusf_m222d_usarmy_unarmed",4,[[0,0,0].[0,0,0]],false],
162["rhsusf_m2a2aim_tuski_d",4,[[0,0,0].[0,0,0]],false],
163["rhsusf_m2a2aim_tuski_wd",4,[[0,0,0].[0,0,0]],false],
164["rhsusf_m2a2aimd_usarmy",4,[[0,0,0].[0,0,0]],false],
165["rhsusf_m2a2sep2tuskiwd_usarmy",4,[[0,0,0].[0,0,0]],false],
166["rhsusf_m2a2fep_d",4,[[0,0,0].[0,0,0]],false],
167["rhsusf_m2a2fep_od",4,[[0,0,0].[0,0,0]],false],
168["rhsusf_m2a2fep_wd",4,[[0,0,0].[0,0,0]],false],
169["rhsusf_m2a2sep2d_usarmy",4,[[0,0,0].[0,0,0]],false],
170["rhsusf_m2a2sep2tuskid_usarmy",4,[[0,0,0].[0,0,0]],false],
171["rhsusf_m2a2sep2tuskiid_usarmy",4,[[0,0,0].[0,0,0]],false],
172["rhsusf_m2a2sep2tuskiiwd_usarmy",4,[[0,0,0].[0,0,0]],false],
173["rhsusf_m2a2sep2tuskiwd_usarmy",4,[[0,0,0].[0,0,0]],false],
174["rhsusf_m2a2sep2wd_usarmy",4,[[0,0,0].[0,0,0]],false],
175["Exile_Chopper_Hellcat_Green",4,[[0,0,0].[0,0,0]],false],
176["Exile_Chopper_Hummingbird_Green",4,[[0,0,0].[0,0,0]],false],
177["Exile_Chopper_Mohawk_FIA",4,[[0,0,0].[0,0,0]],false],
178["Exile_Chopper_Orca_CSAT",4,[[0,0,0].[0,0,0]],false],
179["Exile_Bike_QuadBike_Black",4,[[0,0,0].[0,0,0]],false],
180["Exile_Bike_QuadBike_Csat",4,[[0,0,0].[0,0,0]],false],
181["Exile_Car_Van_Box_Black",4,[[0,0,0].[0,0,0]],false],
182["Exile_Car_Offroad_White",4,[[0,0,0].[0,0,0]],false],
183["Exile_Car_MB4WDOpen",4,[[0,0,0].[0,0,0]],false],
184["Exile_Car_MB4WD",4,[[0,0,0].[0,0,0]],false],
185[g "Exile_Car_Hatchback_Sport_Red",4,[[0,0,0].[0,0,0]],false],
186["Exile_Car_ProwlerLight",4,[[0,0,0].[0,0,0]],false],
187["Exile_Car_ProwlerUnarmed",4,[[0,0,0].[0,0,0]],false],
188["Exile_Car_QilinUnarmed",4,[[0,0,0].[0,0,0]],false],
189["Exile_Car_SUV_Black",4,[[0,0,0].[0,0,0]],false],
190["Exile_Car_SUV_Grey",4,[[0,0,0].[0,0,0]],false],
191["Exile_Car_SUV_Orange",4,[[0,0,0].[0,0,0]],false],
192["Exile_Car_Volha_Blue",4,[[0,0,0].[0,0,0]],false],
193["Exile_Car_Volha_White",4,[[0,0,0].[0,0,0]],false],
194["Exile_Car_Volha_Black",4,[[0,0,0].[0,0,0]],false],
195["Exile_Car_Ikarus_Blue",4,[[0,0,0].[0,0,0]],false],
196["Exile_Car_Zamak",4,[[0,0,0].[0,0,0]],false],
197["Exile_Car_Ural_Covered_Blue",4,[[0,0,0].[0,0,0]],false],
198["Exile_Car_Ural_Covered_Yellow",4,[[0,0,0].[0,0,0]],false],
199["Exile_Car_Ural_Covered_Worker",4,[[0,0,0].[0,0,0]],false],
200["Exile_Car_Ural_Covered_Military",4,[[0,0,0].[0,0,0]],false],
201["Exile_Car_LandRover_Red",4,[[0,0,0].[0,0,0]],false],
202["Exile_Car_LandRover_Urban",4,[[0,0,0].[0,0,0]],false],
203["Exile_Car_LandRover_Green",4,[[0,0,0].[0,0,0]],false],
204["Exile_Car_LandRover_Sand",4,[[0,0,0].[0,0,0]],false],
205["Exile_Car_LandRover_Desert",4,[[0,0,0].[0,0,0]],false],
206["B_APC_Tracked_02_AA_F",4,[[0,0,0].[0,0,0]],false],
207["B_APC_Tracked_02_CRV_F",4,[[0,0,0].[0,0,0]],false],
208["B_APC_Tracked_02_rcws_F",4,[[0,0,0].[0,0,0]],false],
209["B_MBT_02_TUSK_F",4,[[0,0,0].[0,0,0]],false],
210["B_MBT_02_arty_F",4,[[0,0,0].[0,0,0]],false],
211["B_MBT_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
212["B_MBT_02_mlrs_F",4,[[0,0,0].[0,0,0]],false],
213["I_APC_tracked_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
214["I_MBT_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
215["O_APC_Tracked_02_AA_F",4,[[0,0,0].[0,0,0]],false],
216["O_APC_Tracked_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
217["O_APC_Wheeled_02_rcws_F",4,[[0,0,0].[0,0,0]],false],
218["O_APC_Wheeled_02_rcws_v2_F",4,[[0,0,0].[0,0,0]],false],
219["B_APC_Wheeled_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
220["O_MBT_02_arty_F",4,[[0,0,0].[0,0,0]],false],
221["O_MBT_02_cannon_F",4,[[0,0,0].[0,0,0]],false],
222["B_MRAP_02_F",4,[[0,0,0].[0,0,0]],false],
223["B_MRAP_02_hmg_F",4,[[0,0,0].[0,0,0]],false],
224["B_MRAP_02_gmg_F",4,[[0,0,0].[0,0,0]],false],
225["O_G_Offroad_02_F",4,[[0,0,0].[0,0,0]],false],
226["O_G_Offroad_02_armed_F",4,[[0,0,0].[0,0,0]],false],
227["O_Quadbike_02_F",4,[[0,0,0].[0,0,0]],false],
228["O_G_Quadbike_02_F",4,[[0,0,0].[0,0,0]],false],
229["B_Truck_02_covered_F",4,[[0,0,0].[0,0,0]],false],
230["B_Truck_02_transport_F",4,[[0,0,0].[0,0,0]],false],
231["O_G_Van_02_transport_F",4,[[0,0,0].[0,0,0]],false],
232["B_T_MRAP_02_hmg_F",4,[[0,0,0].[0,0,0]],false],
233["O_T_MRAP_02_hmg_ghex_F",4,[[0,0,0].[0,0,0]],false],
234["O_T_MRAP_02_gmg_ghex_F",4,[[0,0,0].[0,0,0]],false],
235["C_Quadbike_02_black_F",4,[[0,0,0].[0,0,0]],false],
236["O_Truck_02_transport_F",4,[[0,0,0].[0,0,0]],false],
237["O_Truck_02_covered_F",4,[[0,0,0].[0,0,0]],false],
238["O_Truck_02_device_F",4,[[0,0,0].[0,0,0]],false],
239["B_G_Offroad_02_armed_F",4,[[0,0,0].[0,0,0]],false],
240["B_G_Van_02_transport_F",4,[[0,0,0].[0,0,0]],false],
241["O_G_Offroad_02_repair_F",4,[[0,0,0].[0,0,0]],false],
242["B_T_Truck_02_box_F",4,[[0,0,0].[0,0,0]],false],
243["B_T_Truck_02_medical_F",4,[[0,0,0].[0,0,0]],false],
244["O_G_Van_02_fuel_F",4,[[0,0,0].[0,0,0]],false],
245["B_Truck_02_Repair_F",4,[[0,0,0].[0,0,0]],false],
246["B_T_Truck_02_fuel_F",4,[[0,0,0].[0,0,0]],false],
247["B_Truck_02_medical_F",4,[[0,0,0].[0,0,0]],false],
248["RHS_AH2Z",4,[[0,0,0].[0,0,0]],false],
249["RHS_AH64D",4,[[0,0,0].[0,0,0]],false],
250["RHS_CH_47F",4,[[0,0,0].[0,0,0]],false],
251["RHS_UH2Y",4,[[0,0,0].[0,0,0]],false],
252["RHS_UH60M",4,[[0,0,0].[0,0,0]],false],
253["RHS_UH60M_MEV",4,[[0,0,0].[0,0,0]],false],
254["RHS_CH_47F",4,[[0,0,0].[0,0,0]],false],
255["O_Heli_Light_02_dynamicLoadout_F",4,[[0,0,0].[0,0,0]],false],
256["O_Heli_Transport_04_covered_black_F",4,[[0,0,0].[0,0,0]],false],
257["B_Heli_Light_02_F",4,[[0,0,0].[0,0,0]],false],
258["B_Heli_Transport_02_F",4,[[0,0,0].[0,0,0]],false],
259["B_Heli_Transport_02_camo_F",4,[[0,0,0].[0,0,0]],false],
260["B_Heli_Transport_02_camo_F",4,[[0,0,0].[0,0,0]],false],
261["I_Heli_light_02_dynamicLoadout_F",4,[[0,0,0].[0,0,0]],false],
262["B_Heli_Transport_02_unarmed_green_F",4,[[0,0,0].[0,0,0]],false],
263["B_Heli_Transport_02_unarmed_F",4,[[0,0,0].[0,0,0]],false],
264["B_T_VTOL_02_armed_F",4,[[0,0,0].[0,0,0]],false],
265["O_T_VTOL_02_vehicle_ghex_F",4,[[0,0,0].[0,0,0]],false],
266["rhsusf_M2078A2P2_B_M2_WD_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
267["rhsusf_M2078A2P2_B_d_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
268["rhsusf_M2078A2P2_B_wd_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
269["rhsusf_M2078A2P2_d_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
270["rhsusf_M2082A2P2_B_M2_D_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
271["rhsusf_M2082A2P2_B_M2_wd_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
272["rhsusf_M2082A2P2_B_D_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
273["rhsusf_M2084A2P2_D_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
274["rhsusf_M2084A2P2_WD_fmtv_usarmy",4,[[0,0,0].[0,0,0]],false],
275["rhsusf_m2025_w_mk29",4,[[0,0,0].[0,0,0]],false],
276["rhsusf_m998_w_2dr",4,[[0,0,0].[0,0,0]],false],
277["rhsusf_m998_w_4dr",4,[[0,0,0].[0,0,0]],false],
278["rhsusf_rg22_d",4,[[0,0,0].[0,0,0]],false],
279["rhsusf_rg22_m2_wd",4,[[0,0,0].[0,0,0]],false],
280["RHS_M2A2",4,[[0,0,0].[0,0,0]],false],
281["RHS_M2A2_BUSKI",4,[[0,0,0].[0,0,0]],false],
282["rhsusf_m209_usarmy",4,[[0,0,0].[0,0,0]],false],
283["rhsusf_m209d_usarmy",4,[[0,0,0].[0,0,0]],false],
284["rhsusf_m222_usarmy_M240",4,[[0,0,0].[0,0,0]],false],
285["rhsusf_m222_usarmy_MK29",4,[[0,0,0].[0,0,0]],false],
286["rhsusf_m222d_usarmy_medical",4,[[0,0,0].[0,0,0]],false],
287["rhsusf_m222_usarmy_supply",4,[[0,0,0].[0,0,0]],false],
288["rhsusf_m222_usarmy_unarmed",4,[[0,0,0].[0,0,0]],false],
289["rhsusf_m222d_usarmy",4,[[0,0,0].[0,0,0]],false],
290["rhsusf_m222d_usarmy_M240",4,[[0,0,0].[0,0,0]],false],
291["rhsusf_m222d_usarmy_MK29",4,[[0,0,0].[0,0,0]],false],
292["rhsusf_m222d_usarmy_medical",4,[[0,0,0].[0,0,0]],false],
293["rhsusf_m222d_usarmy_supply",4,[[0,0,0].[0,0,0]],false],
294["rhsusf_m222d_usarmy_unarmed",4,[[0,0,0].[0,0,0]],false],
295["rhsusf_m2a2aim_tuski_d",4,[[0,0,0].[0,0,0]],false],
296["rhsusf_m2a2aim_tuski_wd",4,[[0,0,0].[0,0,0]],false],
297["rhsusf_m2a2aimd_usarmy",4,[[0,0,0].[0,0,0]],false],
298["rhsusf_m2a2sep2tuskiwd_usarmy",4,[[0,0,0].[0,0,0]],false],
299["rhsusf_m2a2fep_d",4,[[0,0,0].[0,0,0]],false],
300["rhsusf_m2a2fep_od",4,[[0,0,0].[0,0,0]],false],
301["rhsusf_m2a2fep_wd",4,[[0,0,0].[0,0,0]],false],
302["rhsusf_m2a2sep2d_usarmy",4,[[0,0,0].[0,0,0]],false],
303["rhsusf_m2a2sep2tuskid_usarmy",4,[[0,0,0].[0,0,0]],false],
304["rhsusf_m2a2sep2tuskiid_usarmy",4,[[0,0,0].[0,0,0]],false],
305["rhsusf_m2a2sep2tuskiiwd_usarmy",4,[[0,0,0].[0,0,0]],false],
306["rhsusf_m2a2sep2tuskiwd_usarmy",4,[[0,0,0].[0,0,0]],false],
307["rhsusf_m2a2sep2wd_usarmy",4,[[0,0,0].[0,0,0]],false],
308["Exile_Chopper_Hellcat_Green",4,[[0,0,0].[0,0,0]],false],
309["Exile_Chopper_Hummingbird_Green",4,[[0,0,0].[0,0,0]],false],
310["Exile_Chopper_Mohawk_FIA",4,[[0,0,0].[0,0,0]],false],
311["Exile_Chopper_Orca_CSAT",4,[[0,0,0].[0,0,0]],false],
312["CUP_C_Datsun",4,[[0,0,0].[0,0,0]],false],
313["CUP_C_Datsun_4seat",4,[[0,0,0].[0,0,0]],false],
314["CUP_C_Datsun_Plain",4,[[0,0,0].[0,0,0]],false],
315["CUP_C_Datsun_Covered",4,[[0,0,0].[0,0,0]],false],
316["CUP_C_Datsun_Tubeframe",4,[[0,0,0].[0,0,0]],false],
317["CUP_C_Ural_Civ_01",4,[[0,0,0].[0,0,0]],false],
318["CUP_C_Ural_Civ_02",4,[[0,0,0].[0,0,0]],false],
319["CUP_C_Ural_Civ_03",4,[[0,0,0].[0,0,0]],false],
320["CUP_C_Ural_Open_Civ_01",4,[[0,0,0].[0,0,0]],false],
321["CUP_C_Ural_Open_Civ_02",4,[[0,0,0].[0,0,0]],false],
322["CUP_C_Ural_Open_Civ_03",4,[[0,0,0].[0,0,0]],false],
323["CUP_O_Ural_TKA",4,[[0,0,0].[0,0,0]],false],
324["CUP_O_Ural_RU",4,[[0,0,0].[0,0,0]],false],
325["CUP_I_Ural_UN",4,[[0,0,0].[0,0,0]],false],
326["CUP_B_Ural_CDF",4,[[0,0,0].[0,0,0]],false],
327["CUP_O_Ural_CHDKZ",4,[[0,0,0].[0,0,0]],false],
328["CUP_O_Ural_SLA",4,[[0,0,0].[0,0,0]],false],
329["CUP_O_Ural_Open_TKA",4,[[0,0,0].[0,0,0]],false],
330["CUP_B_Ural_Open_CDF",4,[[0,0,0].[0,0,0]],false],
331["CUP_O_Ural_Open_RU",4,[[0,0,0].[0,0,0]],false],
332["CUP_O_Ural_Open_CHDKZ",4,[[0,0,0].[0,0,0]],false],
333["CUP_O_Ural_Open_SLA",4,[[0,0,0].[0,0,0]],false],
334["CUP_O_Ural_Empty_SLA",4,[[0,0,0].[0,0,0]],false],
335["CUP_B_Ural_Empty_CDF",4,[[0,0,0].[0,0,0]],false],
336["CUP_I_Ural_Empty_UN",4,[[0,0,0].[0,0,0]],false],
337["CUP_O_Ural_Empty_RU",4,[[0,0,0].[0,0,0]],false],
338["CUP_O_Ural_Empty_CHDKZ",4,[[0,0,0].[0,0,0]],false],
339["CUP_O_Ural_Empty_TKA",4,[[0,0,0].[0,0,0]],false],
340["CUP_O_Ural_Repair_SLA",4,[[0,0,0].[0,0,0]],false],
341["CUP_O_Ural_Repair_TKA",4,[[0,0,0].[0,0,0]],false],
342["CUP_O_Ural_Repair_CHDKZ",4,[[0,0,0].[0,0,0]],false],
343["CUP_O_Ural_Repair_RU",4,[[0,0,0].[0,0,0]],false],
344["CUP_I_Ural_Repair_UN",4,[[0,0,0].[0,0,0]],false],
345["CUP_B_Ural_Repair_CDF",4,[[0,0,0].[0,0,0]],false],
346["CUP_B_Ural_Refuel_CDF",4,[[0,0,0].[0,0,0]],false],
347["CUP_O_Ural_Refuel_RU",4,[[0,0,0].[0,0,0]],false],
348["CUP_O_Ural_Refuel_CHDKZ",4,[[0,0,0].[0,0,0]],false],
349["CUP_O_Ural_Refuel_TKA",4,[[0,0,0].[0,0,0]],false],
350["CUP_O_Ural_Refuel_SLA",4,[[0,0,0].[0,0,0]],false],
351["CUP_C_LR_Transport_CTK",4,[[0,0,0].[0,0,0]],false],
352["CUP_O_LR_Transport_TKA",4,[[0,0,0].[0,0,0]],false],
353["CUP_O_LR_Transport_TKM",4,[[0,0,0].[0,0,0]],false],
354["CUP_B_LR_Transport_CZ_W",4,[[0,0,0].[0,0,0]],false],
355["CUP_B_LR_Transport_CZ_D",4,[[0,0,0].[0,0,0]],false],
356["CUP_B_LR_Transport_GB_W",4,[[0,0,0].[0,0,0]],false],
357["CUP_B_LR_Transport_GB_D",4,[[0,0,0].[0,0,0]],false],
358["CUP_B_LR_Ambulance_CZ_W",4,[[0,0,0].[0,0,0]],false],
359["CUP_B_LR_Ambulance_CZ_D",4,[[0,0,0].[0,0,0]],false],
360["CUP_B_LR_Ambulance_GB_W",4,[[0,0,0].[0,0,0]],false],
361["CUP_B_LR_Ambulance_GB_D",4,[[0,0,0].[0,0,0]],false],
362["CUP_O_LR_Ambulance_TKA",4,[[0,0,0].[0,0,0]],false],
363["CUP_C_UAZ_Unarmed_TK_CIV",4,[[0,0,0].[0,0,0]],false],
364["CUP_O_UAZ_Unarmed_RU",4,[[0,0,0].[0,0,0]],false],
365["CUP_I_UAZ_Unarmed_UN",4,[[0,0,0].[0,0,0]],false],
366["CUP_O_UAZ_Unarmed_TKA",4,[[0,0,0].[0,0,0]],false],
367["CUP_O_UAZ_Unarmed_CHDKZ",4,[[0,0,0].[0,0,0]],false],
368["CUP_B_UAZ_Unarmed_ACR",4,[[0,0,0].[0,0,0]],false],
369["CUP_B_UAZ_Unarmed_CDF",4,[[0,0,0].[0,0,0]],false],
370["CUP_O_UAZ_Open_CHDKZ",4,[[0,0,0].[0,0,0]],false],
371["CUP_O_UAZ_Open_RU",4,[[0,0,0].[0,0,0]],false],
372["CUP_O_UAZ_Open_TKA",4,[[0,0,0].[0,0,0]],false],
373["CUP_I_UAZ_Open_UN",4,[[0,0,0].[0,0,0]],false],
374["CUP_B_UAZ_Open_ACR",4,[[0,0,0].[0,0,0]],false],
375["CUP_B_UAZ_Open_CDF",4,[[0,0,0].[0,0,0]],false],
376["CUP_C_UAZ_Open_TK_CIV",4,[[0,0,0].[0,0,0]],false],
377["CUP_B_HMMWV_Unarmed_USA",4,[[0,0,0].[0,0,0]],false],
378["CUP_B_HMMWV_Unarmed_USMC",4,[[0,0,0].[0,0,0]],false],
379["CUP_B_HMMWV_Ambulance_USMC",4,[[0,0,0].[0,0,0]],false],
380["CUP_B_HMMWV_Ambulance_USA",4,[[0,0,0].[0,0,0]],false],
381["CUP_B_HMMWV_Ambulance_ACR",4,[[0,0,0].[0,0,0]],false],
382["CUP_B_HMMWV_Transport_USA",4,[[0,0,0].[0,0,0]],false],
383["CUP_I_M113_Med_RACS",4,[[0,0,0].[0,0,0]],false],
384["CUP_I_M113_Med_UN",4,[[0,0,0].[0,0,0]],false],
385["CUP_B_MTVR_USA",4,[[0,0,0].[0,0,0]],false],
386["CUP_B_MTVR_Ammo_USA",4,[[0,0,0].[0,0,0]],false],
387["CUP_B_MTVR_Refuel_USA",4,[[0,0,0].[0,0,0]],false],
388["CUP_B_MTVR_Repair_USA",4,[[0,0,0].[0,0,0]],false],
389["CUP_B_MTVR_USMC",4,[[0,0,0].[0,0,0]],false],
390["CUP_B_MTVR_Ammo_USMC",4,[[0,0,0].[0,0,0]],false],
391["CUP_B_MTVR_Refuel_USMC",4,[[0,0,0].[0,0,0]],false],
392["CUP_B_MTVR_Repair_USMC",4,[[0,0,0].[0,0,0]],false],
393["CUP_O_LR_MG_TKM",4,[[0,0,0].[0,0,0]],false],
394["CUP_O_LR_MG_TKA",4,[[0,0,0].[0,0,0]],false],
395["CUP_I_Datsun_PK",4,[[0,0,0].[0,0,0]],false],
396["CUP_I_Datsun_PK_Random",4,[[0,0,0].[0,0,0]],false],
397["CUP_I_Datsun_PK_TK",4,[[0,0,0].[0,0,0]],false],
398["CUP_I_Datsun_PK_TK_Random",4,[[0,0,0].[0,0,0]],false],
399["CUP_O_Datsun_PK",4,[[0,0,0].[0,0,0]],false],
400["CUP_O_Datsun_PK_Random",4,[[0,0,0].[0,0,0]],false],
401["CUP_O_UAZ_MG_CHDKZ",4,[[0,0,0].[0,0,0]],false],
402["CUP_O_UAZ_MG_RU",4,[[0,0,0].[0,0,0]],false],
403["CUP_O_UAZ_MG_TKA",4,[[0,0,0].[0,0,0]],false],
404["CUP_I_UAZ_MG_UN",4,[[0,0,0].[0,0,0]],false],
405["CUP_B_UAZ_MG_ACR",4,[[0,0,0].[0,0,0]],false],
406["CUP_B_UAZ_MG_CDF",4,[[0,0,0].[0,0,0]],false],
407["CUP_B_UAZ_AGS30_CDF",4,[[0,0,0].[0,0,0]],false],
408["CUP_O_UAZ_AGS30_CHDKZ",4,[[0,0,0].[0,0,0]],false],
409["CUP_O_UAZ_AGS30_RU",4,[[0,0,0].[0,0,0]],false],
410["CUP_O_UAZ_AGS30_TKA",4,[[0,0,0].[0,0,0]],false],
411["CUP_I_UAZ_AGS30_UN",4,[[0,0,0].[0,0,0]],false],
412["CUP_I_M113_RACS",4,[[0,0,0].[0,0,0]],false],
413["CUP_I_M113_UN",4,[[0,0,0].[0,0,0]],false],
414["CUP_B_BRDM2_HQ_CDF",4,[[0,0,0].[0,0,0]],false],
415["CUP_I_BRDM2_HQ_UN",4,[[0,0,0].[0,0,0]],false],
416["CUP_I_BRDM2_HQ_NAPA",4,[[0,0,0].[0,0,0]],false],
417["CUP_I_BRDM2_HQ_TK_Gue",4,[[0,0,0].[0,0,0]],false],
418["CUP_O_BRDM2_HQ_TKA",4,[[0,0,0].[0,0,0]],false],
419["CUP_O_BRDM2_HQ_CHDKZ",4,[[0,0,0].[0,0,0]],false],
420["CUP_O_BRDM2_CHDKZ",4,[[0,0,0].[0,0,0]],false],
421["CUP_O_BRDM2_SLA",4,[[0,0,0].[0,0,0]],false],
422["CUP_O_BRDM2_TKA",4,[[0,0,0].[0,0,0]],false],
423["CUP_I_BRDM2_NAPA",4,[[0,0,0].[0,0,0]],false],
424["CUP_I_BRDM2_TK_Gue",4,[[0,0,0].[0,0,0]],false],
425["CUP_I_BRDM2_UN",4,[[0,0,0].[0,0,0]],false],
426["CUP_B_BRDM2_CDF",4,[[0,0,0].[0,0,0]],false],
427["CUP_BAF_Jackal2_L2A1_W",4,[[0,0,0].[0,0,0]],false],
428["CUP_BAF_Jackal2_L2A1_D",4,[[0,0,0].[0,0,0]],false],
429["CUP_BAF_Jackal2_GMG_D",4,[[0,0,0].[0,0,0]],false],
430["CUP_BAF_Jackal2_GMG_W",4,[[0,0,0].[0,0,0]],false],
431["CUP_B_LR_Special_CZ_W",4,[[0,0,0].[0,0,0]],false],
432["CUP_B_LR_Special_Des_CZ_D",4,[[0,0,0].[0,0,0]],false],
433["CUP_B_LR_MG_CZ_W",4,[[0,0,0].[0,0,0]],false],
434["CUP_B_LR_MG_GB_W",4,[[0,0,0].[0,0,0]],false],
435["CUP_B_HMMWV_M1114_USMC",4,[[0,0,0].[0,0,0]],false],
436["CUP_B_HMMWV_M2_USMC",4,[[0,0,0].[0,0,0]],false],
437["CUP_B_HMMWV_Crows_M2_USA",4,[[0,0,0].[0,0,0]],false],
438["CUP_B_HMMWV_M2_GPK_USA",4,[[0,0,0].[0,0,0]],false],
439["CUP_B_HMMWV_M2_USA",4,[[0,0,0].[0,0,0]],false],
440["CUP_B_HMMWV_DSHKM_GPK_ACR",4,[[0,0,0].[0,0,0]],false],
441["CUP_B_HMMWV_AGS_GPK_ACR",4,[[0,0,0].[0,0,0]],false],
442["CUP_B_HMMWV_MK19_USMC",4,[[0,0,0].[0,0,0]],false],
443["CUP_B_HMMWV_MK19_USA",4,[[0,0,0].[0,0,0]],false],
444["CUP_B_HMMWV_Crows_MK19_USA",4,[[0,0,0].[0,0,0]],false],
445["CUP_B_HMMWV_SOV_USA",4,[[0,0,0].[0,0,0]],false],
446["CUP_B_Ridgback_HMG_GB_D",4,[[0,0,0].[0,0,0]],false],
447["CUP_B_Ridgback_HMG_GB_W",4,[[0,0,0].[0,0,0]],false],
448["CUP_B_Ridgback_GMG_GB_D",4,[[0,0,0].[0,0,0]],false],
449["CUP_B_Ridgback_GMG_GB_W",4,[[0,0,0].[0,0,0]],false],
450["CUP_B_Ridgback_LMG_GB_D",4,[[0,0,0].[0,0,0]],false],
451["CUP_B_Ridgback_LMG_GB_W",4,[[0,0,0].[0,0,0]],false],
452["CUP_B_Wolfhound_HMG_GB_D",4,[[0,0,0].[0,0,0]],false],
453["CUP_B_Wolfhound_HMG_GB_W",4,[[0,0,0].[0,0,0]],false],
454["CUP_B_Wolfhound_GMG_GB_D",4,[[0,0,0].[0,0,0]],false],
455["CUP_B_Wolfhound_GMG_GB_W",4,[[0,0,0].[0,0,0]],false],
456["CUP_B_Wolfhound_LMG_GB_D",4,[[0,0,0].[0,0,0]],false],
457["CUP_B_Wolfhound_LMG_GB_W",4,[[0,0,0].[0,0,0]],false],
458["CUP_B_RG31_M2_USMC",4,[[0,0,0].[0,0,0]],false],
459["CUP_B_RG31_M2_OD_USMC",4,[[0,0,0].[0,0,0]],false],
460["CUP_B_RG31_M2_GC_USMC",4,[[0,0,0].[0,0,0]],false],
461["CUP_B_RG31_Mk19_USMC",4,[[0,0,0].[0,0,0]],false],
462["CUP_B_RG31_Mk19_OD_USMC",4,[[0,0,0].[0,0,0]],false],
463["CUP_B_RG31E_M2_USMC",4,[[0,0,0].[0,0,0]],false],
464["CUP_O_GAZ_Vodnik_BPPU_RU",4,[[0,0,0].[0,0,0]],false],
465["CUP_O_GAZ_Vodnik_PK_RU",4,[[0,0,0].[0,0,0]],false],
466["CUP_B_CH53E_USMC",4,[[0,0,0].[0,0,0]],false],
467["CUP_B_UH1Y_UNA_F",4,[[0,0,0].[0,0,0]],false],
468["CUP_B_UH1Y_MEV_F",4,[[0,0,0].[0,0,0]],false],
469["CUP_C_Mi17_Civilian_RU",4,[[0,0,0].[0,0,0]],false],
470["CUP_B_Mi17_CDF",4,[[0,0,0].[0,0,0]],false],
471["CUP_O_Mi17_TK",4,[[0,0,0].[0,0,0]],false],
472["CUP_B_Mi17_medevac_CDF",4,[[0,0,0].[0,0,0]],false],
473["CUP_B_Mi171Sh_Unarmed_ACR",4,[[0,0,0].[0,0,0]],false],
474["CUP_O_Mi8_medevac_CHDKZ",4,[[0,0,0].[0,0,0]],false],
475["CUP_O_Mi8_medevac_RU",4,[[0,0,0].[0,0,0]],false],
476["CUP_Merlin_HC3_FFV",4,[[0,0,0].[0,0,0]],false],
477["CUP_Merlin_HC3",4,[[0,0,0].[0,0,0]],false],
478["CUP_Merlin_HC3_MED",4,[[0,0,0].[0,0,0]],false],
479["CUP_B_MH60S_USMC",4,[[0,0,0].[0,0,0]],false],
480["CUP_B_MH60S_FFV_USMC",4,[[0,0,0].[0,0,0]],false],
481["CUP_B_AW159_Unarmed_BAF",4,[[0,0,0].[0,0,0]],false],
482["CUP_B_CH47F_USA",4,[[0,0,0].[0,0,0]],false],
483["CUP_B_CH47F_GB",4,[[0,0,0].[0,0,0]],false],
484["CUP_B_UH60M_US",4,[[0,0,0].[0,0,0]],false],
485["CUP_B_UH60L_US",4,[[0,0,0].[0,0,0]],false],
486["CUP_B_UH60M_FFV_US",4,[[0,0,0].[0,0,0]],false],
487["CUP_B_UH60L_FFV_US",4,[[0,0,0].[0,0,0]],false],
488["CUP_B_UH60M_Unarmed_US",4,[[0,0,0].[0,0,0]],false],
489["CUP_B_UH60L_Unarmed_US",4,[[0,0,0].[0,0,0]],false],
490["CUP_B_UH60M_Unarmed_FFV_US",4,[[0,0,0].[0,0,0]],false],
491["CUP_B_UH60L_Unarmed_FFV_US",4,[[0,0,0].[0,0,0]],false],
492["CUP_B_UH60M_Unarmed_FFV_MEV_US",4,[[0,0,0].[0,0,0]],false],
493["CUP_B_UH60L_Unarmed_FFV_MEV_US",4,[[0,0,0].[0,0,0]],false],
494["CUP_I_UH60L_RACS",4,[[0,0,0].[0,0,0]],false],
495["CUP_I_UH60L_FFV_RACS",4,[[0,0,0].[0,0,0]],false],
496["CUP_I_UH60L_Unarmed_RACS",4,[[0,0,0].[0,0,0]],false],
497["CUP_I_UH60L_Unarmed_FFV_Racs",4,[[0,0,0].[0,0,0]],false],
498["CUP_I_UH60L_Unarmed_FFV_MEV_Racs",4,[[0,0,0].[0,0,0]],false],
499["CUP_B_AH1Z_NoWeapons",4,[[0,0,0].[0,0,0]],false],
500["CUP_C_DC3_CIV",4,[[0,0,0].[0,0,0]],false],
501["CUP_C_C47_CIV",4,[[0,0,0].[0,0,0]],false],
502["CUP_B_MV22_USMC",4,[[0,0,0].[0,0,0]],false],
503["CUP_B_AV8B_Empty",4,[[0,0,0].[0,0,0]],false]
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 = 30000; // 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 uiSleep 0.1;
567 _foundSafePos
568 };
569 };
570 if !(_cancelSpawn) then
571 {
572 if !(_debugForSP) then
573 {
574 _pinCode = format ["%1%2%3%4",round (random 8 +1),round (random 8 +1),round (random 8 +1),round (random 8 +1)];
575 _vehicleObject = [_vehicleClass, _position, (random 360), true,_pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
576 _vehicleObject setDamage 0.6;
577 _vehicleObject setFuel round (random 15 +10);
578
579 if !((_x select 0) isKindOf "AIR") then
580 {
581 _wheels = ["HitLF2Wheel","HitLFWheel","HitRFWheel","HitRF2Wheel"];
582 {
583 if (random 1 > 0.5) then
584 {
585 _vehicleObject setHitPointDamage [_x,1];
586 };
587 } forEach _wheels;
588 };
589 _vehicleObject setVariable ["ExileOwnerUID", _uid];
590 _vehicleObject setVariable ["ExileIsLocked",0];
591 _vehicleObject lock 0;
592 _vehicleObject call ExileServer_object_vehicle_database_insert;
593 _vehicleObject call ExileServer_object_vehicle_database_update;
594
595 diag_log format ["[Event: Persistent Spawns] -- Spawned a %1 at location: %2 -- Max allowed: %3",_x select 0,_position, _x select 1];
596 //[format["[Event: Persistent Spawns] -- Spawned a %1 at location: %2 -- Max allowed: %3",_x select 0,_position, _x select 1]] call MAR_fnc_log;
597 }
598 else
599 {
600 _vehicleObject = createVehicle [_vehicleClass,_position,[], 0, "NONE"];
601
602 if !((_x select 0) isKindOf "AIR") then
603 {
604 _wheels = ["HitLF2Wheel","HitLFWheel","HitRFWheel","HitRF2Wheel"];
605 {
606 _vehicleObject setHitPointDamage [_x,1];
607 } forEach _wheels;
608 };
609
610 _marker = createMarker [format["HeliCrash%1", diag_tickTime], _position];
611 _marker setMarkerType "mil_dot";
612 _marker setMarkerText "Vehicle";
613 };
614 }
615 else
616 {
617 if !(_debugForSP) then
618 {
619 //[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;
620 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];
621 }
622 else
623 {
624 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];
625 };
626 };
627 };
628 };
629
630} forEach _vehicleArray;
631
632_scriptComplete = true;
633
634waitUntil
635{
636 diag_log format ["ExileServer - Finished spawning world vehicles"];
637 //["ExileServer - Finished spawning world vehicles"] call MAR_fnc_log;
638 _scriptComplete
639};