Randomizing the first line of NPC dailogue

MemeCatGames

Villager
Member
Joined
Nov 11, 2019
Messages
12
Reaction score
1
First Language
English
Primarily Uses
RMMV
I have an NPC whose lines will stay the same for the most part (shopping options). However, I would like the first line to be a quote that cycles, preferably randomly. Is there a way for me to do this with the only first line, or do I have to make a separate event page for each "iteration" of the conversation?
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
420
Reaction score
268
First Language
English
Primarily Uses
RMMV
yeah, you can do this pretty straightforwardly



Math.random generates a random number between 0 and 1, we multiply that by two, then apply Math.ceil (which rounds everything up, so 0.02 becomes equal to 1, and 1.02 becomes equal to 2), and then select dialog based on that.
 

MemeCatGames

Villager
Member
Joined
Nov 11, 2019
Messages
12
Reaction score
1
First Language
English
Primarily Uses
RMMV
Wonderful, thank you. I hadn't used this feature before!
 

hiddenone

Lurker Extraordinaire
Global Mod
Joined
Feb 19, 2014
Messages
2,334
Reaction score
5,031
First Language
english
Primarily Uses
RMMV
While Restart's method does work, you can simplify the randomizing of the variable by using the 'Random' operand and just set it from 1 to what ever number you want (depending on how many dialogue options you have).
 

MemeCatGames

Villager
Member
Joined
Nov 11, 2019
Messages
12
Reaction score
1
First Language
English
Primarily Uses
RMMV
While Restart's method does work, you can simplify the randomizing of the variable by using the 'Random' operand and just set it from 1 to what ever number you want (depending on how many dialogue options you have).
Where do I make it set from 1-10 exactly? within the variable?
 
Last edited:

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
358
Reaction score
140
First Language
english
Primarily Uses
RMMV
edit: redacted
edit2: screenshot. just make another "if variable = n" statement for each RNG possibility.
 

Attachments

Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Popular old italian singer be like: We will win against Coronavirus! Humanity was capable of destroying even the dinosaurs! *cry laughs*
MarioWidjaya123 wrote on kyonides's profile.


I thought they were dead, but I wanted to be certain. :kaoback:
Always kind of annoys me to see people complain about ads in their phone applications because people are too lazy to turn on airplane mode when using them.

Forum statistics

Threads
98,246
Messages
950,676
Members
129,545
Latest member
mememe13
Top