Page 1 of 1

Here is how to determine if the player has an item (script)

PostPosted: Thu Nov 15, 2007 2:58 pm
by GM-Support
Hi,

To determine whether the player has an item in the inventory or not, copy/paste the following code in the VBScript Global Procedures (click "VBS Procedures" from anywhere in AM) (you don't need to make changes to the code):

Code: Select all
Function HasItem(ItemName)

  HasItem = False
  For Each X in InventoryItemObject
    If X.Tag = ItemName Then
      HasItem = True
    End If
  Next

End Function



Then, just call "HasItem(ITEM_NAME_GOES_HERE)" anywhere in your project. For example, you could write:

Code: Select all
MsgBox HasItem("Key")


GM-Support :)