MV Event Spawner

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.

VERSION 1.7 – RPG Maker MV
Download Plugin file
Download Demo

Advertisements

57 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.

  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.
      https://dl.dropboxusercontent.com/u/37043775/Collision_Detection.js

      • 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

  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);
      $gameMap.unspawnEvent($gameVariables.value(4));

      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. https://www.youtube.com/watch?v=NSteqOVUf68

    Here’s the collision_detection.js script: https://drive.google.com/open?id=0B2CvOYXTy9fkVmFQbXREN2tENlk
    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: https://mrtrivelrpg.wordpress.com/2016/02/14/above-event-names-pictures-icons/

    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.SPAWN.event(num,reg);

    • 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)

    event10: http://imgur.com/a/QZOTP

    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.

  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

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s