Using a bool to determine dialog trigger

Started by morph100, Wed 02/01/2019 19:50:20

Previous topic - Next topic

morph100

OK so still trying my very first game so forgive the basic questions.

I'm trying to trigger a different dialog script depending on the value of a bool, as in if bool is true then play dialog 1 if it is false play dialog 2. But I'm setting the Bool value in the room script but the dialog triggers from the character talk are in the global script so I keep getting dialog 1 and not 2.

Hope that makes sense?

Slasher

try making the bool in the global variable pane in the editor and not in room script...

Khris

The entire point of a global variable is to be able to access it from multiple scripts, so your diagnosis doesn't make sense. My guess is you accidentally declared the bool in the header and thus created a separate version for each script.

Here's the proper way:

Code: ags
// global header
import bool showOtherDialog;

// top of global script
bool showOtherDialog; // default value for bools is false
export showOtherDialog;

morph100

Thanks yes it was a local variable not a global one! I will go back an change it now.

SMF spam blocked by CleanTalk