View difference between Paste ID: qESCFup5 and zypcdBLf
SHOW: | | - or go back to the newest paste.
1
private["_obj","_type","_config","_positions","_iPos","_nearBy","_itemType","_itemTypes","_itemChances","_lootChance","_weights","_cntWeights","_index","_LootClass"];
2
3
_obj = 			_this select 0;
4
_type = 		typeOf _obj;
5
_config = 		configFile >> "CfgBuildingLoot" >> _type;
6
_positions =	[] + getArray (_config >> "lootPos");
7
//_itemTypes =	[] + getArray (_config >> "itemType"); // Default System
8
_lootChance =	getNumber (_config >> "lootChance");
9
10
//------------------//
11
//CUSTOM LOOT SPAWNS//
12
//------------------//
13
_itemTypes = []; //Initialise array
14
_itemChance = []; //Initialise array
15
16
diag_log "SPAWNING WITH CUSTOM LOOT";//Remove This line after testing
17
18
switch (_type) do { //Assign building classes
19
	case "Land_HouseV_1I4": { _LootClass = "Residential"; };
20
	case "Land_kulna": { _LootClass = "Residential"; };
21
	case "Land_Ind_Workshop01_04": { _LootClass = "Residential"; };
22
	case "Land_hut06": { _LootClass = "Residential"; };
23
	case "Land_Hlidac_budka": { _LootClass = "Residential"; };
24
	case "Land_HouseV2_02_Interier": { _LootClass = "Residential"; };
25
	case "Land_A_Pub_01": { _LootClass = "Residential"; };
26
	case "Land_Shed_wooden": { _LootClass = "Residential"; };
27
	case "Land_HouseBlock_A1_1": { _LootClass = "Residential"; };
28
	case "Land_A_MunicipalOffice": { _LootClass = "Residential"; };
29
	case "Land_ruin_01": { _LootClass = "Residential"; };
30
	case "Land_HouseV2_04_interier": { _LootClass = "Residential"; };
31
	case "Land_HouseV2_01A": { _LootClass = "Residential"; };
32
	case "Land_psi_bouda": { _LootClass = "Residential"; };
33
	case "Land_KBud": { _LootClass = "Residential"; };
34
	case "Land_A_Castle_Bergfrit": { _LootClass = "Residential"; };
35
	case "Land_A_Castle_Stairs_A": { _LootClass = "Residential"; };
36
	case "Land_A_Castle_Gate": { _LootClass = "Residential"; };
37
	case "Land_sara_domek_zluty": { _LootClass = "Residential"; };
38
	case "Land_Church_01": { _LootClass = "Residential"; };
39
	case "Land_Church_03": { _LootClass = "Residential"; };
40
	case "Land_HouseB_Tenement": { _LootClass = "Residential"; };
41
	case "Land_Panelak": { _LootClass = "Residential"; };
42
	case "Land_Panelak2": { _LootClass = "Residential"; };
43
	case "Land_rail_station_big": { _LootClass = "Residential"; };
44
	case "Land_A_Office01": { _LootClass = "Residential"; };
45
	case "Land_A_Office02": { _LootClass = "Residential"; };
46
	case "Land_Ind_Workshop01_01": { _LootClass = "Industrial"; };
47
	case "Land_Ind_Garage01": { _LootClass = "Industrial"; };
48
	case "Land_Ind_Workshop01_02": { _LootClass = "Industrial"; };
49
	case "Land_Ind_Workshop01_L": { _LootClass = "Industrial"; };
50
	case "Land_Hangar_2": { _LootClass = "Industrial"; };
51
	case "Land_A_FuelStation_Build": { _LootClass = "Industrial"; };
52
	case "Land_Shed_Ind02": { _LootClass = "Industrial"; };
53
	case "Land_Misc_PowerStation": { _LootClass = "Industrial"; };
54
	case "Land_Shed_W01": { _LootClass = "Industrial"; };
55
	case "Land_Tovarna2": { _LootClass = "Industrial"; };
56
	case "Land_Ind_Vysypka": { _LootClass = "Industrial"; };
57
	case "Land_A_BuildingWIP": { _LootClass = "Industrial"; };
58
	case "Land_A_TVTower_Base": { _LootClass = "Industrial"; };
59
	case "Land_Misc_Cargo1Ao": { _LootClass = "Industrial"; };
60
	case "Land_Misc_Cargo1Bo": { _LootClass = "Industrial"; };
61
	case "Land_Nav_Boathouse": { _LootClass = "Industrial"; };
62
	case "Land_wagon_box": { _LootClass = "Industrial"; };
63
	case "Land_Rail_House_01": { _LootClass = "Industrial"; };
64
	case "Land_A_GeneralStore_01a": { _LootClass = "Supermarket"; };
65
	case "Land_A_GeneralStore_01": { _LootClass = "Supermarket"; };
66
	case "Land_A_Hospital": { _LootClass = "Hospital"; };
67
	case "MASH": { _LootClass = "Hospital"; };
68
	case "MASH_EP1": { _LootClass = "Hospital"; };
69
	case "USMC_WarfareBFieldhHospital": { _LootClass = "Hospital"; };
70
	case "Land_a_stationhouse": { _LootClass = "Military"; };
71
	case "Land_Mil_ControlTower": { _LootClass = "Military"; };
72
	case "Land_SS_hangar": { _LootClass = "Military"; };
73
	case "Land_Mil_House": { _LootClass = "Military"; };
74
	case "Camp": { _LootClass = "Military"; };
75
	case "CampEast": { _LootClass = "Military"; };
76
	case "CampEast_EP1": { _LootClass = "Military"; };
77
	case "Land_Mil_Barracks_i": { _LootClass = "MilitarySpecial"; };
78
	case "Land_Misc_deerstand": { _LootClass = "Hunting"; };
79
	default { _LootClass = "Residential"; };
80
};
81
82
switch (_LootClass) do { //Find correct loot
83
	case "Residential": {
84
		_itemTypes = [
85
			["ItemSodaMdew","magazine"],
86
			["ItemWatch","generic"],
87
			["ItemCompass","generic"],
88
			["ItemMap","weapon"],
89
			["Makarov","weapon"],
90
			["Colt1911","weapon"],
91
			["ItemFlashlight","generic"],
92
			["ItemKnife","generic"],
93
			["ItemMatchbox","generic"],
94
			["","generic"],
95
			["LeeEnfield","weapon"],
96
			["revolver_EP1","weapon"],
97
			
98
			["DZ_Assault_Pack_EP1","object"], // 12
99
			["DZ_Czech_Vest_Puch","object"], // 12-0
100
			["DZ_ALICE_Pack_EP1","object"], // 16
101
			["DZ_TK_Assault_Pack_EP1","object"], // 16
102
			["DZ_British_ACU","object"], // 18
103
			
104
			["Winchester1866","weapon"],
105
			["WeaponHolder_ItemTent","object"],
106
			["","military"],
107
			["","trash"],
108
			["Crossbow_DZ","weapon"],
109
			["Binocular","weapon"],
110
			["PartWoodPile","magazine"],
111
			["Skin_Camo1_DZ","magazine"],
112
			["Skin_Sniper1_DZ","magazine"],
113
			["WeaponHolder_ItemCrowbar","object"],
114
			["MR43","weapon"] // Remember the last object doesn't not need a comma
115
		 ];
116
		_itemChance = [
117
			0.01,
118
			0.15,
119
			0.05,
120
			0.03,
121
			0.13,
122
			0.05,
123
			0.03,
124
			0.08,
125
			0.06,
126
			2,
127
			0.06,
128
			0.04,
129
			0.05, //12
130
			0.04, // 12-0
131
			0.02, //16
132
			0.02, //16
133
			0.01, //18
134
			0.01,
135
			0.01,
136
			0.03,
137
			0.5,
138
			0.01,
139
			0.06,
140
			0.06,
141
			0.01,
142
			0.01,
143
			0.08,
144
			0.03
145
		];
146
	};
147
	case "Industrial": {
148
		_itemTypes = [
149
			["","generic"],
150
			["","trash"],
151
			["","military"],
152
			["WeaponHolder_PartGeneric","object"],
153
			["WeaponHolder_PartWheel","object"],
154
			["WeaponHolder_PartFueltank","object"],
155
			["WeaponHolder_PartEngine","object"],
156
			["WeaponHolder_PartGlass","object"],
157
			["WeaponHolder_PartVRotor","object"],
158
			["WeaponHolder_ItemJerrycan","object"],
159
			["WeaponHolder_ItemHatchet","object"],
160
			["ItemKnife","military"],
161
			["ItemToolbox","weapon"],
162
			["ItemWire","magazine"],
163
			["ItemTankTrap","magazine"]
164
		];
165
		_itemChance = [
166
			0.18,
167
			0.29,
168
			0.04,
169
			0.04,
170
			0.05,
171
			0.02,
172
			0.02,
173
			0.04,
174
			0.01,
175
			0.04,
176
			0.11,
177
			0.07,
178
			0.06,
179
			0.01,
180
			0.04
181
		];
182
	};
183
	case "Farm": {
184
		_itemTypes = [
185
			["WeaponHolder_ItemJerrycan","object"],
186
			["","generic"],
187
			["huntingrifle","weapon"],
188
			["LeeEnfield","weapon"],
189
			["Winchester1866","weapon"],
190
			["","trash"],
191
			["Crossbow_DZ","weapon"],
192
			["PartWoodPile","magazine"],
193
			["WeaponHolder_ItemHatchet","object"],
194
			["MR43","weapon"],
195-
			["WeaponHolder_ItemMachete"]
195+
			["WeaponHolder_ItemMachete","object"]
196
		];
197
		_itemChance = [
198
			0.06,
199
			0.28,
200
			0.01,
201
			0.04,
202
			0.03,
203
			0.22,
204
			0.03,
205
			0.11,
206
			0.17,
207
			0.06,
208
			0.03
209
		];
210
	};
211
	case "Supermarket": {
212
		_itemTypes = [
213
			["ItemWatch","generic"],
214
			["ItemCompass","generic"],
215
			["ItemMap","weapon"],
216
			["Makarov","weapon"],
217
			["Colt1911","weapon"],
218
			["ItemFlashlight","generic"],
219
			["ItemKnife","generic"],
220
			["ItemMatchbox","generic"],
221
			["","generic"],
222
			["LeeEnfield","weapon"],
223
			["revolver_EP1","weapon"],
224
					
225
			["DZ_Assault_Pack_EP1","object"], // 12
226
			["DZ_Czech_Vest_Puch","object"], // 12-0
227
			["DZ_ALICE_Pack_EP1","object"], // 16
228
			["DZ_TK_Assault_Pack_EP1","object"], // 16
229
			["DZ_British_ACU","object"], // 18
230
			
231
			["Winchester1866","weapon"],
232
			["WeaponHolder_ItemTent","object"],
233
			["","food"],
234
			["","trash"],
235
			["Crossbow_DZ","weapon"],
236
			["Binocular","weapon"],
237
			["PartWoodPile","magazine"],
238
			["MR43","weapon"]
239
		];
240
		_itemChance = [
241
			0.15,
242
			0.01,
243
			0.05,
244
			0.02,
245
			0.02,
246
			0.05,
247
			0.02,
248
			0.05,
249
			0.05,
250
			0.01,
251
			0.01,
252
			0.05, //12
253
			0.04, // 12-0
254
			0.02, //16
255
			0.02, //16
256
			0.01, //18
257
			0.01,
258
			0.01,
259
			0.3,
260
			0.15,
261
			0.01,
262
			0.05,
263
			0.02,
264
			0.01
265
		];
266
	};
267
	case "HeliCrash": {
268
		_itemTypes = [		
269
			["FN_FAL","weapon"],
270
			["bizon_silenced","weapon"],
271
			["M14_EP1","weapon"],
272
			["FN_FAL_ANPVS4","weapon"],
273
			["M107_DZ","weapon"],
274
			["BAF_AS50_scoped","weapon"],
275
			["Mk_48_DZ","weapon"],
276
			["M249_DZ","weapon"],
277
			["BAF_L85A2_RIS_SUSAT","weapon"],
278
			["DMR","weapon"],
279
			["","military"],
280
			["","medical"],
281
			["MedBox0","object"],
282
			["NVGoggles","weapon"],
283
			["AmmoBoxSmall_556","object"],
284
			["AmmoBoxSmall_762","object"],
285
			["Skin_Camo1_DZ","magazine"],
286
			["Skin_Sniper1_DZ","magazine"],
287
			["G36C","weapon"],
288
			["G36C_camo","weapon"],
289
			//["G36_C_SD_camo","weapon"],
290
			["G36A_camo","weapon"],
291
			["G36K_camo","weapon"],
292
			["100Rnd_762x54_PK","magazine"]
293
		];
294
		_itemChance = [
295
			0.02,		//["FN_FAL","weapon"],
296
			0.05,		//["bizon_silenced","weapon"],
297
			0.05,		//["M14_EP1","weapon"],
298
			0.02,		//["FN_FAL_ANPVS4","weapon"],
299
			0.02,		//["m107","weapon"],
300
			0.01,		//["BAF_AS50_scoped","weapon"],
301
			0.03,		//["Mk_48_DZ","weapon"],
302
			0.05,		//["M249_DZ","weapon"],
303
			0.01,		//["BAF_L85A2_RIS_SUSAT","weapon"],
304
			0.06,		//["DMR","weapon"],
305
			1,			//["","military"],
306
			0.5,		//["","medical"],
307
			0.1,		//["MedBox0","object"],
308
			0.02,		//["NVGoggles","weapon"]
309
			0.1,	//AmmoBoxSmall_556
310
			0.1,	//AmmoBoxSmall_762
311
			0.08,	//Skin_Camo1_DZ
312
			0.05,	//Skin_Sniper1_DZ
313
			0.03,	//G36C"
314
			0.02,	//G36C_camo
315
			//0.01,	//G36_C_SD_camo
316
			0.02,	//G36A_camo
317
			0.02,	//G36K_camo
318
			0.01	//["100Rnd_762x54_PK","magazine"]
319
		];
320
	};
321
	case "HeliCrash_No50s": {
322
		_itemTypes = [		
323
			["FN_FAL","weapon"],
324
			["bizon_silenced","weapon"],
325
			["M14_EP1","weapon"],
326
			["FN_FAL_ANPVS4","weapon"],
327
			["Mk_48_DZ","weapon"],
328
			["M249_DZ","weapon"],
329
			["BAF_L85A2_RIS_SUSAT","weapon"],
330
			["DMR","weapon"],
331
			["","military"],
332
			["","medical"],
333
			["MedBox0","object"],
334
			["NVGoggles","weapon"],
335
			["AmmoBoxSmall_556","object"],
336
			["AmmoBoxSmall_762","object"],
337
			["Skin_Camo1_DZ","magazine"],
338
			["Skin_Sniper1_DZ","magazine"],
339
			["G36C","weapon"],
340
			["G36C_camo","weapon"],
341
			//["G36_C_SD_camo","weapon"],
342
			["G36A_camo","weapon"],
343
			["G36K_camo","weapon"],
344
			["100Rnd_762x54_PK","magazine"]
345
		];
346
		_itemChance = [
347
			0.02,		//["FN_FAL","weapon"],
348
			0.05,		//["bizon_silenced","weapon"],
349
			0.05,		//["M14_EP1","weapon"],
350
			0.02,		//["FN_FAL_ANPVS4","weapon"],
351
			0.03,		//["Mk_48_DZ","weapon"],
352
			0.05,		//["M249_DZ","weapon"],
353
			0.01,		//["BAF_L85A2_RIS_SUSAT","weapon"],
354
			0.06,		//["DMR","weapon"],
355
			1,			//["","military"],
356
			0.5,		//["","medical"],
357
			0.1,		//["MedBox0","object"],
358
			0.02,		//["NVGoggles","weapon"]
359
			0.1,	//AmmoBoxSmall_556
360
			0.1,	//AmmoBoxSmall_762
361
			0.08,	//Skin_Camo1_DZ
362
			0.05,	//Skin_Sniper1_DZ
363
			0.03,	//G36C"
364
			0.02,	//G36C_camo
365
			//0.01,	//G36_C_SD_camo
366
			0.02,	//G36A_camo
367
			0.02,	//G36K_camo
368
			0.01	//["100Rnd_762x54_PK","magazine"]
369
		];
370
	};
371
	case "Hospital": {
372
		_itemTypes =	[
373
			["","trash"],
374
			["","hospital"],
375
			["MedBox0","object"]
376
		];
377
		_itemChance = [
378
			0.2,
379
			1,
380
			0.2
381
		];
382
	};
383
	case "Military": {
384
		_itemTypes = [
385
			["M9","weapon"],
386
			["M16A2","weapon"],
387
			["M16A2GL","weapon"],
388
			["M9SD","weapon"],
389
			["AK_74","weapon"],
390
			["M4A1_Aim","weapon"],
391
			["AKS_74_kobra","weapon"],
392
			["AKS_74_U","weapon"],
393
			["AK_47_M","weapon"],
394
			["M24","weapon"],
395
			["M1014","weapon"],
396
			["DMR","weapon"],
397
			["M4A1","weapon"],
398
			["M14_EP1","weapon"],
399
			["UZI_EP1","weapon"],
400
			["Remington870_lamp","weapon"],
401
			["glock17_EP1","weapon"],
402
			["MP5A5","weapon"],
403
			["MP5SD","weapon"],
404
			["M4A3_CCO_EP1","weapon"],
405
			["Binocular","weapon"],
406
			["ItemFlashlightRed","military"],
407
			["ItemKnife","military"],
408
			["ItemGPS","weapon"],
409
			["ItemMap","military"],
410
			
411
			["DZ_ALICE_Pack_EP1","object"], // 16
412
			["DZ_TK_Assault_Pack_EP1","object"], // 16
413
			["DZ_British_ACU","object"], // 18
414
			["DZ_CivilBackpack_EP1","object"], // 24
415
			["DZ_Backpack_EP1","object"], // 24
416
			
417
			//Normal
418
			["","medical"],
419
			["","generic"],
420
			["","military"],
421
			//["Body","object"],
422
			["ItemEtool","weapon"],
423
			["ItemSandbag","magazine"],
424
			["Sa58P_EP1","weapon"],
425
			["Sa58V_EP1","weapon"],
426
			["BAF_L85A2_RIS_Holo","weapon"]
427
		];
428
		_itemChance = [
429
			0.05,
430
			0.05,
431
			0.01,
432
			0.02,
433
			0.15,
434
			0.01,
435
			0.08,
436
			0.05,
437
			0.05,
438
			0.01,
439
			0.10,
440
			0.01,
441
			0.02,
442
			0.01,
443
			0.05,
444
			0.08,
445
			0.10,
446
			0.04,
447
			0.02,
448
			0.01,
449
			0.06,
450
			0.10,
451
			0.10,
452
			0.01,
453
			0.05,
454
			//Bags
455
			0.08, //16
456
			0.08, //16
457
			0.06, //18
458
			0.01, //24
459
			0.01, //DZ_Backpack_EP1 24
460
			0.10, 
461
			1.00,
462
			2.50,
463
			//0.20,
464
			0.05,
465
			0.02,
466
			0.03,
467
			0.03,
468
			0.01
469
		];
470
	};
471
	case "MilitarySpecial": {
472
		_itemTypes = [
473
			["M16A2","weapon"],
474
			["M16A2GL","weapon"],
475
			["M249_DZ","weapon"],
476
			["M9SD","weapon"],
477
			//["M136","weapon"],
478
			["AK_74","weapon"],
479
			["M4A1_Aim","weapon"],
480
			["AKS_74_kobra","weapon"],
481
			["AKS_74_U","weapon"],
482
			["AK_47_M","weapon"],
483
			["M24","weapon"],
484
			["SVD_CAMO","weapon"],
485
			["M1014","weapon"],
486
			["M107_DZ","weapon"],
487
			["DMR","weapon"],
488
			["M4A1","weapon"],
489
			["M14_EP1","weapon"],
490
			["UZI_EP1","weapon"],
491
			["Remington870_lamp","weapon"],
492
			["glock17_EP1","weapon"],
493
			["M240_DZ","weapon"],
494
			["M4A1_AIM_SD_camo","weapon"],
495
			["M16A4_ACG","weapon"],
496
			["M4A1_HWS_GL_camo","weapon"],
497
			["Mk_48_DZ","weapon"],
498
			["M4A3_CCO_EP1","weapon"],
499
			//Ammo
500
			["AmmoBoxSmall_556","object"],
501
			["AmmoBoxSmall_762","object"],
502
503
			//["NVGoggles","weapon"],
504
			["Binocular","weapon"],
505
			["ItemFlashlightRed","military"],
506
			["ItemKnife","military"],
507
			["ItemGPS","weapon"],
508
			["ItemMap","military"],
509
			["Binocular_Vector","military"],
510
511
			["DZ_ALICE_Pack_EP1","object"], // 16
512
			["DZ_TK_Assault_Pack_EP1","object"], // 16
513
			["DZ_British_ACU","object"], // 18
514
			["DZ_CivilBackpack_EP1","object"], // 24
515
			["DZ_Backpack_EP1","object"], // 24		
516
517
			["","medical"],
518
			["","generic"],
519
			["","military"],
520
			//["Body","object"],
521
			["PipeBomb","magazine"],
522
			["Sa58V_RCO_EP1","weapon"],
523
			["Sa58V_CCO_EP1","weapon"],
524
			//["G36_C_SD_camo","weapon"],
525
			["M40A3","weapon"],
526
			["100Rnd_762x54_PK","magazine"]
527
		];
528
		_itemChance = [
529
			0.10,
530
			0.05,
531
			0.01,
532
			0.02,
533
			//0.01, //m136
534
			0.10,
535
			0.02,
536
			0.10,
537
			0.10,
538
			0.10,
539
			0.01,
540
			0.01,
541
			0.20,
542
			0.01,
543
			0.02,
544
			0.10,
545
			0.03,
546
			0.20,
547
			0.10,
548
			0.20,
549
			0.01,
550
			0.04,
551
			0.05,
552
			0.02,
553
			0.01,
554
			0.08,
555
			0.04,
556
			0.02,
557
			//0.01, //NVGoggles
558
			0.10,
559
			0.05,
560
			0.15,
561
			0.01, //ItemGPS
562
			0.03,
563
			0.01,
564
			//Bags
565
			0.08, //16
566
			0.08, //16
567
			0.06, //18
568
			0.01, //24
569
			0.01, //DZ_Backpack_EP1 24
570
			0.30,
571
			1.00,
572
			5.00, //military
573
			//0.20,
574
			0.01, //PipeBomb
575
			0.01, //Sa58V_RCO_EP1
576
			0.01, //Sa58V_CCO_EP1
577
			//0.01, //["G36_C_SD_camo","weapon"],
578
			0.02, // M40A3
579
			0.01	//["100Rnd_762x54_PK","magazine"]
580
		];
581
	};
582
	case "Hunting": {
583
		_itemTypes = [
584
			["ItemMap","weapon"],
585
			["ItemFlashlight","generic"],
586
			["ItemKnife","generic"],
587
			["ItemMatchbox","generic"],
588
			["Crossbow_DZ","weapon"],
589
			["","military"],
590
			["WeaponHolder_ItemMachete", "object"],
591
			["huntingrifle","weapon"],
592
			["","hunter"]
593
		];
594
		_itemChance = [
595
			0.08,
596
			0.05,
597
			0.04,
598
			0.06,
599
			0.03,
600
			2.00,
601
			0.03,
602
			0.04,
603
			3.00
604
		];
605
	};
606
};
607
//------------------//
608
//CUSTOM LOOT SPAWNS//
609
//------------------//
610
{
611
	if ((random 1) < _lootChance) then {
612
		_iPos = _obj modelToWorld _x;
613
		_nearBy = nearestObjects [_iPos, ["WeaponHolder","WeaponHolderBase"], 1];
614
		if (count _nearBy == 0) then {
615
			private["_index"];
616
			_weights = [_itemTypes,_itemChance] call fnc_buildWeightedArray;
617
			_index = _weights call BIS_fnc_selectRandom;
618
			_itemType = _itemTypes select _index;
619
			[_itemType select 0, _itemType select 1 , _iPos, 0.0]  call spawn_loot;
620
		};
621
	};
622
} forEach _positions;