Hello, I would like to get more variations in the dialogs, is it somehow possible to do a dialog like this:
Player say: "Tell me a story"
NPC say: "Random dialog picked out of some predefined sentences"
and how would I set this up?
You can use normal script in the dialog editor if you leave a space at the beginning of the line.
To do something like that you could use a variable and randomize it.
int r = Random(2);
if (r == 0) cNPC.Say("story 1");
if (r == 1) cNPC.Say("story 2");
if (r == 2) cNPC.Say("story 3");
Edit: Sorry, corrected Random with a capital R.
Hello, thanks for your reply, with that code I get an error message that says:
undefined symbol 'random'
This is how the dialog looks in my code:
@1
int r = random(2);
if (r == 0) cNPC.Say("story 1");
if (r == 1) cNPC.Say("story 2");
if (r == 2) cNPC.Say("story 3");
return
Would you mind explaining a bit further?
There was probably a typo, it's Random, with capital R.
Related article in the manual:
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_General.html#random
Yes with the capital R it is working :wink:
Thank you!