Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mixand on Wed 13/05/2009 17:40:04

Title: hHotspot2_UseInv() Help please.
Post by: Mixand on Wed 13/05/2009 17:40:04
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.

Title: Re: hHotspot2_UseInv() Help please.
Post by: 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.
Title: Re: hHotspot2_UseInv() Help please.
Post by: Trent R on Wed 13/05/2009 17:48:46
if (player.ActiveInventory == iStick) [
 //do stuff
}


[Edit]:NsMn beat me by mere seconds.
~Trent
Title: Re: hHotspot2_UseInv() Help please.
Post by: Mixand on Wed 13/05/2009 18:11:38
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*
Title: Re: hHotspot2_UseInv() Help please.
Post by: Khris on Wed 13/05/2009 20:22:16
The number of threads asking this exact same question must be above 50 by now, I'm sure.
Title: Re: hHotspot2_UseInv() Help please.
Post by: Trent R on Wed 13/05/2009 20:32:59
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