Hotspot has a different response on second click?

Started by Global Lint, Mon 23/10/2006 21:27:11

Previous topic - Next topic

Global Lint

How do you make a hotspot have a different response the second, third, fourth etc. time it is clicked?

Let's say you had a bookshelf hotspot.  Click it once and it will say, "The bookshelf contains many books."  Click it again and it will say, "There is a Harry Potter book."  Click it again and it will say, "There is also a horror novel." 

I have another question: How do you get it to display these messages in the same order after the third one ("There is also a horror novel") is clicked, skipping the first message? 
Spaz ate the dopefish.


Global Lint

Ah, thanks, kind one :)

Oh, but I have another question.  What if you wanted a NON-player character to speak and say different responses?
Spaz ate the dopefish.

Ashen

Possibly, if you examine the MultiResponse Module's code, you'll find a way to get the MultiResponse text, and use it for an NPC.

However, to quote the BFAQ:
Quote
NOTE: Please keep the following in mind. Most of our problems can be easily solved using variables. Need to change a hotspot's state in another room? Use variables! Need an object to be used only once? Use variables! You can either use Global Integers and Global Strings (look inside the AGS manual for these) or custom variables. Look at the solution to that problem HERE under "Scripting, Code & Interaction".

So, you could use the old-fashioned method, e.g.:
Code: ags

// Top of global script
int response;

// Hotspot interaction
if (response == 0) cNpc.Say("Thing 1");
else if (response == 1) cNpc.Say("Thing 2");
else if (response == 2) cNpc.Say("Thing 3");
else if (response == 3) cNpc.Say("Thing 4");
else if (response == 4) cNpc.Say("Thing 5");
else if (response == 5) cNpc.Say("Thing 6");
 // etc
response ++;


Creating an array (int response[AGS_MAX_CHARACTERS];) and using it instead of the int (if (response[cNpc.ID] == 0) { ...) might be a better way.
I know what you're thinking ... Don't think that.

Global Lint

Oh, dear... I'll try and sort all this out, but I'm not that sure I can...

*deep breath*  Here goes!
Spaz ate the dopefish.

SSH

MultiResponse can already do this:

cNPC.Say(Multi.SRespond("The bookshelf contains many books.>There is a Harry Potter book.>There is also a horror novel." ));
12

Global Lint

Spaz ate the dopefish.

SMF spam blocked by CleanTalk