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

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

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

Postby GM-Support » Thu Nov 15, 2007 2:58 pm

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 :)
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron