Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_useItem.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Main function for item effects and functionality through the player menu.
  8. */
  9. private "_item";
  10. disableSerialization;
  11. if ((lbCurSel 2005) isEqualTo -1) exitWith {hint localize "STR_ISTR_SelectItemFirst";};
  12. _item = CONTROL_DATA(2005);
  13.  
  14. switch (true) do {
  15. case (_item in ["waterBottle","coffee","redgull"]): {
  16. if ([false,_item,1] call life_fnc_handleInv) then {
  17. life_thirst = 100;
  18. if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1) then {player setFatigue 0;};
  19. if (_item isEqualTo "redgull" && {LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1}) then {
  20. [] spawn {
  21. life_redgull_effect = time;
  22. titleText[localize "STR_ISTR_RedGullEffect","PLAIN"];
  23. player enableFatigue false;
  24. waitUntil {!alive player || ((time - life_redgull_effect) > (3 * 60))};
  25. player enableFatigue true;
  26. };
  27. };
  28. };
  29. };
  30.  
  31. case (_item isEqualTo "boltcutter"): {
  32. [cursorObject] spawn life_fnc_boltcutter;
  33. closeDialog 0;
  34. };
  35.  
  36. case (_item isEqualTo "blastingcharge"): {
  37. if ( (player distance ( getMarkerPos "national_bank")) < 300 ) then
  38. {
  39. player reveal fed_bank_1;
  40. (group player) reveal fed_bank_1;
  41. player reveal fed_bank_2;
  42. (group player) reveal fed_bank_2;
  43. player reveal fed_bank_3;
  44. (group player) reveal fed_bank_3;
  45. [cursorObject] spawn life_fnc_blastingCharge;
  46. closeDialog 0;
  47. };
  48.  
  49. if ( (player distance ( getMarkerPos "breach")) < 30 ) then
  50. {
  51. [] spawn TON_fnc_wallDestruction;
  52. };
  53.  
  54. if ((cursorTarget isKindOf "LandVehicle") OR (cursorTarget isKindOf "Ship") OR ((cursorTarget isKindOf "Air"))) then
  55. {
  56. [cursorTarget] spawn TON_fnc_blastingChargeUse;
  57. };
  58. };
  59.  
  60. case (_item isEqualTo "defusekit"): {
  61. [cursorObject] spawn life_fnc_defuseKit;
  62. closeDialog 0;
  63. };
  64.  
  65. case (_item isEqualTo "storagesmall"): {
  66. [false] call life_fnc_storageBox;
  67. };
  68.  
  69. case (_item isEqualTo "storagebig"): {
  70. [true] call life_fnc_storageBox;
  71. };
  72.  
  73. case (_item isEqualTo "spikeStrip"): {
  74. if (!isNull life_spikestrip) exitWith {hint localize "STR_ISTR_SpikesDeployment"; closeDialog 0};
  75. if ([false,_item,1] call life_fnc_handleInv) then {
  76. [] spawn life_fnc_spikeStrip;
  77. closeDialog 0;
  78. };
  79. };
  80.  
  81. case (_item isEqualTo "fuelFull"): {
  82. if !(isNull objectParent player) exitWith {hint localize "STR_ISTR_RefuelInVehicle"};
  83. [] spawn life_fnc_jerryRefuel;
  84. closeDialog 0;
  85. };
  86.  
  87. case (_item isEqualTo "fuelEmpty"): {
  88. [] spawn life_fnc_jerryCanRefuel;
  89. closeDialog 0;
  90. };
  91.  
  92. case (_item isEqualTo "flashlightshoulder"): {
  93. [] spawn life_fnc_useFlashlight;
  94. closeDialog 0;
  95. };
  96.  
  97. case (_item isEqualTo "lockpick"): {
  98. [] spawn life_fnc_lockpick;
  99. closeDialog 0;
  100. };
  101.  
  102. case (_item == "pickaxe" OR _item=="seau" OR _item=="axe"):
  103. {
  104. [_item] spawn life_fnc_farmingToolUse;
  105. };
  106.  
  107. case (_item isEqualTo "gpstracker"): {
  108. [cursorTarget] spawn life_fnc_gpsTracker;
  109. };
  110.  
  111. case (EQUAL(_item,"marijuana")): {
  112. if(([false,_item,1] call life_fnc_handleInv)) then
  113. {
  114. [] spawn life_fnc_weed;
  115. };
  116. };
  117.  
  118. case (EQUAL(_item,"heroin_processed")): {
  119. if(([false,_item,1] call life_fnc_handleInv)) then
  120. {
  121. [] spawn life_fnc_drug;
  122. };
  123. };
  124.  
  125. case (EQUAL(_item,"cocaine_processed")): {
  126. if(([false,_item,1] call life_fnc_handleInv)) then
  127. {
  128. [] spawn life_fnc_drug;
  129. };
  130. };
  131.  
  132. case (_item isEqualTo "bottledbeer"): {
  133. if(playerSide in [west,independent]) exitWith {hint localize "STR_MISC_WestIndNoNo";};
  134. if((player getVariable ["inDrink",FALSE])) exitWith {hint localize "STR_MISC_AlreadyDrinking";};
  135. if(([false,_item,1] call life_fnc_handleInv)) then
  136. {
  137. if(isNil "life_drink") then {life_drink = 0;};
  138. life_drink = life_drink + 0.15;
  139. if (life_drink < 0.2) exitWith {};
  140. [] spawn life_fnc_drinkbeer;
  141. };
  142. };
  143.  
  144. case (_item in ["apple","rabbit","salema","ornate","mackerel","tuna","mullet","catshark","turtle_soup","hen","rooster","sheep","goat","donuts","tbacon","peach"]): {
  145. if (!(M_CONFIG(getNumber,"VirtualItems",_item,"edible") isEqualTo -1)) then {
  146. if ([false,_item,1] call life_fnc_handleInv) then {
  147. _val = M_CONFIG(getNumber,"VirtualItems",_item,"edible");
  148. _sum = life_hunger + _val;
  149. switch (true) do {
  150. case (_val < 0 && _sum < 1): {life_hunger = 5;}; //This adds the ability to set the entry edible to a negative value and decrease the hunger without death
  151. case (_sum > 100): {life_hunger = 100;};
  152. default {life_hunger = _sum;};
  153. };
  154. };
  155. };
  156. };
  157.  
  158. default {
  159. hint localize "STR_ISTR_NotUsable";
  160. };
  161. };
  162.  
  163. [] call life_fnc_p_updateMenu;
  164. [] call life_fnc_hudUpdate;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement