Action occurs when have inventory items

Started by sloppy, Sat 21/01/2006 20:50:37

Previous topic - Next topic

sloppy

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.


petazzo

You can use variables to know when you have the two inventory items.
If you don't know how to use variables see here
I never forget a face, but in your case I'll be glad to make an exception.
(Groucho Marx)

sloppy

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. ???

monkey0506

Use Character.InventoryQuantity to check it.

Code: ags
// 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 '}').

sloppy

Perfect.  That's what I wanted.  Thank you!

SMF spam blocked by CleanTalk