Basic Dialogue Problem

Started by kagechikara, Thu 01/11/2007 06:17:51

Previous topic - Next topic

kagechikara

I want my characters to run through a dialogue and then, once the dialog finishes, if the main character tries to talk to the other character again, I want to display the message 'I have nothing more to say to him' (or something similar) instead of having the dialog run again. I can't seem to figure out how to do this. Help?

Khris

Use variables.

(Adding a short paragraph about variables to the read me first-thread might be a good idea, btw.)

Dualnames

You could as well do this
messy code but whatevery
at the talk to character interaction put the following code
if (GetGlobalInt(1) != 1)  {
dialog[0].Start()
SetGlobalInt(1,1);
return;
}
if (GetGlobalInt(1) == 1) {
Display("I have nothing more to say to him");
}
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)

Ashen

Make the second if an else if (or even just else), and you can get rid if the return;. Other than that, it's not messy code at all, and is pretty much the exact thing KhrisMUC suggested. I might use a named variable instead of the GlobalInt, however. If it's only going to be used for this interaction, it doesn't need to be global (Character interactions are handled in the Global script, so just declare your variable there).

The 'read me first' thread doesn't mention variables, but it doesn't link to the BFAQ which says on the front page:
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".

Maybe it could be made clearer in the variables entry HOW exactly you'd do that, as it's mostly about creating them with just a few lines on use, but I don't think it belongs in the rules thread.
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk