Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: sloppy on Fri 04/11/2005 17:59:28

Title: Changing dialog topic
Post by: sloppy on Fri 04/11/2005 17:59:28
How would accomplish this?  When I speak to a character, the first dialog topic is used.  After I give him something, when I speak to the character I want it to be another dialog topic. 

How do you skip the first topic and go to the 2nd one after a particular action?
Title: Re: Changing dialog topic
Post by: Ubel on Fri 04/11/2005 18:51:57
You'd have to use variables

Put this in the beginning of the Global script:
int give_item = 0;

And this to Use Inventory On Character script:

if (game.inv_activated == inventory_number) {
Ã,  give_item = 1;
Ã,  }


Then put this code in the Talk To Character script:

if (give_item == 0) { //Runs this if you haven't given the item to the character.
Ã,  RunDialog (first_topic);
Ã,  }
if (give_item == 1) { //Runs this if you have given the item to the character.
Ã,  RunDialog (second_topic);
Ã,  }




Some other things about variables

If you happen to want to use the variable in some other scripts, like room scripts, you have to put this in the end of Global Script:
export give_item;

And this in the Script Header:
import give_item;

This way you can change the value of this variable in room object, hotspot etc. scripts.
Title: Re: Changing dialog topic
Post by: sloppy on Fri 04/11/2005 19:31:15
Of course.  That's the obvious answer, I should have realized that variables would take care of that.

But thanks for responding.