how to use many items on one hotspot?

Started by Gribbler, Fri 23/01/2009 23:40:02

Previous topic - Next topic

Gribbler

Here's the deal. I have a hotspot and I want the player to say various things depending which item he uses on that hotspot.

Code:

function hDRAIN_PIPE_UseInv()
{
player.ActiveInventory = iNOTEBOOK;
player.Say("Why would I want to stick it in there?");

player.ActiveInventory = iHANDSAW;
player.Say("Why would I want to stick it in there?");

player.ActiveInventory = iSHIRT;
player.Say("Why would I want to stick it in there?");

player.ActiveInventory = iBUCKET;
player.Say("I can't.");
player.Say("The drain pipe is dry.");

}

Now the error I'm getting is this that the player doesn't have one of the items, and the game crashes. But he may have that item later on in the game and use it then. What can I do to make player say various things with using many different items? For example: a hotspot on which player can use every single item which will be available in the game.

Valentine

I think you're missing 'If', so it would be;

if player.ActiveInventory = iNOTEBOOK; {
player.Say("Why would I want to stick it in there?"); }

Dualnames

if (player.ActiveInventory == iNOTEBOOK){
//functions go here
}



Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Gribbler


Galen

Yeah, you were just setting the players active inventory item to iWhatever each time.

if (player.ActiveInventory == iNOTEBOOK)
Will work (remember: '=' for setting things, '==' for comparing things).

SMF spam blocked by CleanTalk