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
523
Reaction score
415
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,497
Reaction score
5,334
First Language
english
Primarily Uses
RMMZ
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
555
Reaction score
230
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

"You can thank my later", "But you haven't done anything", "Well, that's why ..."
Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

Forum statistics

Threads
105,884
Messages
1,017,242
Members
137,609
Latest member
shododdydoddy
Top