Random NPC encounter from NPC pools

Charles2020

Veteran
Veteran
Joined
Feb 24, 2020
Messages
31
Reaction score
1
First Language
English
Primarily Uses
RMMV
Hi guys

Does anyone know how to code or plugin that generates random NPC in the scene from NPC pools

For example, once player enters the house. Player can see 2 different NPCs (from pool NPCs that have been created) every time. May need code to generate NPCs or AI (see picture attached)

Any suggestions are welcome

Thanks
 

Attachments

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
326
Reaction score
119
First Language
English
Primarily Uses
RMMV
Just use change variable before transfer to the map, that sets it to a random number between the amount of NPC possibilities, per NPC preferably. Set each page to the variable in ascending order, so page 8 if variable 1 > 8, page 7 if variable 1 > 7, ect.
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
1,696
Reaction score
556
First Language
Dutch
Primarily Uses
RMMV
make NPC's (page 1), var >= 1, page 2, var >=2 etc up to 6-10.
on door event (outside),
control var random 0-9
if: var x = 0
control var x += 1
control selfswitch A = ON
end
if: var x = 2
control var += 2
control selfswitch A = ON
end

repeat till you have var x = 9
make sure that page 2 of the door have selfswitch A ON, and
the door event to enter the door to keep the same NPC
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
354
Reaction score
139
First Language
english
Primarily Uses
RMMV
random variables on entering is how i also did my gathering points so not at exact same spots every time
 

Charles2020

Veteran
Veteran
Joined
Feb 24, 2020
Messages
31
Reaction score
1
First Language
English
Primarily Uses
RMMV
Thanks much. Is there a way to do by coding? I might need to incorporate this to plugins or create a plugin
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
326
Reaction score
119
First Language
English
Primarily Uses
RMMV
Thanks much. Is there a way to do by coding? I might need to incorporate this to plugins or create a plugin
Not sure what you need a plugin for, a more advanced way to do it is to use a parallel event that sets the movement route and initial spot/image of the NPCs based off the variable and then just use blank events with conditional branch setting their dialogues, erase parallel after initial set.

I mean if you do want a plugin that does it you could try this
or the 3 yanfly ones, I mean you would still need to use a variable to determine which to spawn?
 
Last edited:

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
1,696
Reaction score
556
First Language
Dutch
Primarily Uses
RMMV
in case you have NPC on different spot, make sure to create empt events as well.

if NPC var is 1, and npc 2 on a different spot is var 3, both will spawn,
so empty spot below character with the same value is needed.

copy event from yanfly would do a better trick than event spawner that can spawn
constantly or not, but based on region ID.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I based this on the armor of Actor 1_7 of the RTP. Hair is from Derex and Sythian Bard.
Stream will be live shortly! Going to do another art stream tonight so that I can finish my Fauna Focus piece~ Feel free to drop by!
Humans are fallible creatures, we all know that. It's when we're forced to look at ourselves that we start to disagree. :p
Expectation: Working on boss battle.
Reality: "Look at how awful are these code and database organization. Let me clean this mess", *yet, casually adding more modules that I have no idea if I would use it later*
Trying to learn to read Japanese so I read my manga. I like to buy them without all the edits made during translation.

Forum statistics

Threads
97,865
Messages
947,456
Members
129,089
Latest member
candutekno
Top