Spawning NPCs on other maps

ashes999

Uber Coder
Veteran
Joined
May 18, 2012
Messages
114
Reaction score
6
First Language
English
Primarily Uses
I'm working on a game where I generate about 5-8 NPCs up front (on creating a new game). I also have a known set of maps. I need to distribute my NPCs to different maps.

I can't do this through the visual editor, because the NPCs don't exist until the game runs (each new-game creates a random/different set of NPCs).

I'm using Archeia's spawn-event script here, if that matters. Fundamentally, though, I don't see a way to load a game map (other than the current one in $game_map) and spawn the event there. Even if I did, would it persist (when the player goes to that map, the event is there)?

How can I solve this problem, other than a script on every map that says "when the player enters this map, spawn any NPCs that are on this map?" -- I don't like duplicating stuff everywhere :/
 

Schlangan

A madman with a computer
Veteran
Joined
May 20, 2015
Messages
1,421
Reaction score
1,701
First Language
French
Primarily Uses
RMMV
Did you try using switches to make them visible/non visible depending on the case ? You can later the switches within scripts too.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,359
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
Maps (and events on them) do not exist when the player is not on them, and are always only loaded when the player enters them.


I suggest you make placeholders on those maps, then use a common event to check if a map is loaded for the first time and if yes, place the events for the NPCs then and use something like Shaz' remember event position script to store the data for later entering of those maps.
 

ashes999

Uber Coder
Veteran
Joined
May 18, 2012
Messages
114
Reaction score
6
First Language
English
Primarily Uses
I solved this. I didn't use placeholders, but I did end up using a common event like @Andar suggested. (I have code already to place them randomly/consistently, so I don't need to use placeholders.)

Thanks for the help!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top