Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: sloppy on Sat 21/01/2006 20:50:37

Title: Action occurs when have inventory items
Post by: sloppy on Sat 21/01/2006 20:50:37
How would I go about scripting it so that once I possess two particular inventory items, the game goes to a cut scene?  Unless these two things are in inventory, the cut scene doesn't happen.

Title: Re: Action occurs when have inventory items
Post by: petazzo on Sat 21/01/2006 20:59:49
You can use variables to know when you have the two inventory items.
If you don't know how to use variables see here (http://bfaq.xylot.com/#coding01)
Title: Re: Action occurs when have inventory items
Post by: sloppy on Sat 21/01/2006 21:13:37
Thanks, I know how to use variables.  But what I don't know is how to script the variable that the condition is met if I have 2 particular inventory items.  I hope I'm describing my question correctly. ???
Title: Re: Action occurs when have inventory items
Post by: monkey0506 on Sat 21/01/2006 21:26:30
Use Character.InventoryQuantity to check it.

// pseudo-code!!!
if ((player.InventoryQuantity[ITEMA] >= 1) && (player.InventoryQuantity[ITEMB] >= 1)) {
  Display("I WIN!!!");
  }


Replace ITEMA with the ID of the first item and ITEMB with the ID of the second.  And then you can make the game display the message :D.  Just put your script between the brackets ('{' and '}').
Title: Re: Action occurs when have inventory items
Post by: sloppy on Sat 21/01/2006 21:53:25
Perfect.  That's what I wanted.  Thank you!