From f5dff8d0b7421e2b555cd0e77f67ce4aee2c37cc Mon Sep 17 00:00:00 2001 From: icomrade Date: Sun, 16 Mar 2014 17:21:46 -0400 Subject: [PATCH] Fix private arrays Fix issue with wild zeds not spawning loot (idk if they it didnt work before, but _loottypecfg was nil so it probably didnt) --- SQF/dayz_code/compile/fn_damageActions.sqf | 2 +- SQF/dayz_code/compile/spawn_loot.sqf | 2 +- SQF/dayz_code/compile/wild_spawnZombies.sqf | 54 ++++++++++----------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/SQF/dayz_code/compile/fn_damageActions.sqf b/SQF/dayz_code/compile/fn_damageActions.sqf index 4974dfc1d..452064774 100644 --- a/SQF/dayz_code/compile/fn_damageActions.sqf +++ b/SQF/dayz_code/compile/fn_damageActions.sqf @@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_damageActions.sqf"; - Function - [] call fnc_usec_damageActions; ************************************************************/ -private ["_action","_weaponName","_turret","_weapons","_assignedRole","_driver","_action1","_action2","_x","_vehicle","_unit","_vehType","_type","_typeVeh","_isDisallowRefuel","_vehClose","_hasVehicle","_unconscious","_lowBlood","_injured","_inPain","_legsBroke","_armsBroke","_charID","_friendlies","_playerMagazines","_hasBandage","_hasEpi","_hasMorphine","_hasBlood","_hasJerry","_hasBarrel","_hasJerryE","_hasBarrelE","_hasPainkillers","_unconscious_crew","_patients","_crew","_menClose","_hasPatient","_inVehicle","_isClose"]; +private ["_action","_weaponName","_turret","_weapons","_assignedRole","_driver","_action1","_action2","_vehicle","_unit","_vehType","_type","_typeVeh","_isDisallowRefuel","_vehClose","_hasVehicle","_unconscious","_lowBlood","_injured","_inPain","_legsBroke","_armsBroke","_charID","_friendlies","_playerMagazines","_hasBandage","_hasEpi","_hasMorphine","_hasBlood","_hasJerry","_hasBarrel","_hasJerryE","_hasBarrelE","_hasPainkillers","_unconscious_crew","_patients","_crew","_menClose","_hasPatient","_inVehicle","_isClose"]; disableSerialization; diff --git a/SQF/dayz_code/compile/spawn_loot.sqf b/SQF/dayz_code/compile/spawn_loot.sqf index 32c35c523..4c1b4d49c 100644 --- a/SQF/dayz_code/compile/spawn_loot.sqf +++ b/SQF/dayz_code/compile/spawn_loot.sqf @@ -1,4 +1,4 @@ -private ["_item","_itemTypes","_qty","_tQty","_uniq"]; +private ["_iPos","_tQty","_qty","_index","_weights","_cntWeights","_canType","_item","_itemTypes","_max","_magQty","_mags","_iItem","_iClass","_radius","_uniq","_iPosZ"]; _iItem = _this select 0; _iClass = _this select 1; diff --git a/SQF/dayz_code/compile/wild_spawnZombies.sqf b/SQF/dayz_code/compile/wild_spawnZombies.sqf index 97d2aaa35..42bf8e000 100644 --- a/SQF/dayz_code/compile/wild_spawnZombies.sqf +++ b/SQF/dayz_code/compile/wild_spawnZombies.sqf @@ -1,4 +1,4 @@ -private ["_position","_doLoiter","_unitTypes","_loot","_array","_agent","_type","_radius","_method","_myDest","_newDest","_lootType","_player","_isAlive","_rnd","_id"]; +private ["_unitTypes","_lootType","_lootTypeCfg","_loot_count","_index","_weights","_loot","_array","_player","_doLoiter","_agent","_type","_radius","_method","_position","_isAlive","_myDest","_newDest","_rnd","_id"]; _player = _this select 0; _unitTypes = []; @@ -51,36 +51,34 @@ _agent setVariable ["newDest",_newDest]; _rnd = random 1; if (_rnd > 0.3) then { if (DZE_MissionLootTable) then { - _lootType = missionConfigFile >> "CfgVehicles" >> _type >> "zombieLoot"; + _lootType = getText (missionConfigFile >> "CfgVehicles" >> _type >> "zombieLoot"); } else { - _lootType = configFile >> "CfgVehicles" >> _type >> "zombieLoot"; + _lootType = getText (configFile >> "CfgVehicles" >> _type >> "zombieLoot"); }; - if (isText _lootType) then { - if (DZE_MissionLootTable) then { - _lootTypeCfg = getArray (missionConfigFile >> "cfgLoot" >> getText(_lootType)); - } else { - _lootTypeCfg = getArray (configFile >> "cfgLoot" >> getText(_lootType)); - }; - _array = []; - { - _array set [count _array, _x select 0] - } foreach _lootTypeCfg; - if (count _array > 0) then { - _index = dayz_CLBase find getText(_lootType); - _weights = dayz_CLChances select _index; - _loot = _array select (_weights select (floor(random (count _weights)))); - if(!isNil "_array") then { - if (DZE_MissionLootTable) then { - _loot_count = getNumber(missionConfigFile >> "CfgMagazines" >> _loot >> "count"); - } else { - _loot_count = getNumber(configFile >> "CfgMagazines" >> _loot >> "count"); - }; - if(_loot_count>1) then { - _agent addMagazine [_loot, ceil(random _loot_count)]; - } else { - _agent addMagazine _loot; - }; + if (DZE_MissionLootTable) then { + _lootTypeCfg = getArray (missionConfigFile >> "CfgLoot" >> _lootType); + } else { + _lootTypeCfg = getArray (configFile >> "CfgLoot" >> _lootType); + }; + _array = []; + { + _array set [count _array, _x select 0] + } foreach _lootTypeCfg; + if (count _array > 0) then { + _index = dayz_CLBase find _lootType; + _weights = dayz_CLChances select _index; + _loot = _array select (_weights select (floor(random (count _weights)))); + if(!isNil "_array") then { + if (DZE_MissionLootTable) then { + _loot_count = getNumber(missionConfigFile >> "CfgMagazines" >> _loot >> "count"); + } else { + _loot_count = getNumber(configFile >> "CfgMagazines" >> _loot >> "count"); + }; + if(_loot_count>1) then { + _agent addMagazine [_loot, ceil(random _loot_count)]; + } else { + _agent addMagazine _loot; }; }; };