How to start new dialogue branch?

Started by , Tue 03/01/2006 02:31:07

Previous topic - Next topic

Pocket veto

I'm trying to make a dialogue branch that is contingent upon a previous action having been completed, in this case an item being used on a hotspot.

After copmleting the action in one room, the playable character should then be able to enter into another dialogue branch with the NPC in the other room.

Play_Pretend

This may be a newbie answer, but what I think might work is:

Create a global variable (for this I'll assume it's number 5), with an initial value of zero...

Put script like this in the NPC's Talk Interaction:

if (GetGlobalInt(5) == 0) {
    RunDialog(0);
}
else if (GetGlobalInt(5) == 1) {
    RunDialog(1);
}

Then put a line in your script so when the item is used on the hotspot, there's a SetGlobalInt(5, 1); command.  Set up the two separate dialog branches (0 and 1, or whatever numbers you end up using).  This way it'll only play the second dialog branch (#1) if the item's been used, otherwise it'll just stick to the first (#0).

Hope that makes sense, and if there's an easier way, I'd like to learn too. :)

Ashen

Now that the Wiki's up, there's no excuse not to have read the BFAQ:
Quote from: Front page of the BFAQNOTE: 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".

Specifically:
Working with variables: the basics (a slightly more 'advanced' way to do it) and GlobalInts, your friend: what they are and how to use them (this is pretty much what Strange Visitor said, but with a bit more detail).
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk