Finish updating loot system to 1.8 with custom epoch features

This commit is contained in:
[VB]AWOL
2014-05-09 14:23:09 -05:00
parent feec3e19f5
commit 9b52797f84
8 changed files with 585 additions and 367 deletions

View File

@@ -79,7 +79,7 @@ _bias = (_bias + random(100 - _bias)) / 100;
// small loot
_posSmall = [] + getArray (_config >> "lootPosSmall");
_itemTypesSmall = [] + getArray (_config >> "itemTypeSmall");
_itemTypesSmall = [] + getArray (_config >> "lootTypeSmall");
_positionsSmall = _posSmall call _ShuffleArray;
@@ -101,8 +101,11 @@ _positionsSmall = _posSmall call _ShuffleArray;
_cntWeights = count _weights;
_index = floor(random _cntWeights);
_index = _weights select _index;
diag_log format["building_spawnLoot.sqf: %1", _itemTypesSmall];
_itemType = _itemTypesSmall select _index;
[_itemType select 0, _itemType select 1 , _iPos, 0.0] call spawn_loot;
[_itemType select 0, _itemType select 1, _iPos, 0.0] call spawn_loot_small;
// diag_log (format["SpawnLoot: Pos: %1, LootType: %2/%3,",_iPos,_itemType select 0,_itemType select 1]);
dayz_currentWeaponHolders = dayz_currentWeaponHolders +1;
//loclout system

View File

