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
416
Reaction score
266
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,324
Reaction score
5,022
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
139
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

I decided to rework my main character's portrait and logo at the same time....


Honestly I was going to use a lot more yellow in the game along with red and white to represent characters.... But yellow really is just like.... the ugliest color in the color pie. So er... I'm going to use blues/purples in place of it. :LZSwink:
XwwX OMG! Only 4 more weeks till I can leave my crappy job and never ever go back! I am SO freaking excited!!!
Sometimes, it's so hard to resist
"this boss is too easy, what if I add more gimmicks". Then I remember most of my players might be already dying fighting the boss.
You certainly should show love and recognition to teammates who have achieved great success! Congrats Eli!
Just 2 Days of no Internet and I made more Progress in my Game than last 2 Weeks combined. Now I know, Internet makes me a Lazy person.. :D

Forum statistics

Threads
98,076
Messages
949,096
Members
129,358
Latest member
AbidNaga
Top