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
120
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,700
Reaction score
559
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
355
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
120
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,700
Reaction score
559
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

Please do not buy games from g2a.com. The sellers have total power over you. The website has many scam sellers. It looks cheap, but the key code didn't work.
A while back I was having fun making my own custom tiles, then I hit carpet... why is it so difficult!? Lol.
Weekend is finally here... what would you like to see (?):
1) Pokemon into zelda minish-cap style
or
2) Pokemon into zelda gbc style
or
3) Zelda into pokemon style

#= Choose ===============#
||__[ Full mockup ]_[ Charset ]__||
#=======================#
I know someday I'll start working on this...

I'm so happy that I got Steam achievements to work in my game, thanks in large part to the posts by other RPG Maker devs on this issue!

Forum statistics

Threads
97,943
Messages
948,059
Members
129,192
Latest member
LonelyBanshee
Top