hHotspot2_UseInv() Help please.

Started by Mixand, Wed 13/05/2009 17:40:04

Previous topic - Next topic

Mixand

I'm trying to make it so that if I use a stick on the river I have. It will change the stick in my inventory into a stick with a fish on it. But with it the way it is now you can use any item on the river and it still does it.

function hHotspot2_UseInv()
{
Jason.Walk(92,  112);
Jason.Say("&22 Fishy fishy fishy!");
Display("You spear the fish in the river.");
player.LoseInventory(istick);
player.AddInventory(Fishstick);
}

Please help me.


NsMn

you have to write:

function hHotspot2_UseInv()
{
if(player.ActiveInventory==istick){
Jason.Walk(92,  112);
Jason.Say("&22 Fishy fishy fishy!");
Display("You spear the fish in the river.");
player.LoseInventory(istick);
player.AddInventory(Fishstick);
}
else Display("You can't throw that into the river.");
}

That should work.

Trent R

Code: ags
if (player.ActiveInventory == iStick) [
  //do stuff
}


[Edit]:NsMn beat me by mere seconds.
~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

Mixand

Quote from: NsMn on Wed 13/05/2009 17:48:10
you have to write:

function hHotspot2_UseInv()
{
if(player.ActiveInventory==istick){
Jason.Walk(92,  112);
Jason.Say("&22 Fishy fishy fishy!");
Display("You spear the fish in the river.");
player.LoseInventory(istick);
player.AddInventory(Fishstick);
}
else Display("You can't throw that into the river.");
}

That should work.

Thankyou a lot! It helped me heaps :) *cookie*

Khris

The number of threads asking this exact same question must be above 50 by now, I'm sure.

Trent R

I'd like to join with Khris's suggestion in the last thread like this: Add to the tutorial!

Even densming only recently touched on it IIRC, but that's 30-something vids in.


~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

SMF spam blocked by CleanTalk