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)
This commit is contained in:
icomrade
2014-03-16 17:21:46 -04:00
parent 3c28809247
commit f5dff8d0b7
3 changed files with 28 additions and 30 deletions

View File

@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_damageActions.sqf";
- Function - Function
- [] call fnc_usec_damageActions; - [] 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; disableSerialization;

View File

@@ -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; _iItem = _this select 0;
_iClass = _this select 1; _iClass = _this select 1;

View File

@@ -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; _player = _this select 0;
_unitTypes = []; _unitTypes = [];
@@ -51,36 +51,34 @@ _agent setVariable ["newDest",_newDest];
_rnd = random 1; _rnd = random 1;
if (_rnd > 0.3) then { if (_rnd > 0.3) then {
if (DZE_MissionLootTable) then { if (DZE_MissionLootTable) then {
_lootType = missionConfigFile >> "CfgVehicles" >> _type >> "zombieLoot"; _lootType = getText (missionConfigFile >> "CfgVehicles" >> _type >> "zombieLoot");
} else { } else {
_lootType = configFile >> "CfgVehicles" >> _type >> "zombieLoot"; _lootType = getText (configFile >> "CfgVehicles" >> _type >> "zombieLoot");
}; };
if (isText _lootType) then { if (DZE_MissionLootTable) then {
if (DZE_MissionLootTable) then { _lootTypeCfg = getArray (missionConfigFile >> "CfgLoot" >> _lootType);
_lootTypeCfg = getArray (missionConfigFile >> "cfgLoot" >> getText(_lootType)); } else {
} else { _lootTypeCfg = getArray (configFile >> "CfgLoot" >> _lootType);
_lootTypeCfg = getArray (configFile >> "cfgLoot" >> getText(_lootType)); };
}; _array = [];
_array = []; {
{ _array set [count _array, _x select 0]
_array set [count _array, _x select 0] } foreach _lootTypeCfg;
} foreach _lootTypeCfg; if (count _array > 0) then {
if (count _array > 0) then { _index = dayz_CLBase find _lootType;
_index = dayz_CLBase find getText(_lootType); _weights = dayz_CLChances select _index;
_weights = dayz_CLChances select _index; _loot = _array select (_weights select (floor(random (count _weights))));
_loot = _array select (_weights select (floor(random (count _weights)))); if(!isNil "_array") then {
if(!isNil "_array") then { if (DZE_MissionLootTable) then {
if (DZE_MissionLootTable) then { _loot_count = getNumber(missionConfigFile >> "CfgMagazines" >> _loot >> "count");
_loot_count = getNumber(missionConfigFile >> "CfgMagazines" >> _loot >> "count"); } else {
} else { _loot_count = getNumber(configFile >> "CfgMagazines" >> _loot >> "count");
_loot_count = getNumber(configFile >> "CfgMagazines" >> _loot >> "count"); };
}; if(_loot_count>1) then {
if(_loot_count>1) then { _agent addMagazine [_loot, ceil(random _loot_count)];
_agent addMagazine [_loot, ceil(random _loot_count)]; } else {
} else { _agent addMagazine _loot;
_agent addMagazine _loot;
};
}; };
}; };
}; };