Galv's Event Spawner

Discussion in 'JS Plugin Releases (RMMV)' started by Galv, May 15, 2016.

    Tags:
  1. Galv

    Galv Veteran Veteran

    Messages:
    1,178
    Likes Received:
    1,115
    Location:
    Australia
    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
    [​IMG]


    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". [​IMG]


    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: Jul 1, 2017
    #1
    Shugo, Volis, Quite.Toxick and 2 others like this.
  2. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    817
    First Language:
    English
    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
     
    #2
  3. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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?
     
    #3
  4. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    817
    First Language:
    English
    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.
     
    #4
  5. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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.
     
    #5
  6. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    817
    First Language:
    English
    You just use the event id. Script command examples are in the help documentation for the plugin.
     
    #6
  7. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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.
     
    #7
  8. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    817
    First Language:
    English
    Post screenshots of your setup
     
    Last edited by a moderator: Jul 25, 2016
    #8
  9. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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
     
    #9
  10. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    817
    First Language:
    English
    It looks perfectly setup, so getting an error is strange.


    Are you using any other plugins? Try turning some off.
     
    #10
  11. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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.
     
    #11
  12. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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.
     
    #12
  13. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    817
    First Language:
    English
    I'm not getting any error with YEP mini label. Did you do anything special with it?
     
    Last edited by a moderator: Jul 25, 2016
    #13
  14. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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.
     
    #14
  15. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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.
     
    #15
  16. Galv

    Galv Veteran Veteran

    Messages:
    1,178
    Likes Received:
    1,115
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    N/A




    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
     
    #16
  17. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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.
     
    #17
  18. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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.
     
    #18
  19. Galv

    Galv Veteran Veteran

    Messages:
    1,178
    Likes Received:
    1,115
    Location:
    Australia
    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.
     
    #19
  20. Skurge

    Skurge " (GASP) What's going on!? " Veteran

    Messages:
    1,052
    Likes Received:
    206
    Location:
    Australia
    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.
     
    #20

Share This Page