Jump to content

MI6K

Member
  • Content Count

    2
  • Joined

  • Last visited

  • Medals

Everything posted by MI6K

  1. Evening all! I'm new to scripting & coding in general (Only started this Friday) and came across a problem with doing an inventory check for a specific item. The concept is simple, I have a door which needs to be unlocked with a key (For this purpose I am using the vanilla Item_Keys object), but this item is not returned in the items array, so my function is unable to detect the item and skips the if statement. Is there an alternative to the Items command? or a way of forcing the Keys into the array? I don't want to "virtualise" this item using addAction, I need the physical item to be present on the character. Thanks for your time 😉 bungalow = (getMarkerPos "BungalowMarker") nearestObject 'Land_i_House_Small_03_V1_F'; bungalow setVariable ['bis_disabled_Door_1', 1, true]; player addItem "Keys"; //Function to test inventory for the key searchInventoryFnc = { _item = items player; //stores an array of items from player's inventory in _items if("Keys" in _item) then { bungalow setVariable ['bis_disabled_Door_1', 0, true]; } else { bungalow setVariable ['bis_disabled_Door_1', 1, true]; hintC "You do not have the key for this door"; sleep 0.1; hintSilent ""; }; };
  2. Works like a charm! Thanks dude! searchInventoryFnc = { _item = uniformItems player + vestItems player + backpackItems player; //stores an array of items from player in _items if("Keys" in _item) then { bungalow setVariable ['bis_disabled_Door_1', 0, true]; hint "You can open this door"; sleep 2; hintSilent ""; } else { bungalow setVariable ['bis_disabled_Door_1', 1, true]; hintC "You do not have the key for this door"; sleep 0.1; hintSilent ""; }; };
×