Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: td on Mon 05/12/2005 19:29:14

Title: certain object=certain action
Post by: td on Mon 05/12/2005 19:29:14
Dump question:
I have 2 object in inventory: the key (0) and the match (1)
How i should appoint only 0= open the door (for example) and only 1= other acton?

Ecpecially wanna answer Ashen and esper please :)

The "Station"(mystical story)  demo coming soon ... :)
Title: Re: certain object=certain action
Post by: Ashen on Mon 05/12/2005 20:50:30
Ask and you shall recieve ...

Open the interaction editor for you door, and select Use inventory on, then (using scripting):
if (player.ActiveInventory == iKey) { // where iKey is the script name of the Key object
  // Open Door scripting
}
else if (player.ActiveInventory == iMatch) {
  // Do Something Else scripting
}
// And so on, for any other items you want to include.


Using Interaction Editor commands, you want Conditonal - if inventory item was used.

If you need more detail, try a forum search - this question has been asked many times before. (It's also in the BFAQ (http://bfaq.xylot.com/#guis06), although that still shows old-style code.)

Title: Re: certain object=certain action
Post by: td on Mon 05/12/2005 21:02:08
Ok!
Much rescect ++ for Ashen :)