[Help] Random Greetings

Place where miscellaneous quests and NPC dialogue are written.

Moderator: Lead Developers

Locked
User avatar
Ragox
Developer
Posts: 203
Joined: Sat Jul 20, 2013 1:52 pm

[Help] Random Greetings

Post by Ragox »

I'm trying to get a creature say a random greeting from a pool of greetings that I've made for it.

I understand that it'll always pick the first greeting from the top that is valid and therefor it always says the same one.
How can I work around this to get it say a random one of a couple valid greetings?

I've never really worked with the dialogue system before so this is all overwhelming to me.
Does someone know how to do this? I'd really appreciate any help :)
User avatar
Infragris
Developer
Posts: 81
Joined: Sun Mar 10, 2013 11:23 pm

Post by Infragris »

You should use the Random100 function. In the Function/Variable fields on the right, first select Global, then Random100: this is a random number generator of some sort. Then, select < (or <=, doesn't matter) and assign each of your greetings a number: if you have five greetings you use something like 20, 40, 60, 80, last one unfiltered. This way, if the generator gives something smaller than 20, it selects the first answer, smaller than 40 is the second, etc. Last answer is unfiltered so that there is always a basic response. This should also work for creatures. If in doubt, check how generic greetings for a town like Khuul are organized.
User avatar
Ragox
Developer
Posts: 203
Joined: Sat Jul 20, 2013 1:52 pm

Post by Ragox »

Thanks a lot Infractis, I got it all working now :)
Locked