MV Event Spawner

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.

VERSION 1.7 – RPG Maker MV
Download Plugin file
Download Demo


70 thoughts on “MV Event Spawner

  1. This is not a request or a suggestion, just a question:
    Galv are in your plans to make a grid inventory system at some point? just curiosity

  2. Farbulon says:

    Hello Galv. First I want to thank you for this awesome plugin. It allows a lot of new options (e.g randomly spawning treasures in dungeans). However it seems to be incompatible to TerraxLighting. After a few seconds ingame, I become the following error: ‘TypeError – Cannot read property ‘note’ of null.’ Switching the order of plugins doesn’t help. Is there a way to make both of them compatible?

    • Galv says:

      Had a quick look, the TerraxLighting plugin references the stored $dataMap events and not the existing $gameMap events. So the two plugins are not compatible, but I would try asking Terrax.

      • Farbulon says:

        I see. Fortunately I found an alternative plugin that works fine with yours. Thanks for your quick reply.

  3. Pep says:

    Seems you can’t set variables and then set the events position based on said variables. What I’m tyring to do is have events spawn at player X and Y, but it only spawn in the place suggested, despite an event transfer being use after that but before it executes any of the routes. Using ‘this event’ works for moveroutes, but it doesn’t for event transfer.

    • Galv says:

      To spawn at player location you could use:

      • Klunk says:

        Hello, I have a problem I cannot use any javascript commands like: Galv.SPAWN.event(1, $gamePlayer.x, $gamePlayer.y, true); It just doesn’t want to work. I don’t know why.

      • Galv says:

        Please provide more details. “Just doesn’t want to work” doesn’t help diagnose the issue.
        Does it crash? If so, when? What’s the error (and screenshot of F8 console would help).

        Are you using the ‘Script’ event command (Not the ‘Plugin’ event command)?

        Here’s a list of error trapping ideas:

  4. Pep says:

    Think you could add support for spawning dependant based on two variables? I’d wanna have things be spawnable at an events location, too.

  5. Galv says:

    Could you please tell me the steps you took to encounter the bug? I have just tested saving and loading and cannot replicate this issue.

    Please make sure to have the latest version also

    • Pep says:

      I go into your demo.

      I open the menu and save the game.

      I load the game and try to spawn stuff, which worked before the fact, it doesn’t now. :0

      Unless turning ‘Galv.SPAWN.overlap = ‘all’;’ makes a difference?

      Demo I have is the 1.1 version.

  6. Galv says:

    I cannot replicate what you are talking about at all.
    Did you change anything in the demo before you saved it and then tried loading it?

    I have uploaded a v.1.2 demo but the only thing it has changed is compatibility with an upcoming plugin. Download that and see if it works.

    If not, are you able to create a video of the issue?

    • Pep says:

      Well, the demo worked, but it didn’t work in my game, but I think I found the culprit, and have made a video as suggested.

      Here’s the script I believe may be incompatible.

      • Galv says:

        You said it happened specifically in my plugin demo and had me spending a lot of time trying to replicate it. Whyyy :(

        Please try to replicate the bug in my demo. For example if you think it’s that collision detection plugin conflicting – put it in the plugin demo (with no other plugins) and do some tests to confirm.

        Unfortunately, you crazy monkey, I don’t have time to error trap your game to see if it is a bug in this plugin or not, sorry.

  7. Pep says:

    This bug is very strange. It also appears to occur in my project when a new map is loaded, I’ve checked this script in your project with both YEPy_coreEngine and my collision detection script in and it seems to be okay, that said, I haven’t attempted to check a collision, but that’s redundant seeing as in mine no collisions may be being checked, the events just don’t spawn.

    I’m going to have to do a more thorough analysis on all this, if I find the problem, I’ll letchu know.

  8. Vectorinox says:

    This plugin has amazing potential! So the event can be spawned on random tile on a region. Is it possible for the script to check if there’s already an event on the tile? Then it will select another random tile on the region to spawn the event.

    • Galv says:

      It already does that if you haven’t changed the default:
      Galv.SPAWN.overlap = ‘none’;

      • Vectorinox says:

        Oh, didn’t notice that. I was using;
        for (var i =0; i<6; i++){ Galv.SPAWN.event(11,5); }
        to spawn 6 events at once, but sometimes it spawns less than that. Does this script consider an event still occupy a tile even after it is erased?

  9. Galv says:

    You could test it out to see :)

  10. Hello Galv, thanks for the plugin!
    I have just a problem: i cannot make the event spawn in the right region… if i use the script command ” Galv.SPAWN.event(id,r,s);” the “r” it is considered like x position, so the event is always spawned at x(r), 0. Any ideas about this?
    Thanks again, have a nice day!

    • Galv says:

      Please don’t ask me the same question in multiple places :(

      • I am really sorry about this!
        However i tested it in my game (both in a game with other plugins either with a blank test) and i noticed that this happens when you set the event temporary, that is “false”: with that the region ID is not considered and it is spawned at x,0. I hope it helps!
        Have a nice day!

      • Galv says:

        If you can take a screenshot of your setup or post the exact script call you used it would help

  11. Galv says:

    Updated to version 1.4 correcting incorrect information in the help file

  12. StyX92 says:

    Hey galv, if i spawn a enemy that will have a move route and shoots with your map projectiles, than it will not shoot.
    I dont know where i have to post it, here or at your map projectiles, but its unimportant :D

    • StyX92 says:

      Hmm mabye not your fault. The selfswitch script will not trigger, if the event spawns with your event spawner.

      • Northnroro says:

        This is because of a bug of this plugin. I found that this plugin does not fully support self-switch. When spawning a new event, its self-switch might be wrong (initialized as the same value as the previously spawned event).

        This is because ‘Game_Map.prototype.spawnEvent()’ does not reset the self-switches. To fix this, just add the below lines after ‘this._events[eId] = new Game_SpawnEvent(this._mapId,eId,x,y,id,save);’.

        $gameSelfSwitches.setValue([$gameMap.mapId(), eId, ‘A’], false);
        $gameSelfSwitches.setValue([$gameMap.mapId(), eId, ‘B’], false);
        $gameSelfSwitches.setValue([$gameMap.mapId(), eId, ‘C’], false);
        $gameSelfSwitches.setValue([$gameMap.mapId(), eId, ‘D’], false);

      • Galv says:

        I cannot seem to replicate what you are describing – can you please give a scenario when this issue would occur?

  13. Mike says:

    Looks like it does not work with “build & decod”, too bad for me :(

  14. Psycoris says:

    This is quite excellent, I do have a question though what is the difference between your scripted Unspawn vs the Erase event?

    • Galv says:

      If you spawn an event permanently to a map, erase event won’t unspawn it. Erase event doesn’t delete an event, it just erases it while the player is on the map. If the player leaves and returns the event will also return.

  15. Psycoris says:

    Not sure if I am missing something. I am attempting to use another event to delete one of the created events. I attempted to use this ” Galv.SPAWN.unspawn($gameVariables.value(4));”

    I have the spawned event load its event ID into the variable 4 when it gets created. I am assuming there is no way to know what the event ID is ahead of time before creation if multiples are spawned and despawned.

    I am getting an Undefined error though. Not sure if there is a work around.

    • Psycoris says:

      I know just enough to get myself into trouble.
      I pulled your script and found $gameMap.unspawnEvent(eId);

      This works like a champ to unspawn the event. But I don’t know how to refresh or update the screen without opening a menu.

    • Galv says:

      The script call is:
      Galv.SPAWN.unspawn(this); // Unspawns event code is executed in.

      You cannot use a number in it. As you said, you can’t tell what the event id’s are, you need to run the code from within the event itself.
      I didn’t take into account doing this using an id.

      • Psycoris says:

        I finally found a work around for anyone that might have had the need.

        Set the first page of the event to be spawned as a parallel process and set a “control variable > script” = this._eventID. Toss a self switch in to stop the Parallel process. Then set up the normal function of the event on the new self switch page.
        Now with any event (beware with common events though) on the same map you can call the script:

        $gameMap.unspawnEvent($gameVariables.value(the variable number you set in the event)); //this deletes the event
        SceneManager.goto(Scene_Map) //this redraws the scene

  16. Yo Galv, I know your script probably wasn’t designed with hectic systems like an ABS in mind, but there’s a bit of an error.

    Basically I have another script called Collision_detection.js which was made to my specifications, what I do is spawn in projectiles from a spawn map and then check if either batch id [pick a number] collides with the player, or with another batch id.

    This works fine if the event is merely erased afterwords, however, using your unspawn method makes it error and the collisions after the first don’t work, my theory is that it’s destroying the presence of a batch ID rather than just the event.

    unspawn.this is important because if I use erase event the events stay on the map, result is even though they just become uninteractive and invisible, the pile up leads to a memory leak. This exact behavior can be witnessed in Perseverance: Full Clearance.

    Here’s the collision_detection.js script:
    and this is the error I get when galv_unspawn(this) or whatever is used.

    Hope this helps! Hopefully you can find the time to fix.

    • Galv says:

      You are right, this plugin wasn’t designed for that and unfortunately I don’t have any time to modify it.

      I do, however, have a projectile plugin that might be of interest that does not use events to create projectiles.

      • I’ve looked into that, but it doesn’t have the level of flexibility this does. If you can’t find time to fix it, it’s not the end of the world. Means I either make sure I don’t allow too much event bloat to happen or I get another coder to fix it.

  17. John Doe says:

    Hey Galv

    I set up a parallel spawn point and I notice it wont spawn if the player ism more then 14 tiles away from the event?

    is this by design? or is it rpg maker not having loaded that part of the map yet?

    • Galv says:

      If it’s a parallel process, I think it should work. I’ll have to try that out.

      If you’re doing it within a move route then that’s an rpgmaker lag reduction thing.

  18. itsMiatch says:

    Hello! I’ve had a five-minute look around and I can’t find what I’m looking for.
    I was wondering if you were able to spawn lots of the same event on a specific Region ID? I want to have lots of coin pickups on my map without filling it with events.
    Thanks for any help.

  19. vectorinox says:

    Found a bug. When I use show animation to play animation on the spawned event, then run unspawn.this before the animation finish playing. The animation particles got stuck and suspended on the screen. Any way you could fix this?

  20. Rinku says:

    I believe I’ve found a compatibility issue with Mr Trivel’s Event Names script:

    When I have their script turned on, I get a “TypeError: Cannot read property ‘parent’ of null”, but when I turn it off, your script functions well (so far).

    The command I’m using is:

    • Galv says:

      If you have tested this in a fresh project with just the two plugins, tried them in different orders and made sure all script calls are correct, I recommend asking Mr Trivel.

  21. Fenc says:

    Can’t seem to get Set Event Location to work after spawning any events. This is a fresh project with only this plugin on it. (the parallel trigger is just for testing purposes)

    spawns — > Galv.SPAWN.event(10,0,0,true);
    “random” variable set to Math.floor(Math.random()*$dataMap.width)
    “random2” variable set to Math.floor(Math.random()*$dataMap.height)


    Reason why I do not just add the variable to the spawn script call is because I need it to be able to repeatedly go to random locations.

    • Fenc says:

      I believe it has to do with the fact that set event location when being used specifies a coord of current map (being the spawn map) but the event is being spawned in a different map.

    • Fenc says:

      Further testing shows that if the event moves after spawning, the set event location defaults to where you spawned the event (i.e. I spawn event at coord 5,5 and it moves at random then I trigger said event which has set event location to 0,0, it’ll teleport to 5,5 rather than 0,0)

      I tested this using the chickens in the demo

  22. Fenc says:

    To clarify Set Event Location with spawned events

    • Galv says:

      I’ll have a look into this when I get some time.

      • Fenc says:

        Found a workaround that looks very bad. Setting both event._x/y and event._realX/Y to the coords I want teleport it. However, I don’t know what problems directly changing that would cause. Either way looks bad.

      • Galv says:

        I’ll have a look into this when I get some time… I have not had time yet.

      • Fenc says:

        didnt mean the problem looked bad, i meant the workaround looked bad

      • Galv says:

        I assume you are spawning and event and saving it and that’s why you want to run a new command to set it’s location?
        Could you spawn the event every time the map loads and use the variables in the script call to spawn it then?

      • Fenc says:

        Its a monster that routinely teleports within the map as an ability so it would have to move locations while the player stays in the same map. Is this an engine limitation? I couldnt find any way to enable set location by looking at the source code as well.

      • Galv says:

        I don’t think so – I believe I just have to update the plugin so that the set event location event command works correctly for the event

  23. Alex says:

    This Plugin is exactly what i hoped to find when i searched for something that can put events on the map WITHIN the game itself.
    I’m working on an own Plugin, that requries event spawning in order to easly create a bridge. I made a spawn map, created an event, set the image to a bridge part and set priority on “below character” and made sure that passage settings on said tile were correct.
    Then I tried and failed. It seems despite successfully creating the event above unpassable terrain, the player cant walk on it. So i made some experiments and found out, that a simple $gameMap.requestRefresh() at the end of your Galv.SPAWN.event() function has fixed my problem.

    I thought i should share this information with you.

    Thanks for the Plugin, really made my day.

  24. Cameron says:

    Hi Galv, I’m making a Zelda game, and I want to make it so when I hack down a bush, items randomly drop. I managed to get random items to drop but is there a way I can make an event spawn at the same location as the bush? Because there are so many bushes in the game I don’t want to have to set an individual coordinate for every bush… Thanks

    • Galv says:


      you need to get the x,y value of the event you want. I recommend asking in a forum how to do this and will depend on where you are running the code.

      • Cameron says:

        Hi, I know that part but since there are tons of bushes on every map I’d have to open every bush event and make the item spawn on the X,y of that bush… What I’m asking is if there’s a code similar to the code to spawn on player to make it spawn on “this event” since the code is written from the bush event itself.

      • Galv says:

        I know what you are asking and I’m suggesting ask that in a forum because someone will be able to tell you the “this event” code. I cannot at this time. :(

  25. Sakyawira Nanda Ruslim says:

    May I use this in a game jam ? This is only for education purpose though :D

  26. Sarcastic Sloth says:

    Hi Galv! I just recently found this and it works really well. Thank you for making it. I am trying to use it with another plugin called ‘Alpha ABS,’ an action battle system. For the ABS to work, the events on the map need to have note tags. Does your event spawner copy the note tags of the events it spawns? I ask because I am having trouble getting these two plugins to work together.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s