Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Scraseface on Tue 07/08/2007 17:04:46

Title: creating interactions between specific inventory items and specific hotspots?
Post by: Scraseface on Tue 07/08/2007 17:04:46
or objects? At the moment I've only managed to find out how to create the same interaction between ALL inventory objects and a specific hotspot or object.

So for example, hypathetically speaking if my character had a loaf of bread and a key, I could have it so that when they use the key on a door, the door opens, but if I were to use the bread on the door, exactly the same thing would happen, which would make no sense.

I've looked high and low for the solution to this in the manual, old threads on these forums, and in a bunch of tutorials on the internet, because it sounds like something that would be included in at least one of the above. But I haven't been able to find it in any of them. I feel like I probably just missed it, but I've been searching for a little while now.

Anyway, if anyone can help with this, thanks muchly in advance.
Title: Re: creating interactions between specific inventory items and specific hotspots
Post by: Khris on Tue 07/08/2007 17:10:57
  if (player.ActiveInventory!=iKey)  // used item isn't the key
    player.Say("I'm not sure how to use that on the door.");
  else {  // key was used
    player.Say("It fits!");
    // open door, etc.
  }
Title: Re: creating interactions between specific inventory items and specific hotspots
Post by: Ashen on Tue 07/08/2007 17:33:31
BFAQ: Using a specific Inventory Item to trigger an action (http://americangirlscouts.org/agswiki/GUI%2C_Inventory_%26_Menu#Using_a_specific_inventory_item_to_trigger_an_action).

Not that hard to find, surely? Although, Khris' code is maybe a bit clearer.