GML What's the best way for changing variables after a dialog box?

U

Ursidae

Guest
Hey there,

i'm trying to change do some actions after a specific dialog box dissapears. For example: Textbox 1 closes, get +1 Item, warp to specific map... or something like this.

My current setup with dialog box is a trigger on the map and fetch the text through scripts, then destroy the instance. As shown from Shaun Spalding.

I don't get it to work. Any ideas?

Greetings
 
Hello fellow bear!

I'm not really sure what your setup is but the best solution I can think of now is using script_execute().

Have all the textboxes by default have a script variable equal to an empty script that does nothing at all then later change the script variable of the textbox you want to set the trigger to another script that will do the actions you desire. When the textbox closes, run script_execute(). the default textboxes will run the empty script and do nothing while the triggered textbox will run the desired script you assigned. Don't forget when assigning scripts to a variable to drop the parenthesis ().

I'm not sure if your textboxes are individual objects or one object. If it's one, you might want to set an array/list of script variables then take note of the current textbox index.
 
U

Ursidae

Guest
Sorry for the late answer.

I tried to fiddle around a bit but i don't understand it quite well. Maybe i explain my current setup.

I got 3 scripts and one Trigger on the map.

"add_dialog", "start_dialog" and "get_dialog"
With add_dialog add all of the dialog infos to an the scrips like Text, avatar and so on. With start_dialog i create the dialog controller and textbox and output all on the ingame Screen if triggered.

What i can do is:
GML:
start_dialog(DialogObject, DialogObjectLine);
global.Doublejump = 1;
oPlayer.x--;
instance_destroy();
And the Variables changes while the textbox is still opened. I cant get it to work AFTER the textbox closes. So i can have a special animation if the player gets a new item. For example: "Heres your Sword..." Textbox closes. Get_Item animation Plays.

Any ideas?
 
U

Ursidae

Guest
So now after a few hours of searching and testing. I got it.

To do it just make the newest textbox tutorials from the ShaunSpalding Action RPG Tutorial at youtube.


There you'll learn how to create entities including textboxes and scipts to continue the dialogue with the ability to alter variables and run more scripts.

Thanks for all the advise!
 
Top