Help with Namalsk Heli Crash spawns. (server_heliCrash_dzn.sqf)

CorruptedHart11

New Member
private["_hcx","_helicrash","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray","_wpos","_lootpos"];
_hcx = _this select 0;
waitUntil{!isNil "BIS_fnc_selectRandom"};
if (isDedicated) then {
/*
"Land_mi8_crashed";4210.79;8913.34 _hcx == 1
"Land_mi8_crashed";5433.65;9282.45 _hcx == 2
"Land_mi8_crashed";5645.02;7973.14 _hcx == 3
"Land_mi8_crashed";5363.63;7161.82 _hcx == 4
"Land_mi8_crashed";2814.39;6391.89 _hcx == 5
"Land_mi8_crashed";4335.19;6424.07 _hcx == 6
"Land_mi8_crashed";4073.73;6457.54 _hcx == 7
"Land_mi8_crashed";5496.03;5985.08 _hcx == 8
"Land_mi8_crashed";5223.4;10832.94 _hcx == 9
"Land_mi8_crashed";5943.3;11190.03 _hcx == 10
"Land_mi8_crashed";6961.74;11606.8 _hcx == 11
"Land_mi8_crashed";7895.40;11322.9 _hcx == 12
"Land_mi8_crashed";8831.84;10417.8 _hcx == 13
"Land_mi8_crashed";8689.2;10244.31 _hcx == 14
"Land_mi8_crashed";3808.35;8769.47 _hcx == 15
"Land_mi8_crashed";4430.98;8508.50 _hcx == 16
"Land_mi8_crashed";4371.25;7602.81 _hcx == 17
"Land_mi8_crashed";3961.51;6217.20 _hcx == 18
"Land_mi8_crashed";7689.18;5809.11 _hcx == 19
"Land_wreck_c130j_ep1";3189.98;7507.8 _hcx == 20
"Land_wreck_c130j_ep1";7689.18;5809.1 _hcx == 21
*/
_helicrash = [0,0,0];
switch (_hcx) do {
case 1: {
_helicrash = ([4210.79,8913.34,0] nearestObject "Land_mi8_crashed");
};
case 2: {
_helicrash = ([5433.65,9282.45,0] nearestObject "Land_mi8_crashed");
};
case 3: {
_helicrash = ([5645.02,7973.14,0] nearestObject "Land_mi8_crashed");
};
case 4: {
_helicrash = ([5363.63,7161.82,0] nearestObject "Land_mi8_crashed");
};
case 5: {
_helicrash = ([2814.39,6391.89,0] nearestObject "Land_mi8_crashed");
};
case 6: {
_helicrash = ([4335.19,6424.07,0] nearestObject "Land_mi8_crashed");
};
case 7: {
_helicrash = ([4073.73,6457.54,0] nearestObject "Land_mi8_crashed");
};
case 8: {
_helicrash = ([5496.03,5985.08,0] nearestObject "Land_mi8_crashed");
};
case 9: {
_helicrash = ([5223.43,10832.9,0] nearestObject "Land_mi8_crashed");
};
case 10: {
_helicrash = ([5943.3,11190.03,0] nearestObject "Land_mi8_crashed");
};
case 11: {
_helicrash = ([6961.74,11606.7,0] nearestObject "Land_mi8_crashed");
};
case 12: {
_helicrash = ([7895.4,11322.97,0] nearestObject "Land_mi8_crashed");
};
case 13: {
_helicrash = ([8831.84,10417.8,0] nearestObject "Land_mi8_crashed");
};
case 14: {
_helicrash = ([8689.20,10244.3,0] nearestObject "Land_mi8_crashed");
};
case 15: {
_helicrash = ([3808.35,8769.47,0] nearestObject "Land_mi8_crashed");
};
case 16: {
_helicrash = ([4430.985,8508.5,0] nearestObject "Land_mi8_crashed");
};
case 17: {
_helicrash = ([4371.25,7602.81,0] nearestObject "Land_mi8_crashed");
};
case 18: {
_helicrash = ([3961.51,6217.20,0] nearestObject "Land_mi8_crashed");
};
case 19: {
_helicrash = ([7689.18,5809.11,0] nearestObject "Land_mi8_crashed");
};
case 20: {
_helicrash = ([3189.98,7507.8 ,0] nearestObject "Land_wreck_c130j_ep1");
};
case 21: {
_helicrash = ([7689.18,5809.1 ,0] nearestObject "Land_wreck_c130j_ep1");
};
default {
diag_log("ERROR: Cannot spawn helicrash loot (objNull)!");
};
};

diag_log("DEBUG: Spawning HeliCrashNamalsk permaLoot on helicrash #" + str(_hcx) + " " + str(getPos _helicrash) + "");

_config = configFile >> dayzNam_buildingLoot >> "HeliCrashNamalsk";
_itemType = [] + getArray (_config >> "itemType");
_itemChance = [] + getArray (_config >> "itemChance");

waituntil {!isnil "fnc_buildWeightedArray"};

_weights = [];
_weights = [_itemType,_itemChance] call fnc_buildWeightedArray;
_lootpos = [] + getArray (configFile >> dayzNam_buildingLoot >> (typeOf _helicrash) >> "lootPos");

if (_helicrash != objNull) then {
for "_x" from 1 to (count _lootpos) do {
//create lootpos
_wpos = _helicrash modelToWorld (_lootpos select (_x - 1));
//create loot
_index = _weights call BIS_fnc_selectRandom;
sleep 1;
if (count _itemType > _index) then {
//diag_log ("DW_DEBUG: " + str(count (_itemType)) + " select " + str(_index));
_iArray = _itemType select _index;
_iArray set [2,_wpos];
_iArray set [3,5];
_iArray call spawn_loot;
_nearby = _wpos nearObjects ["WeaponHolder",20];
{
_x setVariable ["permaLoot",true];
} forEach _nearBy;
};
};
};
};








^^^^^ Thats what I have modified so far but there are no wrecks in the added spots from the default? Can anyone give me a hand on what I missed. Or if I have to edit a different file as well?
 
I was able to get this working correctly you just have to have the items such as Mi8 land crash and c130j land crash in your instance_deployable for the same worldspace and the items will be called from this script to spawn in them.
 
Right, the script above just fills the wrecks with loot, the wrecks themself you have to add to the map on your own.
 
Back
Top