From a5addbda5be5d050d78ea69f23f95a14ba8e5474 Mon Sep 17 00:00:00 2001 From: "[VB]AWOL" Date: Tue, 14 Jan 2014 12:01:48 -0600 Subject: [PATCH] fixed #984 --- CHANGE LOG 1.0.4.txt | 1 + SQF/dayz_code/compile/spawn_loot.sqf | 28 ++++++++++++++---- SQF/dayz_code/compile/spawn_loot_small.sqf | 22 +++++++++++--- SQF/dayz_code/compile/wild_spawnZombies.sqf | 9 +++++- SQF/dayz_code/compile/zombie_generate.sqf | 8 ++++- SQF/dayz_code/init/loot_init.sqf | 26 ++++++++++++++-- SQF/dayz_code/init/variables.sqf | 3 ++ SQF/dayz_server/init/server_functions.sqf | 8 ++++- .../@DayZ_Epoch_Server/addons/dayz_server.pbo | Bin 1438009 -> 1446126 bytes 9 files changed, 89 insertions(+), 16 deletions(-) diff --git a/CHANGE LOG 1.0.4.txt b/CHANGE LOG 1.0.4.txt index c2112fa1b..f7126a3e4 100644 --- a/CHANGE LOG 1.0.4.txt +++ b/CHANGE LOG 1.0.4.txt @@ -1,5 +1,6 @@ [NEW] Modular building spawning now ahead on server start, vehicles spawning after it. @Skaronator @zabn +[ADDED] Provide option to have loot tables loaded from mission file. DZE_MissionLootTable = true will look for loot configs via missionConfigFile. @vbawol [ADDED] Added Craftable/Buildable Wood Crate Storage. Recipe 6 x PartWoodLumber = ItemWoodCrateKit. @Mochnant [ADDED] BAF_Merlin_DZE - transportMaxWeapons 15, transportMaxMagazines 150, transportmaxbackpacks 5. @Skaronator [ADDED] Added back BAF_AS50_scoped_DZ configs, still not on traders or loot tables. @vbawol diff --git a/SQF/dayz_code/compile/spawn_loot.sqf b/SQF/dayz_code/compile/spawn_loot.sqf index 94b168c0e..7a20b6126 100644 --- a/SQF/dayz_code/compile/spawn_loot.sqf +++ b/SQF/dayz_code/compile/spawn_loot.sqf @@ -12,8 +12,12 @@ switch (_iClass) do { //Item is food, add random quantity of cans along with an item (if exists) _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"]; - - _itemTypes = [] + ((getArray (configFile >> "cfgLoot" >> _iClass)) select 0); + _itemTypes = []; + if (DZE_MissionLootTable) then { + _itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iClass)) select 0); + } else { + _itemTypes = ((getArray (configFile >> "cfgLoot" >> _iClass)) select 0); + }; _index = dayz_CLBase find _iClass; _weights = dayz_CLChances select _index; _cntWeights = count _weights; @@ -37,8 +41,12 @@ switch (_iClass) do { //Item is sigle, add 1 item from cfgloot _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"]; - - _itemTypes = [] + ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0); + _itemTypes = []; + if (DZE_MissionLootTable) then { + _itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iItem)) select 0); + } else { + _itemTypes = ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0); + }; _index = dayz_CLBase find _iItem; _weights = dayz_CLChances select _index; _cntWeights = count _weights; @@ -51,7 +59,11 @@ switch (_iClass) do case "backpack": { //Item is single backpack - _itemTypes = [] + ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0); + if (DZE_MissionLootTable) then { + _itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iItem)) select 0); + } else { + _itemTypes = ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0); + }; _index = dayz_CLBase find _iItem; _weights = dayz_CLChances select _index; _cntWeights = count _weights; @@ -63,7 +75,11 @@ switch (_iClass) do }; case "cfglootweapon": { - _itemTypes = [] + ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0); + if (DZE_MissionLootTable) then { + _itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iItem)) select 0); + } else { + _itemTypes = ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0); + }; _index = dayz_CLBase find _iItem; _weights = dayz_CLChances select _index; _cntWeights = count _weights; diff --git a/SQF/dayz_code/compile/spawn_loot_small.sqf b/SQF/dayz_code/compile/spawn_loot_small.sqf index 048c51a5a..46c7d5c55 100644 --- a/SQF/dayz_code/compile/spawn_loot_small.sqf +++ b/SQF/dayz_code/compile/spawn_loot_small.sqf @@ -13,8 +13,12 @@ switch (_iClass) do { //Item is sigle, add 1 item from CfgLootSmall _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"]; - - _itemTypes = [] + ((getArray (configFile >> "CfgLootSmall" >> _iClass)) select 0); + _itemTypes = []; + if (DZE_MissionLootTable) then { + _itemTypes = ((getArray (missionConfigFile >> "CfgLootSmall" >> _iClass)) select 0); + } else { + _itemTypes = ((getArray (configFile >> "CfgLootSmall" >> _iClass)) select 0); + }; _index = dayzE_CLSBase find _iClass; _weights = dayzE_CLSChances select _index; @@ -30,7 +34,12 @@ switch (_iClass) do //Item is sigle, add 1 item from CfgLootSmall _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"]; - _itemTypes = [] + ((getArray (configFile >> "CfgLootSmall" >> _iItem)) select 0); + _itemTypes = []; + if (DZE_MissionLootTable) then { + _itemTypes = ((getArray (missionConfigFile >> "CfgLootSmall" >> _iItem)) select 0); + } else { + _itemTypes = ((getArray (configFile >> "CfgLootSmall" >> _iItem)) select 0); + }; _index = dayzE_CLSBase find _iItem; _weights = dayzE_CLSChances select _index; _cntWeights = count _weights; @@ -45,7 +54,12 @@ switch (_iClass) do //Item is sigle, add 1 item from cfgloot _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"]; - _itemTypes = [] + ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0); + _itemTypes = []; + if (DZE_MissionLootTable) then { + _itemTypes = ((getArray (missionConfigFile >> "CfgLootSmall" >> _iItem)) select 0); + } else { + _itemTypes = ((getArray (configFile >> "CfgLootSmall" >> _iItem)) select 0); + }; _index = dayz_CLBase find _iItem; _weights = dayz_CLChances select _index; _cntWeights = count _weights; diff --git a/SQF/dayz_code/compile/wild_spawnZombies.sqf b/SQF/dayz_code/compile/wild_spawnZombies.sqf index c6018df06..e902c4c5c 100644 --- a/SQF/dayz_code/compile/wild_spawnZombies.sqf +++ b/SQF/dayz_code/compile/wild_spawnZombies.sqf @@ -46,7 +46,14 @@ _rnd = random 1; if (_rnd > 0.3) then { _lootType = configFile >> "CfgVehicles" >> _type >> "zombieLoot"; if (isText _lootType) then { - _array = []+ getArray (configFile >> "cfgLoot" >> getText(_lootType)); + + _array = []; + if (DZE_MissionLootTable) then { + _array = getArray (missionConfigFile >> "cfgLoot" >> getText(_lootType)); + } else { + _array = getArray (configFile >> "cfgLoot" >> getText(_lootType)); + }; + if (count _array > 0) then { _loot = _array call BIS_fnc_selectRandomWeighted; if(!isNil "_array") then { diff --git a/SQF/dayz_code/compile/zombie_generate.sqf b/SQF/dayz_code/compile/zombie_generate.sqf index bb7367807..d0f01f0f4 100644 --- a/SQF/dayz_code/compile/zombie_generate.sqf +++ b/SQF/dayz_code/compile/zombie_generate.sqf @@ -95,7 +95,13 @@ _rnd = random 1; if (_rnd > 0.3) then { _lootType = configFile >> "CfgVehicles" >> _type >> "zombieLoot"; if (isText _lootType) then { - _array = []+ getArray (configFile >> "cfgLoot" >> getText(_lootType)); + + _array = []; + if (DZE_MissionLootTable) then { + _array = getArray (missionConfigFile >> "cfgLoot" >> getText(_lootType)); + } else { + _array = getArray (configFile >> "cfgLoot" >> getText(_lootType)); + }; if (count _array > 0) then { _loot = _array call BIS_fnc_selectRandomWeighted; if(!isNil "_array") then { diff --git a/SQF/dayz_code/init/loot_init.sqf b/SQF/dayz_code/init/loot_init.sqf index c1c3dc9b8..e5d5fbf01 100644 --- a/SQF/dayz_code/init/loot_init.sqf +++ b/SQF/dayz_code/init/loot_init.sqf @@ -5,7 +5,13 @@ dayz_CBLBase = []; dayzE_CBLSChances = []; dayzE_CBLSBase = []; -_config = configFile >> "CfgBuildingLoot"; +_config = []; +if (DZE_MissionLootTable) then { + _config = missionConfigFile >> "CfgBuildingLoot"; +} else { + _config = configFile >> "CfgBuildingLoot"; +}; + for "_i" from 0 to ((count _config) - 1) do { _classname = toLower(configName (_config select _i)); _itemChances = [] + getArray (_config >> _classname >> "ItemChance"); @@ -53,7 +59,14 @@ for "_i" from 0 to ((count _config) - 1) do { dayz_CLChances = []; dayz_CLBase = []; -_config = configFile >> "cfgLoot"; + +_config = []; +if (DZE_MissionLootTable) then { + _config = missionConfigFile >> "cfgLoot"; +} else { + _config = configFile >> "cfgLoot"; +}; + for "_i" from 0 to ((count (_config)) - 1) do { _itemChances = (getArray (_config select _i)) select 1; _weighted = []; @@ -71,7 +84,14 @@ for "_i" from 0 to ((count (_config)) - 1) do { dayzE_CLSChances = []; dayzE_CLSBase = []; -_config = configFile >> "cfgLootSmall"; + +_config = []; +if (DZE_MissionLootTable) then { + _config = missionConfigFile >> "cfgLootSmall"; +} else { + _config = configFile >> "cfgLootSmall"; +}; + for "_i" from 0 to ((count (_config)) - 1) do { _itemChances = (getArray (_config select _i)) select 1; _weighted = []; diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index 201282c4b..ea094815d 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -473,6 +473,9 @@ if(isNil "DZE_FriendlySaving") then { if(isNil "DZE_BuildOnRoads") then { DZE_BuildOnRoads = false; }; +if(isNil "DZE_MissionLootTable") then { + DZE_MissionLootTable = false; +}; DZE_REPLACE_WEAPONS = [["Crossbow","ItemMatchbox","ItemHatchet"],["Crossbow_DZ","ItemMatchbox_DZE","ItemHatchet_DZE"]]; diff --git a/SQF/dayz_server/init/server_functions.sqf b/SQF/dayz_server/init/server_functions.sqf index 2cfc5a2ad..ac4ef909d 100644 --- a/SQF/dayz_server/init/server_functions.sqf +++ b/SQF/dayz_server/init/server_functions.sqf @@ -327,7 +327,13 @@ spawn_vehicles = { for "_x" from 1 to _num do { _iClass = _allCfgLoots call BIS_fnc_selectRandom; - _itemTypes = [] + ((getArray (configFile >> "cfgLoot" >> _iClass)) select 0); + _itemTypes = []; + if (DZE_MissionLootTable) then { + _itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iClass)) select 0); + } else { + _itemTypes = ((getArray (configFile >> "cfgLoot" >> _iClass)) select 0); + }; + _index = dayz_CLBase find _iClass; _weights = dayz_CLChances select _index; _cntWeights = count _weights; diff --git a/Server Files/@DayZ_Epoch_Server/addons/dayz_server.pbo b/Server Files/@DayZ_Epoch_Server/addons/dayz_server.pbo index 833c0882b40445e1ac497a243d671a3e14c15f89..751a8367dd377839d056e6998afcf28d1a0ad611 100644 GIT binary patch delta 2946 zcmbtWO>7%Q6z1tX`;kK`M(_xbSmA94aBDQiOWqN)f1{QV>4{AuezLapHn1-puaCvGb$Q#(C?V zdEcA&zW3gY=ks3|{`~lr&$l7n*2l#I*7G<5q`=w$PT2^$CZ2i|=3zWq(G zry(&iI8E|th6#GF(O^%Yc%G|mBOF>uhX47*rlccBOp}x>qX0pQF;OzE=+tB{muXg& zHOgKuStW7lc&I5JpVXI)qORaYsi><~Oq`h?9Xl^&HA^~Y61|Wv7Qnz$<~35HW^8z9 zXlQ9E)Wj|9>%Vu}AChOv8@%EZShBKe0T-x7WeX?3lN$zTcsQ8b!ZiED%83u@&j-R4!Vop@*6ZS5!;R z;{J8h0jwDKYN$z&Nr7T^|?&E2CR&9P8xTyp#-`n)IXpZXfg7+Sc>e%n-}RE3^0lu}JDywqnsZH;@M zv0MAvDyYQ%zAvQmI`|84|J6lE6>|i3+h)%!@VsV9K427DBtvUL;2Cf|+h6xZU#kXh z;jXfitJ@p)w!E&}(Meai3hSm6_KBe%vDl`~P%9e6qgg6nG>R5hNa+npHWYdxM->(N z;ey+z<0&?=?vfpy_+WB~bv!>1SYtph^I|TF0G%*QnZBG?$h-x|kYyGr+u*#V*E@QK zsQN`!)8LTXOpht2c0rBfo{Ux{4wu((au>XS*12tXy=0jAtg6#3Sox}55c8o=#?4>F zWtK>6$qbI|tZGRb%@oAgP%K?0aGvpcZLY3|WhbBu-T_wFt=P5b$q{mb44=iLZ8$wqIxQ{_O5bGHpW?E_kz zSUY;YGP>K2j`^c@XQl%s`N+A~fsVNIr|X)X@lLego#%1h?nF^GJmrM)kWAnBCnOqlxks&PY8l@KZ3@bFT2s< zbw3Tx3q2^@ACE6g&fw?p+(mZPB$i>aTT+3Vm#HbSo1%A}b)+_QCQ=#m>#cbF#_1je zvKJ%(QU_8G5(H@gX#^2Knn0RCo&pJhw19+HPxrL`b!WBri_kq`_2zq#M}h;-WN44PW1p`jr%gbE!yPYE18aPIem;vo?3SNnab8z9@i8r{ipF|T99*C+4TgHM{g6T?K>~9Uc$KPz9tk4&D}fm^HgG9f zgjLl%>#KG6Vgm`!Y&5WKhk(+HvXDx|wjEZ-dB_3LarNkcrT+<@)l>rRIALQlG2pus z)+Q4H3ocm4Lp$v}RcmnQ0$J%RCp~7}6We)wa)U=%6~;{uG)DhsG0u!p862ZaSe0RU zT=~4PIQo{Ul-WBz$P`wJ`F(lIsKbgEtT?dKD?=|VDANf%@_|?u{6JKMBWj`{JQ2tg z(Gnfe69X}lX<}*$ezDgm_j@9lA!ag5EX{t;`XO6RI<4oQe)#^o8?Y8XUoTt1&iNmf CYLrU=