Hi,
I'm trying to create a conversation in my game. When first spoken to, I want 'Sister' to say her first line of text (changed to 'Zero' for now). After she's said 'Zero' once, I want her to say 'Not zero' the second time she is spoken to (and any time after that).
I'm following this tutorial: https://www.youtube.com/watch?v=nj1N6nr5_Ls&channel=densming
I've even typed out the code exactly as it is in the tutorial (replacing the character's names) and it hasn't worked.
I've created a global variable called 'dialogCounter' and set it to '0'.
I've also typed
dialogCounter = 0;
at the top of my script file (same place as in the tutorial).
Here is the code for the conversation:
@2
if (dialogCounter == 0) {
cSister.Say("Zero");
dialogCounter++;
}
else {
cSister.Say("Not zero");
}
stop
Instead of saying 'Not zero' the second time around like I want her to, she just keeps saying 'Zero'. If I change 'else' to 'if (dialogCounter > 0)', she says 'Zero' immediately followed by 'Not zero' (I don't want her to say 'Not zero' until she's spoken to a second time). 'else if (dialogCounter > 0)' also doesn't work.
Where am I going wrong? :confused:
Thanks to anyone who can help.
Have you put
dialogCounter = 0;
in the Dialog startup entry point of the dialog?
Also, you could replace stop with return.
Time for you to rethink (roll)
Quote from: slasher on Mon 15/12/2014 14:24:24
Have you put
dialogCounter = 0;
in the Dialog startup entry point of the dialog?
Also, you could replace stop with return.
Time for you to rethink (roll)
Hi Slasher, thanks for your reply.
I understand where I've gone wrong, and I feel like an idiot now lol :P I just assumed the dialogCounter = 0; had to be placed in the dialog start-up entry point for whatever reason... since the guy in the tutorial put it there I assumed it was necessary. But I actually understand the purpose it serves now. It was resetting the dialogCounter back to 0 whenever I started up the conversation. Makes total sense now!!
Hi,
Glad you got it sorted and of course: It will always be set to o as you so rightly say ;)