Help with creating a randomized dialogue pool that removes dialogues after it's been triggered? (RMMV)

wwwgippal

Villager
Member
Joined
Jan 6, 2021
Messages
8
Reaction score
1
First Language
English
Primarily Uses
RMMZ
So I'm trying to create a dialogue system akin to Hades', where the NPC's will have something to say based on a randomized variable (something like var = random number, then if var = x, then message x will show up).
But I want to remove the dialogue from the pool after the player triggered it. Any ideas on how to do it?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,395
Reaction score
2,498
First Language
English
Primarily Uses
RMMZ
1620050925961.png
Note that this is a really quick-and-dirty implementation; I imagine that changing maps will end up breaking this because it'll think the events with the same IDs on the new map have the same dialogue choices, but it should be an illustrative example of how you'd approach the problem, at least.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,134
Reaction score
618
First Language
English
Primarily Uses
RMMV
You can make the dialogue set a self-switch on the event, then the actual obtaining the random dialogue number is in a loop that iterates until you get a number that hasn't been switched.

This could be more efficient using some script calls, but I'm presuming you don't know any JavaScript, so I'll show you how to do it entirely with event commands. Where I use the Control Variable, just use any variable number you have free.

Code:
Loop
  Control Variable -> Random 1-5
  Conditional Variable = 1
    Conditional Self Switch A is OFF
      Do your dialogue
      Control Self Switch A ON
      Break Loop

do the same for 2/Self Switch B, 3/Self Switch C, 4/Self Switch D, then dialogue 5 is always available (doesn't have a self switch condition) so you won't loop infinitely.

Code:
End Loop
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,469
Reaction score
1,863
First Language
EN
Primarily Uses
RMMZ
This tutorial covers randomness in dialogue, with and without replacement~
 

Latest Threads

Latest Posts

Latest Profile Posts

Tempted to come up with a unique spell naming system....But ''Fire Magic'' and ''Fire,Fira,Firaga'' are so easily recognizable :p
Yesterday I discovered that I can copy/paste multiple commands by holding shift. I tried this when I started developing holding ctrl and when it didn't work I just copied every single command one by one. For two years.

I am in heaven now.
All right, so lesson learned. No more complicated battle systems for me.
Whew, just finished a whirlwind of deadlines. Finally a tiny break. You know...I should go update my 2020 banner now.
image_2021-06-16_153010.png

Why are barrels to difficult? xD I feel like i Barrel...y made it....eh EHHH!? :p

Forum statistics

Threads
112,281
Messages
1,067,070
Members
145,905
Latest member
Hanayura
Top