Hi all another noob question from me. How do I trigger an event after a dialog has ended. ie after a dialog the NPC disapears. I've worked out by looking at the manual/wiki to use transparency and/or move to get rid of the NPC, but how can i trigger it to occur once the dialog has ended?
if i try and put it in the NPC talk function in the GlobalScript, regardless of if i put it after the dialog start code, it happens immediately upon speaking to the NPC rather than when the dialog has ended.
once again any help is greatly appreciated.
Hey.
Try putting your code on the exit option of your dialog. ;)
Like this:
@4
your code here
stop
EDIT: Oops, sorry read your question a bit to fast.
You can either do a
if ((dMRandy001.GetOptionState(2) == eOptionOff)
Or do a check for if the dialog has runned.
dialog.HasOptionBeenChosen
Hope it helps. :)
Brilliant, worked a treat thanks very much.
Just for reference, you can also set a global variable and check it in rep_exe:
// in dialog 5's script, before "stop"
dialog_ended = 5;
// top of Global Script, or custom script
void DialogEnded(int id) {
if (id == 5) {
// this runs after dialog 5 has ended
...
}
}
// in repeatedly_execute
if (dialog_ended) {
DialogEnded(dialog_ended);
dialog_ended = 0; // reset
}
If you want to do this generically (e.g., do something when any dialog ends, like turn a GUI back on), you can combine Khris' suggestion with the custom dialog rendering options. Basically you can tell that a dialog has started by setting a variable in dialog_options_get_dimensions or dialog_options_render and then tell that a dialog has ended when repeatedly_execute is triggered.
Seems like you got it sorted out, but just wanted to mention an alternative that lets you know when any dialog has ended without having to modify every dialog script.