Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sat 18/09/2004 14:57:50

Title: Using Inv Item With Hotspot
Post by: on Sat 18/09/2004 14:57:50
Ok so I know hwo to do it I just forget how I would make it so if I use any other inv item. (The ones your not supposed to use) it says something different like "Not going to work."

Thanks in advance.
Title: Re: Using Inv Item With Hotspot
Post by: on Sat 18/09/2004 15:31:39
Scripting:

if (character[GetPlayerCharacter].activeinv == ITEM) { //(where ITEM is the number of the right inventory item)
Ã, Display ("Yay! It works!");
Ã, // or whatever you want to happen
}

else { // wasn't right item so do this
Ã, Display ("No, that doesn't work.");
Ã, // or whatever else you want to happen
}

Interaction editor:
Ã, Conditional - If inventory item was used (number of right item)
Ã,  Ã,  Ã, Game - Ã, Display message
Ã,  Ã,  Ã, (or Whatever you want to happen)
Ã,  Ã,  Ã, Stop running more commands
Ã, Game - Display message (number of 'Doesn't work' message)
Ã, (or whatever else you want to happen - outside of Conditional)

Or:
Just have the conditions set up for using the right item, and set up the unhandled_event function to deal with the others. This way you don't have to put the wrong item condition in every hotspot.


function unhandled_event (int what, int type) {
Ã, if (what ==1) { // Hotspot
Ã,  Ã,  if (type ==3) { // Use inventory on
Ã,  Ã,  Ã, Display("No, that doesn't work.");
Ã,  Ã, }
Ã, }
}
Title: Re: Using Inv Item With Hotspot
Post by: on Sat 18/09/2004 16:22:34
Thanks loads, I think I've somewhat got the hang of it now. But I think i'll run into more problems later. :P