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
324
Reaction score
207
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,187
Reaction score
4,908
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
343
Reaction score
138
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 Posts

Latest Profile Posts

My sister is a saint. Specifically Saint Peter. Because shes my best friend until other ppl are around then shes all "nope, dont know him, dont like him."
Making it a rule that I don't do any world building for my new game before the actual gameplay is concrete and working. I have 16 years of lore to work with anyway.
Cheesy power metal makes everything better. No matter what you do, you'll feel heroic doing it.
Starting to really like the first of my madness areas. I think the eyes looking at them really helps to sell the place. :LZSexcite:

Forum statistics

Threads
95,699
Messages
931,127
Members
126,046
Latest member
Jilmer_Juan
Top