Galv's Event Spawner

Galv

Veteran
Veteran
Joined
Oct 1, 2012
Messages
1,186
Reaction score
1,143
First Language
English
Primarily Uses
N/A

Event Spawner - Version 1.6
RPG Maker MV Plugin
Galv

Introduction
Spawn events from one map to the map the player is on.


Screenshot



Features
This plugin adds the ability to duplicate/spawn events from a specified “Spawn Map” to the current map the player is on.
These events can be temporary (which disappear when player leaves the map) or permanent (they remain even when player leaves the map and returns) and can be cleared with script commands if required.
Events can be spawned to a specific x,y location or a random tile with specified region ID.
Self-Switches work with spawned events.


How To Use
- Copy the "GALV_EventSpawner.js" file into your project's /js/plugins/ folder.
- Activate plugin using the 'Plugin Manager'
- Read the help file and examine the demo to learn how it works.


Plugin
Get it here


Credit and Thanks
- Galv


Terms
Free to use in any RPG Maker MV project including commercial. Please credit "Galv".



Updates
2017-06-24 - Version 1.6 - added ability to get last spawned event ID and store it in variable
2017-01-21 - Version 1.5 - fixed a bug clearning events on a different map
2016-11-08 - Version 1.4 - fixed incorrect documentation
2016-07-25 - Version 1.3 - create event note meta each time an event is spawned
2016-05-15 - Version 1.1 - fixed issue where events wouldn't spawn at y2
2016-05-15 - Version 1.0 - release
 
Last edited:

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
820
First Language
English
Primarily Uses
Hey Galv, you may want to consider adding this to your code so meta can be read from spawned events:


alias_DataManager_onLoad = DataManager.onLoad;
DataManager.onLoad = function (object) {
alias_DataManager_onLoad.call(this, object);
var array;
if (object === $dataSpawnMap) {
this.extractMetadata(object);
array = object.events;
} else {
array = object;
}
if (Array.isArray(array)) {
for (var i = 0; i < array.length; i++) {
var data = array;
if (data && data.note !== undefined) {
this.extractMetadata(data);
}
}
}
};


Needed to write this because I wanted to read a meta tag from spawned events
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
How am I able to associate the map ID? The default is 1- but If I am doing this in a project that already has maps made, how can I correct this?
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
820
First Language
English
Primarily Uses
How am I able to associate the map ID? The default is 1- but If I am doing this in a project that already has maps made, how can I correct this?
When you select a map in the editor the id is located at the bottom. Put the id of the map you want to spawn events from in the parameter, without the leading zeros.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
OK I've got the map ID Fixed, but the event is parent null etc.


I think the project is having diffculty spawning the event itself now- I have a single event in the map with the asssociated ID.


I want it to spawn on regions i have painted on a map but I don't know how to associate the event with the script call.
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
820
First Language
English
Primarily Uses
OK I've got the map ID Fixed, but the event is parent null etc.


I think the project is having diffculty spawning the event itself now- I have a single event in the map with the asssociated ID.


I want it to spawn on regions i have painted on a map but I don't know how to associate the event with the script call.
You just use the event id. Script command examples are in the help documentation for the plugin.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
OK I have the map ID for spawning as map  026:Spawn Map (17x13)


The event in the map is 001:Crazy Chicken


The region I want it to spawn randomly on is 13


The script call I have on a local event on the different map (Map ID 25) is:


// Spawn event with ID 1 on region 13, temp


Galv.SPAWN.event(1,13,false);


When I try to activate the event to initiate the script command I recieve this error:


Cannot read property 'parent' of null


Now I know null means virtually "nothing" but the rest makes no sense to me- I've copied over what I needed and have been going back and forth reading the help list, but I'm stuck at this point.
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
820
First Language
English
Primarily Uses
Post screenshots of your setup
 
Last edited by a moderator:

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
I hope my colour linking helps make he process a little more understandable from my view point.

problemo.png
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
820
First Language
English
Primarily Uses
It looks perfectly setup, so getting an error is strange.


Are you using any other plugins? Try turning some off.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
Now that you mention it I have other plugins that use events for lighting and effects etc, but the numbers I used for the event spawn aren't the same ones I have dictated for the other events. I will work on turning some off for the moment to see if anything changes.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
Strange, I had all my plugins turned off. it works now- but the moment I turn on YEP Event mini label plugin, it brings up the null error message.
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
820
First Language
English
Primarily Uses
Strange, I had all my plugins turned off. it works now- but the moment I turn on YEP Event mini label plugin, it brings up the null error message.
I'm not getting any error with YEP mini label. Did you do anything special with it?
 
Last edited by a moderator:

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
I haven't changed anything with it, with it turned off/removed all other plugins work fine.


My next issue is combined with the graphics randomizer selection request I made,




At this point I need each event spawned to do a random hand out on what graphics it will be appointed with. If I have a moveroute option with a graphic change done in common event setting for 'this event' it changes the graphic on the spawn event creator instead of spawns themselves.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
Sorry to add further confusion, for some reason the plugin is now having conflicts with Terrax lighting plugin. I will investigate to see if there is a fix.
 

Galv

Veteran
Veteran
Joined
Oct 1, 2012
Messages
1,186
Reaction score
1,143
First Language
English
Primarily Uses
N/A
Hey Galv, you may want to consider adding this to your code so meta can be read from spawned events:



alias_DataManager_onLoad = DataManager.onLoad;
DataManager.onLoad = function (object) {
alias_DataManager_onLoad.call(this, object);
var array;
if (object === $dataSpawnMap) {
this.extractMetadata(object);
array = object.events;
} else {
array = object;
}
if (Array.isArray(array)) {
for (var i = 0; i < array.length; i++) {
var data = array;
if (data && data.note !== undefined) {
this.extractMetadata(data);
}
}
}
};


Needed to write this because I wanted to read a meta tag from spawned events





Thanks - I added ran the extraMetadata function from the spawn event when it gets created instead. Please let me know if this works for you.


@Skurge if you are having issues, make sure to try changing the position of the plugins in your plugin list to see if it has an effect.


I will look into terrax lighting plugin to see if I can make them compatible when I get some time freed up
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
Thank you for checking in and for all your service, I look forward to that bug fix if there is anything- in the mean time I'll try some more with rearranging the plugins.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
Been doing bug testing and plugin rearranging again for a couple of hours. All my efforts seem to be stumped- I can assume it has to be the terrax lighting having conflicts.
 

Galv

Veteran
Veteran
Joined
Oct 1, 2012
Messages
1,186
Reaction score
1,143
First Language
English
Primarily Uses
N/A
I have tested tarrax lighting with this plugin now and they both work together. The lighting system doesn't detect the spawned events, though.


I recommend asking Terrax to update his plugin to reference $gameMap events instead of $dataMap events. I did a test updating it all and spawned events work with lighting also.
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,135
Reaction score
233
First Language
English
Primarily Uses
N/A
Terrax has been absent for some time, i'll try to message him. With your test updating was that change you made fixed the issue? I'm not sure if you encounntered the same issues as me but whatever you have done might be a saving grace.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

There's another Humble Bundle available now for RPG developer assets, this time focused somewhat more towards pixel art style games.
Ive got a long lost half uncle. Thats real cool.
I forget what is bumping rule in this forum. Is anyone know? Thank you.
BCj
Ew, why does my blogpost on the rpgmaker.net site look like a garbled mess? Are html codes disabled or something?
I feel that I should cut down on my order queue so I can get some more time for my projects, its been quite a longggg while since I worked on them LOL

Forum statistics

Threads
97,899
Messages
947,698
Members
129,128
Latest member
CRThater777
Top