@@ -5,6 +5,8 @@ _iPos = _this select 2;
_radius = _this select 3;
_uniq = [];
_item = objNull;
_iPosZ = _iPos select 2;
if((isNil "_iPosZ") OR {( _iPosZ < 0)}) then { _iPos = [_iPos select 0,_iPos select 1,0]; };
if (isNil "_iClass") exitWith {diag_log "_iClass isNil, exiting loot spawn!";};
@@ -13,9 +15,13 @@ switch (_iClass) do {
default {
_itemTypes = [];
if (DZE_MissionLootTable) then {
_itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iClass)) select 0);
{
_itemTypes set [count _itemTypes, _x select 0]
} foreach getArray (missionConfigFile >> "cfgLoot" >> _iClass);
} else {
_itemTypes = ((getArray (configFile >> "cfgLoot" >> _iClass)) select 0);
{
_itemTypes set [count _itemTypes, _x select 0]
} foreach getArray (configFile >> "cfgLoot" >> _iClass);
};
_qty = 0;
_max = ceil(random 2) + 1;
@@ -25,8 +31,14 @@ switch (_iClass) do {
_index = dayz_CLBase find _iClass;
_weights = dayz_CLChances select _index;
_cntWeights = count _weights;
// diag_log ("dayz_CLChances: "+str(dayz_CLChances));
_index = floor(random _cntWeights);
_index = _weights select _index;
//diag_log ("dayz_CLChances: "+str(_itemTypes));
_canType = _itemTypes select _index;
_tQty = round(random 1) + 1;
if (_canType in _uniq) then {
@@ -44,34 +56,39 @@ switch (_iClass) do {
if ((_iItem != "") && (isClass(configFile >> "CfgWeapons" >> _iItem))) then {
_item addWeaponCargoGlobal [_iItem,1];
};
} else {
}
else {
diag_log format["DEBUG dayz_CLBase: %1", dayz_CLBase];
_index = dayz_CLBase find _iClass;
_weights = dayz_CLChances select _index;
_cntWeights = count _weights;
_index = floor(random _cntWeights);
_index = _weights select _index;
_item2 = _itemTypes select _index;
if ((_item2 != "") && (isClass(configFile >> "CfgWeapons" >> _item2))) then {
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item addWeaponCargoGlobal [_item2,1];
if ((count _mags) > 0) then {
if (_mags select 0 == "20Rnd_556x45_Stanag") then { _mags set [0, "30Rnd_556x45_Stanag"] };
if (_mags select 0 == "30Rnd_556x45_G36") then { _mags set [0, "30Rnd_556x45_Stanag"] };
if (_mags select 0 == "30Rnd_556x45_G36SD") then { _mags set [0, "30Rnd_556x45_StanagSD"] };
if (!(_item2 in MeleeWeapons)) then {
_magQty = round(random 10);
if (_magQty > 3) then {
_item addMagazineCargoGlobal [(_mags select 0), (round(random 1) + 1)];
if (_index > 0) then {
_weights = dayz_CLChances select _index;
diag_log format["DEBUG dayz_CLChances: %1", dayz_CLChances];
_cntWeights = count _weights;
_index = floor(random _cntWeights);
_index = _weights select _index;
_item2 = _itemTypes select _index;
if ((_item2 != "") && (isClass(configFile >> "CfgWeapons" >> _item2))) then{
_item = createVehicle["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item addWeaponCargoGlobal[_item2, 1];
if ((count _mags) > 0) then{
if (_mags select 0 == "20Rnd_556x45_Stanag") then{ _mags set[0, "30Rnd_556x45_Stanag"] };
if (_mags select 0 == "30Rnd_556x45_G36") then{ _mags set[0, "30Rnd_556x45_Stanag"] };
if (_mags select 0 == "30Rnd_556x45_G36SD") then{ _mags set[0, "30Rnd_556x45_StanagSD"] };
if (!(_item2 in MeleeWeapons)) then{
_magQty = round(random 10);
if (_magQty > 3) then{
_item addMagazineCargoGlobal[(_mags select 0), (round(random 1) + 1)];
};
};
};
};
};
if ((_item2 != "") && (isClass(configFile >> "CfgMagazines" >> _item2))) then {
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item addMagazineCargoGlobal [_item2,1];
};
if ((_item2 != "") && (isClass(configFile >> "CfgVehicles" >> _item2))) then {
_item = createVehicle [_item2, _iPos, [], _radius, "CAN_COLLIDE"];
if ((_item2 != "") && (isClass(configFile >> "CfgMagazines" >> _item2))) then{
_item = createVehicle["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item addMagazineCargoGlobal[_item2, 1];
};
if ((_item2 != "") && (isClass(configFile >> "CfgVehicles" >> _item2))) then{
_item = createVehicle[_item2, _iPos, [], _radius, "CAN_COLLIDE"];
};
};
};
@@ -81,10 +98,15 @@ switch (_iClass) do {
//Item is sigle, add 1 item from cfgloot
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_itemTypes = [];
if (DZE_MissionLootTable) then {
_itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iItem)) select 0);
} else {
_itemTypes = ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0);
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(missionConfigFile >> "cfgLoot" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(configFile >> "cfgLoot" >> _iClass);
};
_index = dayz_CLBase find _iItem;
_weights = dayz_CLChances select _index;
@@ -114,10 +136,15 @@ switch (_iClass) do {
};
case "cfglootweapon":
{
if (DZE_MissionLootTable) then {
_itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iItem)) select 0);
} else {
_itemTypes = ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0);
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(missionConfigFile >> "cfgLoot" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(configFile >> "cfgLoot" >> _iClass);
};
_index = dayz_CLBase find _iItem;
_weights = dayz_CLChances select _index;
@@ -179,10 +206,15 @@ switch (_iClass) do {
};
case "object": {
_item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
if ((count _iPos) > 2) then {
_item setPosATL _iPos;
};
};
};
if ((count _iPos) > 2) then {
_item setPosATL _iPos;
if (!isNull(_item)) then{
if ((count _iPos) > 2) then{
_item setPosATL _iPos;
};
};
_item

View File

@@ -7,6 +7,8 @@ _iClass = _this select 1;
_iPos = _this select 2;
_radius = _this select 3;
_item = objNull;
switch (_iClass) do
{
default
@@ -14,10 +16,15 @@ switch (_iClass) do
//Item is sigle, add 1 item from CfgLootSmall
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_itemTypes = [];
if (DZE_MissionLootTable) then {
_itemTypes = ((getArray (missionConfigFile >> "CfgLootSmall" >> _iClass)) select 0);
} else {
_itemTypes = ((getArray (configFile >> "CfgLootSmall" >> _iClass)) select 0);
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(missionConfigFile >> "CfgLootSmall" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(configFile >> "CfgLootSmall" >> _iClass);
};
_index = dayzE_CLSBase find _iClass;
@@ -35,10 +42,15 @@ switch (_iClass) do
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_itemTypes = [];
if (DZE_MissionLootTable) then {
_itemTypes = ((getArray (missionConfigFile >> "CfgLootSmall" >> _iItem)) select 0);
} else {
_itemTypes = ((getArray (configFile >> "CfgLootSmall" >> _iItem)) select 0);
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(missionConfigFile >> "CfgLootSmall" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(configFile >> "CfgLootSmall" >> _iClass);
};
_index = dayzE_CLSBase find _iItem;
_weights = dayzE_CLSChances select _index;
@@ -55,15 +67,22 @@ switch (_iClass) do
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_itemTypes = [];
if (DZE_MissionLootTable) then {
_itemTypes = ((getArray (missionConfigFile >> "CfgLootSmall" >> _iItem)) select 0);
} else {
_itemTypes = ((getArray (configFile >> "CfgLootSmall" >> _iItem)) select 0);
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(missionConfigFile >> "CfgLootSmall" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(configFile >> "CfgLootSmall" >> _iClass);
};
_index = dayz_CLBase find _iItem;
_weights = dayz_CLChances select _index;
_index = dayzE_CLSBase find _iItem;
_weights = dayzE_CLSChances select _index;
_cntWeights = count _weights;
diag_log("_itemTypes small:" + str(_itemTypes));
_index = floor(random _cntWeights);
_index = _weights select _index;
_iItem = _itemTypes select _index;
@@ -97,8 +116,10 @@ switch (_iClass) do
//do nothing for now
};
};
if ((count _iPos) > 2) then {
_item setPosATL _iPos;
if (!isNull(_item)) then{
if ((count _iPos) > 2) then{
_item setPosATL _iPos;
};
};
_item