Random NPC encounter from NPC pools

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
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.
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
random variables on entering is how i also did my gathering points so not at exact same spots every time
Thanks much. Is there a way to do by coding? I might need to incorporate this to plugins or create a plugin
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?
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.

Original thread: https://forums.rpgmakerweb.com/threads/random-npc-encounter-from-npc-pools.119599/