How to make characters spawn randomly in different places?

I set up a camp where players can interact with the characters they’ve recruited in between maps. I’ve always loved it when games let you interact with and befriend your allies and gradually get to know them better. In addition to being available to talk to, characters can randomly spawn at different locations around the camp when the camp map is loaded. I use events to decide who gets randomly assigned to which location around camp.

Below are examples of two locations where characters can spawn. One event is for the “foraging” location and one is for the “guard duty” location. Eventually I plan to add more locations where characters can spawn, but I want to refine my system with these two first before I add more.

Foraging Assignment  Event.jpg

Guard Duty Assignment  Event.jpg

The problem is that sometimes these events don't work, probably because the same character variable is chosen by both events. Does anyone know a better way to set up these events or a plugin that would let me do something similar? Surely other people have had similar features in their games. Certain genres rely on this, like farming sims.
A simpler approach could be to put multiple Events for one party member instead of a jumping one. Let's say, Maris has 3 potential locations, then you would have 3 Events while all of them have different conditions.

When you want to avoid duplicated code, then you want to use Common Events.
A simpler approach could be to put multiple Events for one party member instead of a jumping one. Let's say, Maris has 3 potential locations, then you would have 3 Events while all of them have different conditions.

When you want to avoid duplicated code, then you want to use Common Events.
I'm not sure I'm following what you're saying. What specifically did you have in mind?

I also thought of creating one event per character where each character's event has several pages. If the variable used to determine that character's placement equals 1, Event Page 2 would activate (its condition would be that the variable for that's character placement would equal 1.) Unfortunately, variables for the conditions for Event Pages have to be greater than or equal to, which means this system wouldn't work.
How many potential locations do you want them to be able to spawn at? Most event spawners will let you spawn an event at a region, so you could just paint every tile you want to be a spawnable location with that region.

Spawn events from a specified map onto other maps at the location you choose or to a random region tile on the map.
How many potential locations do you want them to be able to spawn at? Most event spawners will let you spawn an event at a region, so you could just paint every tile you want to be a spawnable location with that region.

Spawn events from a specified map onto other maps at the location you choose or to a random region tile on the map.
That’s a good suggestion. I looked into both Galv’s Event Spawner (I already use several Galv plugins, which helps) and VisuStella Events/Movement Core (which I already am using, but I didn’t know it could spawn events.) Spawning events would only work if there is a way to ensure that when characters randomly spawn, one will always be assigned to each station, but two or
more CANNOT be assigned to the same station.

I’m thinking of making each station a region and creating a condition that checks if any event is in that region. If there is, then another event/character will not be assigned there. Does anyone know what the script call would be for checking if an event is in a region? Hopefully I could use a generic version of this condition and not have to create a condition like this for each event/character.
Does anyone know what the script call would be for checking if an event is in a region?
$gameMap.eventsXy(x,y)

The other way to do it is don't use regions but declare an array of potential coordinates events can spawn at, randomly pick one, then splice that coordinate out of the array so it's not picked again.
I think you should split and combine the events in a different way:
have one event that determines the random possibilities for everything, and have the other events only react to those value, not determine them.

That way the randomizer can check and guarantee that no actor is used double and prevent any clashes.
I found a different solution that works!

This old topic has two different methods of doing this. I put the array that Arthran created in the second post into a Common Event with the Script function and modified it with the variable numbers that I am using. The array only has seven characters because they are all I have programmed so far. At the end I placed a self-switch that ends the event.

Random Character Placement Script 1.jpg

Random Character Placement Script 2.jpg

(this second screenshot has the last few lines needed)

Next the Foraging and Guard Duty events play and move the characters' events (each character is set up as an event) to the duties that were assigned with the array. I didn't have to change how these were set up from when I posted them in the first post. So far this system has been doing exactly what I want it to!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-characters-spawn-randomly-in-different-places.166430/