From f38b436cbeb121beb88e82400d384411331ab1ab Mon Sep 17 00:00:00 2001 From: "[VB]AWOL" Date: Mon, 7 Oct 2013 13:34:07 -0500 Subject: [PATCH] added document to zombies and random open chance --- SQF/dayz_code/Configs/CfgMagazines.hpp | 14 ++++++++ SQF/dayz_code/Configs/cfgLoot.hpp | 42 ++++++++++++++-------- SQF/dayz_code/actions/player_craftItem.sqf | 13 ++++++- 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/SQF/dayz_code/Configs/CfgMagazines.hpp b/SQF/dayz_code/Configs/CfgMagazines.hpp index 46a2db2b8..24ae739e5 100644 --- a/SQF/dayz_code/Configs/CfgMagazines.hpp +++ b/SQF/dayz_code/Configs/CfgMagazines.hpp @@ -155,6 +155,20 @@ class CfgMagazines { picture = "\z\addons\dayz_epoch\pictures\equip_doc_generic_ca.paa"; descriptionShort = "Unknown document"; weight = 0.1; + class ItemActions + { + class Crafting + { + text = "Open Document"; + script = ";['Crafting','CfgMagazines', _id] spawn player_craftItem;"; + neednearby[] = {}; + requiretools[] = {}; + randomOutput = 1; + output[] = {{"ItemLetter",1},{"ItemDocumentRamp",1}}; + input[] = {{"ItemDocument",1}}; + }; + }; + }; class ItemLetter: CA_Magazine { diff --git a/SQF/dayz_code/Configs/cfgLoot.hpp b/SQF/dayz_code/Configs/cfgLoot.hpp index 0502091b7..b99af00f5 100644 --- a/SQF/dayz_code/Configs/cfgLoot.hpp +++ b/SQF/dayz_code/Configs/cfgLoot.hpp @@ -35,13 +35,14 @@ class CfgLoot { "ItemBandage", "ItemPainkiller", "FoodBioMeat", - "8Rnd_9x18_MakarovSD" + "8Rnd_9x18_MakarovSD", + "ItemDocument" }, { 0.07, 0.09, 0.09, - 0.1, + 0.09, 0.09, 0.05, 0.05, @@ -54,6 +55,7 @@ class CfgLoot { 0.06, 0.06, 0.01, + 0.01, 0.01 } }; @@ -76,11 +78,12 @@ class CfgLoot { "ItemPainkiller", "FoodBioMeat", "8Rnd_9x18_MakarovSD", - "ItemBriefcaseEmpty" + "ItemBriefcaseEmpty", + "ItemDocument" }, { 0.07, - 0.09, + 0.08, 0.09, 0.09, 0.09, @@ -96,6 +99,7 @@ class CfgLoot { 0.06, 0.01, 0.01, + 0.01, 0.01 } }; @@ -162,7 +166,8 @@ class CfgLoot { "HandChemBlue", "HandChemRed", "ItemHeatPack", - "ItemLockbox" + "ItemLockbox", + "ItemDocument" }, { 0.06, @@ -183,7 +188,7 @@ class CfgLoot { 0.04, 0.05, 0.05, - 0.09, + 0.08, 0.02, 0.04, 0.07, @@ -192,7 +197,8 @@ class CfgLoot { 0.03, 0.03, 0.03, - 0.04 + 0.04, + 0.01 } }; generic[] = { @@ -391,19 +397,21 @@ class CfgLoot { "ItemComboLock", "SmokeShell", "FoodMRE", - "ItemHotwireKit" + "ItemHotwireKit", + "ItemDocument" }, { 0.3, 0.08, 0.08, 0.14, - 0.17, + 0.16, 0.08, 0.01, 0.05, 0.04, 0.04, + 0.01, 0.01 } }; @@ -417,18 +425,20 @@ class CfgLoot { "WoodenArrow", "ItemHeatPack", "FoodMRE", - "FoodNutmix" + "FoodNutmix", + "ItemDocument" }, { 0.4, - 0.17, + 0.16, 0.03, 0.1, 0.05, 0.2, 0.02, 0.01, - 0.02 + 0.02, + 0.01 } }; @@ -448,13 +458,14 @@ class CfgLoot { "ItemWire", "ItemTankTrap", "ItemComboLock", - "ItemSledgeHead" + "ItemSledgeHead", + "ItemDocument" }, { 0.09, 0.10, 0.10, - 0.11, + 0.10, 0.10, 0.06, 0.06, @@ -465,7 +476,8 @@ class CfgLoot { 0.01, 0.03, 0.04, - 0.02 + 0.02, + 0.01 } }; diff --git a/SQF/dayz_code/actions/player_craftItem.sqf b/SQF/dayz_code/actions/player_craftItem.sqf index 2eb2bc999..68d95fecc 100644 --- a/SQF/dayz_code/actions/player_craftItem.sqf +++ b/SQF/dayz_code/actions/player_craftItem.sqf @@ -19,7 +19,7 @@ class ItemActions }; }; */ -private ["_tradeComplete","_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_textMissing","_selectedRecipeInput","_num_removed","_removed_total","_temp_removed_array","_abort","_reason","_isNear","_missingTools","_hastoolweapon","_selectedRecipeTools","_distance","_crafting","_needNear","_item","_baseClass","_num_removed_weapons","_outputWeapons","_inputWeapons"]; +private ["_tradeComplete","_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_textMissing","_selectedRecipeInput","_num_removed","_removed_total","_temp_removed_array","_abort","_reason","_isNear","_missingTools","_hastoolweapon","_selectedRecipeTools","_distance","_crafting","_needNear","_item","_baseClass","_num_removed_weapons","_outputWeapons","_inputWeapons","_randomOutput","_craft_doLoop","_selectedWeapon","_selectedMag"]; if(TradeInprogress) exitWith { cutText ["\n\nCrafting already in progress." , "PLAIN DOWN"]; }; TradeInprogress = true; @@ -69,6 +69,11 @@ if (_canDo) then { _selectedRecipeInput = getArray (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "input"); _outputWeapons = getArray (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "outputweapons"); _inputWeapons = getArray (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "inputweapons"); + + _randomOutput = 0; + if(isNumber (configFile >> _baseClass >> _item >> "randomOutput")) then { + _randomOutput = getNumber(configFile >> _baseClass >> _item >> "randomOutput"); + }; _craft_doLoop = true; _tradeComplete = 0; @@ -167,6 +172,12 @@ if (_canDo) then { _num_removed_weapons = _num_removed_weapons + ([player,_x] call BIS_fnc_invRemove); } forEach _inputWeapons; if (_num_removed_weapons == (count _inputWeapons)) then { + if(_randomOutput == 1) then { + _selectedWeapon = _outputWeapons call BIS_fnc_selectRandom; + _outputWeapons = [_selectedWeapon]; + _selectedMag = _selectedRecipeOutput call BIS_fnc_selectRandom; + _selectedRecipeOutput = [_selectedMag]; + }; { player addWeapon _x; } forEach _outputWeapons;