Inventory Sepcific Hotspots

Started by XyloCub, Sun 14/12/2008 23:08:16

Previous topic - Next topic

XyloCub

I'm having trouble specifying which objects trigger events on certain hot spots. Here's my simple example that I'm toying with:

Character has a key and a match in inventory. The key should be the only inventory item to unlock the cupboard, but right now, the match will also open the cupboard.

How do I set only the key to unlock the cupboard and retrieve the cup (retrieving the cup I've scripted already) and using the match on the cupboard will give a different outcome? Been all over the tutorials and could not find this.

~XyloCub

Trent R

Check the ActiveInventory
Code: ags

function hDoor_UseInv {
  if (player.ActiveInventory == iKey) {
    //Open door
  }
}



~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

PrimitiveUser

function hDoor_UseInv {
       if (player.ActiveInventory == iKey) {
       Display("You have unlocked the cupboard!");
       player.AddInventory(icup);
       }
else Display("You do not have a key to unlock this cupboard!");
}

The "else" code will appear if you use anyother item on the cupboard.
And the "if" code will open the cupboard and let you recieve a cup, only "if" you have the specific key located in your Inventory.

SMF spam blocked by CleanTalk