Changing dialog topic

Started by sloppy, Fri 04/11/2005 17:59:28

Previous topic - Next topic

sloppy

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?

Ubel

You'd have to use variables

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


And this to Use Inventory On Character script:
Code: ags

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


Then put this code in the Talk To Character script:
Code: ags

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:
Code: ags
export give_item;


And this in the Script Header:
Code: ags
import give_item;


This way you can change the value of this variable in room object, hotspot etc. scripts.

sloppy

Of course.  That's the obvious answer, I should have realized that variables would take care of that.

But thanks for responding.

SMF spam blocked by CleanTalk