Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sat 23/09/2006 17:52:56

Title: Basic inventory problems
Post by: on Sat 23/09/2006 17:52:56
Hello.. I'm having a few problems with some basic inventory functionality, and the manual isn't giving me many tips. I'm probably just looking in the wrong place but I'd appreciate a quick bit of guidance!

I'm using "Run script" & it's when the player uses an item from the inventory with a character... what is the code to check if it's inventory item number 3 being used?

Many thanks!
Title: Re: Basic inventory problems
Post by: Ashen on Sat 23/09/2006 18:20:21
player.ActiveInventory (http://www.adventuregamestudio.co.uk/manual/Character.ActiveInventory.htm)

As in:

if (player.ActiveInventory == inventory[3]) { // or whatever the Script-o-name of the item is ('iKey', 'iPoster', 'iBadger', etc)
  // Do stuff
}


You should be able to check the NUMBER of the item with player.ActiveInventory.ID (i.e. if player.ActiveInventory.ID == 3)), but the above way is better.

You could've got this from the 'Text script equivilant code' bit on the Interaction Editor ...
Title: Re: Basic inventory problems
Post by: on Sat 23/09/2006 18:59:30
Super, thanks Ashen!!