Ritter Ultimate Event Spawner (RPG Maker MZ)
A downloadable RPG Maker MZ Plugin
An event spawner allows you to create a new event on the game map by creating a copy of a template event located on another map. This spawner reuses unspawned events to allow for more freedom to spawn even more events.
Demo now available!
Event Spawner which recycles unspawned events!
This event spawner will automatically recycle unspawned events before spawning a new event. This greatly(completely if used properly) decreases performance loss over time due to event clutter. This spawner should never encounter framerate drops if used properly.
Ultimate Event Spawner Features:
- Use as many spawn/template maps as you wish to hold your spawnable events.
- Spawn an event from a spawn map onto the game map using x,y coordinates or regionId(s).
- Spawning an event onto a regionId will pick a random tile marked with regionId(s) specified to spawn the event on.
- Save spawned events. Saved events will re-appear when the player re-enters the map.
- Restore unspawned saved events exactly as they were before they were unspawned and/or on map change, retains current event page and eventId.
- Transform events on the game map using events on another map as a template.
- Complete compatibility with Ritter_BoundarySystem plugin allowing the spawning and unspawning of events on boundaries you create using script calls.
Click here to Purchase Ritter Ultimate Event Spawner & Ritter Boundary System Bundle and save!
Major Update v1.5! (Aug 20, 2021)
With version 1.5 of Ritter Ultimate Event Spawner comes Plugin Commands, New Features for Spawner Boundary System, a bug fix, and more!
- Added Plugin Commands for Spawner & Spawner Boundary System for ease of use.
- Added Automatic Boundaries which Spawn/Unspawn events automatically based on conditions set by the developer.
- Added Saved Boundary Events!
- Added Develoepr Mode Warning Alerts! This will pop up a warning if the developer makes a common mistake with information on what was wrong and a suggestion on how to fix the problem instead of crashing the game. (Work in progress, will expand more soon. Did not want to delay this update for this.)
- Added Helpful Info Text throughout Plugin Code to help developers find what they need and make edits easier without as much guess work.
- Fixed an issue with recycled event sprites not being removed completely.
Install Instructions! |
Follow the Instructions below to Install the Plugin. |
Download the plugin file and place it inside your projects js/plugins folder.
Add Ritter_EventSpawner plugin to your projects plugin manager.
Place below Ritter_BoundarySystem when using Boundary System + Spawner.
Configure the parameters to fit your needs.
Create a new map to use for holding your source/template events to be used by the spawner to copy onto the game map. Create your events on the new map.
Play test and try the script calls and/or Plugin Commands below!
Script Calls & Plugin Commands! |
Script Call and Plugin Commands Info! Plugin Commands Added in v1.5! |
Ritter.spawnEvent(mapId, eventId, x, y, save)
- mapId = the Id or "Name" of the map which holds the event you want to spawn.
- eventId = the Id or "Name" of the event on the map specified in mapId.
- x = x coordinate to place the event on the game map.
- y = y coordinate to place the event on the game map.
- save = true to save event and respawn it when you re-enter map.
- save = false to use the event as a temporary event which goes away on map change. You can leave out save from script call to not save the event.
Example script call:
Ritter.spawnEvent(42, 15, 8, 16, true)
Would spawn event 15 from map 42 on the game map at 8,16 coordinates and save the event data to automatically be respawned upon re-entering the map.
Example script call two:
Ritter.spawnEvent(42, 15, 8, 16)
Would spawn event 15 from map 42 on the game map at 8,16 coordinates as a temporary event that goes away on map change.
Example script call three:
Ritter.spawnEvent("SpawnMap", "Slime", 8, 16)
Would spawn the event named "Slime" from the map named "SpawnMap" onto the game map at 8,16 coordinates as a temporary event that goes away on map change.
If duplicate names are found only the first one will ever be used, avoid duplicating names for spawn maps and spawn template events.
Ritter.spawnEventRegion(mapId, eventId, regions, save)
- mapId = the Id of the map which holds the event you want to spawn.
- eventId = the Id of the event on the map specified in mapId.
- regions = regionId(s) to place the spawned event on randomly. To use multiple regionIds to randomly pick from list them like this [4,8,15,16,23,42]
- save = true to save event and respawn it when you re-enter map.
- save = false to use the event as a temporary event which goes away on map change.
Example script call:
Ritter.spawnEventRegion(4, 8, 15, true)
Would spawn event 8 from map 4 on a random tile marked with regionId 15 and save the events data to be automatically respawned upon re-entering the map.
Example script call with array of regions:
Ritter.spawnEventRegion(4, 8, [15,16,23,42])
Would spawn event 8 from map 4 on a random tile marked with any of the regionIds 15,16,23,42 as a temporary event that isn't saved.
Ritter.transformEvent(eventId, mapId, spawnId)
- eventId = id of the event on game map to transform.
- mapId = spawn map id that has template event.
- spawnId = id of event on spawn map to use as template.
Example Script call:
Ritter.transformEvent(1010, 4, 8)
Would transform event 1010 into event 8 from map 4.
Ritter.unspawnEvent(eventId, removeSave)
- eventId = the Id of the event on the map to unspawn.
- removeSave = true to remove the event from saved events.
- removeSave = false to keep the event on save list to respawn upon re-entering the map. Leave removeSave empty to keep saved event.
Example script call: Ritter.unspawnEvent(1000, true)
Would unspawn event 1000 from the game map and delete the saved event data.
Example script call two: Ritter.unspawnEvent(1000)
Would unspawn event 1000 from the game map.
Ritter.unspawnEvent(x, y, removeSave)
- x = x location to check for an event to unspawn.
- y = y location to check for an event to unspawn.
- removeSave = true to remove the event from saved events.
- removeSave = false to keep the event on save list to respawn upon re-entering the map. Leave removeSave empty to keep saved event.
Example script call: Ritter.unspawnEvent(15, 16, true)
Would unspawn event found at 15, 16 from the game map and delete the saved event data.
Example script call two: Ritter.unspawnEvent(4, 8)
Would unspawn event found at 4, 8 from the game map.
Ritter.unspawnAll(removeSave)
- removeSave = true to delete saved event data.
- leave empty to retain saved event data.
Unspawns all spawned events on the map.
$gameMap._lastSpawnEventId
Returns the Id of the most recently spawned event.
Boundary System & Spawner! |
The Boundary System plugin allows for the spawning and unspawning of events on or within boundaries you create using a simple script call (or refer to Automatic Boundaries section for the easiest solution for boundary spawning yet!). The boundaries are stored and later accessed using the name you gave your boundary. You can create as many boundaries as you wish.
Boundaries can be created around the player, around any event on the map, or around an x,y location on the map. This allows for the spawning of events in many creative ways including spawning enemies just outside of the players screen constantly, or at any pace you find that fits well in your game.
Easily limit the number of events that each boundary is allowed to spawn to prevent spawning too many events on the map and causing performance loss, when a boundary is limited to spawning 40 events it will only ever use 40 events at once, if any of the boundary events are unspawned in the unspawn boundary that frees up space for more events to spawn on the boundary.
Read the description of the script calls below to understand how the boundary system and Event Spawner work hand in hand to create a unique experience within your game.
New Automatic Boundaries Setup!
- v1.5 Added August 20, 2021
Automatic Boundaries takes what was once a complicated task which required you to learn a lot of parameters in script calls and place them inside common events or whatever method you went for and spam the script call with a wait timer. That method is history! (But still works)
Setting up Boundaries, getting them to run, and setting up the events to be spawned on boundaries has been simplified!
Follow the instructions below for quick setup! See the Help Section below this section for further information on plugin commands.
First lets set up an odd-ball boundary. We'll go for a 3x3 Spawn Boundary around the player with a 5x5 Unspawn Boundary around the player. This will make it so as the player moves from tile to tile the player will always be surrounded by events which unspawn as the player moves away from them. Combining boundaries like these with saved boundary events would allow you to do a lot of different things as you can theoretically have an event on every/any valid passable tile, no matter the size of your map.
Lets take a look at the new method of setting up boundaries!
First we Create a Boundary and Add an AutoHandler to it.
Lets start with the 3x3 'FillIn' Boundary:
Now we have a Boundary Named "Player FillIn" that is 3x3 around the player (Event Id 0) which can spawn 11 events. I like to give a little extra room here than a 3x3 requires to ensure proper wiggle room.
Now that we have our Boundary Created lets add an Auto Handler to it! We'll use the Boundary Name we just created above for this plugin command as shown below.
Now our Boundary will run automatically when on maps 3, 4, and 5. The boundary will attempt to spawn an event on every open tile within the 3x3 Boundary every 4 frames and it's enabled by default.
Next lets set up an Unspawn Boundary which can unspawn events on a boundary 1 tile outside of our spawn boundary. So as the player walks the events he/she walks away from will unspawn.
For this we'll go with a 5x5 "UnspawnOn" Boundary around the player.
You may notice Max Events 30 is set, 30 is the default and max events is not used by unspawn boundaries so any value there is fine.
Now lets add our Auto Handler for the 'Player UnspawnOn' Boundary.
Spawn Map Id is not needed here but I typically provide any preloaded spawn map just to be proper.
Before we get into a summary of what we did there's the Unspawn Settings to look into for Auto Handler.
In unspawn settings if the boundary is to be enabled as an Unspawn Boundary just Enable it in the settings then specify target boundaries this unspawn boundary is allowed to unspawn events from. If you spawn events on a boundary named "Player FillIn" then you must include "Player FillIn" on this list for unspawns if you want the boundary to unspawn events from that boundary.
Now we have a boundary which spawns events in a 3x3 boundary around the player named "Player FillIn" and a 5x5 Unspawn Boundary around the player which unspawns any event which was spawned by boundary "Player FillIn" that passes into a tile on the boundary.
Now that we have our boundaries set up it's time to set up events to spawn on the boundary!
Lets go to our spawn map and create an event with the Plugin Command 'BoundaryEventSetup' on its first page.
Now that we have this plugin command on the first page of an event on Spawn Map 2 (The Spawn Map we specified when we created our spawn boundary). Our boundary will be able to see it and spawn it if it's enabled and a valid tile is found.
For more information on this plugin command see the Help Section below.
*Note: This plugin command does not run any code so it will not interfere with your event. This plugin command is parsed by the spawners boundary system code for data. It functions about the same as a Comment*
After you set up your Boundary Events on the Spawn Map you should be good to go.
Simply test your game and run the event which creates the boundaries and adds the auto handlers. If your boundaries are enabled by default, you are on a valid mapId, you have valid RegionIds nearby, and if your events you created are enabled by default, then you should see your events spawning around the player and unspawning as you walk away from them.
Events are visible so you can see what's happening. For a boundary like this you may want them invisible but allow player to interact in some way with them. The sky's the limit!
Boundary System Plugin Commands and Script Calls:
Ritter.Boundary.createSpawnerBoundary(width, height, thickness, name, eventId, expandBy, maxEvents, centerx, centery)
This is the script call to create your boundary, or boundaries.
width = the number of tiles wide your boundary is.
height = the number of tiles high your boundary is.
thickness = the number of tiles thick your boundary is.
name = the "name" of your boundary to be used later when spawning/unspawning on this boundary.
eventId = use 0 if creating a boundary around player, use an eventId if creating a boundary around an event, or use -1 if creating a boundary around an x,y location, and set the x, y location as shown below.
expandBy = the number of tiles the boundary expands its thickness by in the direction of the players movement. This helps increase the odds that events will spawn in front of the player while the player is moving as opposed to the sides and back, helping to ensure that the player has higher odds of encountering enemies in the direction the player is moving.
maxEvents = the number of events the boundary is allowed to spawn, use this to manage the total events on the map to prevent event clutter and performance loss.
centerx = only use centerx if spawning on an x,y location. centerx = the x location of the center of the boundary. leave out of the script call completely if spawning on player or event.
centery = only use centery if spawning on an x,y location. centery = the y location of the center of the boundary. leave out of the script call completely if spawning on player or event.
Example Script calls: Ritter.Boundary.createSpawnerBoundary(11, 11, 1, "spawn", 0, 2, 30)
This would create a boundary of 11 tiles width and height around the game player with 1 thickness which is named "spawn", the boundary will expand by 2 tiles in the direction the player is moving and have a maximum of 30 events it can spawn.
Ritter.Boundary.createSpawnerBoundary(15, 15, 1, "unspawn", 0, 0, 0) This would create a boundary of 15 tiles width and height around the game player with 1 thickness which is named "unspawn", the boundary will not expand in the direction the player is moving and will not be able to spawn any events.
Ritter.Boundary.createSpawnerBoundary(5, 5, 2, "eventBoundary", 50, 0, 5) This would create a boundary of 5 tiles width and height around event 50 with 2 thickness which is named "eventBoundary", the boundary will not expand and is limited to spawning 5 events maximum at a time.
Ritter.Boundary.createBoundary(5, 5, 1, "xyBoundary", -1, 0, 20, 50, 50) This would create a boundary of 5 tiles width and height around coordinates 50,50 on the game map which is named "xyBoundary", the boundary will not expand and is limited to spawning 20 events at a time.
Ritter.Boundary.addAutoHandler(name, spawnMap, maps, type, wait, enabled, boundaries)
This new Feature allows the developer to abandon manually calling the spawn/unspawn boundaries and instead allows the developer to run them automatically! Simply Create your boundary and add an Auto Handler to it. Then set up your spawn events as explained in the next section. Easily Enable/Disable each Boundary with a plugin command or script call!
- name = The "Name" of the boundary you wish to run on auto mode.
- spawnMap = The Id of a SpawnMap to pull events from.
- type = The Type of Boundary you wish to run.
- "SpawnOn" = Spawn Events on the Boundary Edge.
- "SpawnIn" = Spawn Events within a Boundary.
- "FillOn" = Spawn Events on every tile along the edge of a Boundary.
- "FillIn" = Spawn Events on Every tile within a Boundary.
- "UnspawnOn" = Unspawn Events on the Boundary Edge.
- "UnspawnIn" = Unspawn Events within a Boudnary.
- wait = The number of frames to wait between boundary actions. Spawn/Unspawn calls.
- enabled = Whether the Boundary is Enabled by Default or Not.
- boundary = [Array] of "Strings"- Only required for Unspawn Boundaries. This tells the Unspawn Boundary which Spawn Boundaries it is allowed to unspawn events from. It will check this array of "Boundary Name" strings against the events parentBoundary.
Boundary Event Setup
No Script Call for this Plugin Command as it is only parsed by Spawner Boundary System Code for Data.
This Plugin Command must be placed on the first page of every Event on a Spawn Map which is used for Auto Boundaries. It executes no code and is essentially the same as a Comment.
- Boundary List = A List of Strings containing Boundary Names 'this' event may spawn on.
- Map List = A List of MapIds 'this' event may spawn on.
- RegionId List = A List of RegionIds 'this' event may spawn on.
- Enabled By Default? = Whether spawning this Event is Enabled or Disabled by default. Can be toggled on/off with a plugin command.
- Saved Event? = Whether the event is saved or not. Will respawn if tile passes through a valid spawn boundary (The Boundary which spawned 'this' event).
- Saved Events work differently for Boundary Events than they do for Regular Spawned Events. The only difference would be the eventId does not remain the same for Saved Boundary Events, everything else will remain exactly as it was on Unspawn or Map Change. If Saved Boundary Events are allowed to retain EventIds this would allow for too many events to stack up on the map and cause performance loss, therefor we Recycle those Unspawned Saved Boundary Events while they're not being used. If you must retain the same eventId ,for some reason, then that specific event should be spawned regular and not by boundary.
Ritter.Boundary.initBoundaryEvents(boundaryName)
- boundaryName = The "Name" of the boundary you wish to initialize.
Initializing a boundary is only required if you wish to Pre-Load all events within a boundary on map load. If your boundary type is "SpawnIn" or "FillIn" this plugin command does not need to be applied.
If you use "SpawnOn" or "FillOn" boundaries you may wish to initialize all nearby saved events so they are loaded when the player loads into the map. To accomplish this simply place this Plugin Command on an AutoRun event that erases itself after running its commands.
This method may be deprecated in the future if I can find a proper spot in MZ code to call this which doesn't crash the game xD
Ritter.Boundary.activate(boundaryName)
- boundaryName = The "Name" of the boundary you wish to activate.
This command turns on a specified boundary. By turning on a boundary it allows the boundary to Spawn or Unspawn events as long as the conditions are met which allow this boundary to Spawn or Unspawn events.
Conditions such as: Player is on proper map. A valid RegionId is within/on a boundary. There are enabled events for a nearby valid tile with.
Ritter.Boundary.deactivate(boundaryName, unspawnAll)
- boundaryName = The "Name" of the boundary you wish to activate.
- unspawnAll = true/false - Whether or not all events spawned by this boundary are unspawned when boundary is deactivated. (Turned OFF).
This command turns off a specified boundary. By turning off a boundary it stops running entirely. It will not spawn or unspawn any more events on any map until it is activated again.
Ritter.Boundary.enableEvent(spawnMap, eventId)
- spawnMap = The MapId of a SpawnMap.
- eventId = The EventId of an Event on a Spawn Map which you want to Enable.
Enabling an event allows the event to be spawned by the Auto Boundary system. If you set an event to be disabled by default and want the event to be later turned on somewhere in your game then this is the command you'll need to call when that spawn event should be enabled. Only Enabled events may be spawned by the auto boundaries.
Ritter.Boundary.disableEvent(spawnMap, eventId)
- spawnMap = The MapId of a SpawnMap.
- eventId = The EventId of an Event on a Spawn Map which you want to Disable.
Disabling an event will make it no longer be spawned by any boundaries. Be advised that any saved events made from this event will still be restored despite being deactivated. No new spawns.
Ritter.Boundary.editSpawnerBoundary(boundaryName, param, value)
- boundaryName = The "Name" of the boundary you wish to edit.
- param = the property you wish to edit.
- value = the value you wish to set the property to.
When editing the properties of a Boundary using the Plugin Command leave the properties you wish untouched as 'undefined'. If you set a value for any property that value will be applied. 'undefined' values are ignored.
Please be advised that changing the width/height of unspawn boundaries may cause some boundary events to remain outside of the unspawn boundary. (Unspawn boundary can miss some events if shrunk, leaving events on the map that aren't unspawned. Be careful when resizing Unspawn boundaries)
Param list:
*When using Script Call Use "strings" as param value.*
"width" - sets new width property for the boundary.
"height" - sets new height property for the boundary.
"thickness" - sets new thickness property for the boundary.
"expandby" - sets new expandBy property for the boundary.
"centerx" - sets new centerx property for the boundary.
"centery" - sets new centery property for the boundary.
"maxevents" - sets new maxEvents property for the boundary.
"waittime" - sets new wait time for automatic boundary.
Example script calls:
Ritter.Boundary.editSpawnerBoundary("spawn", "width", 25)
Ritter.Boundary.editSpawnerBoundary("spawn", "height", 17)
These calls would set the width of "spawn" to 25, and the height of "spawn" to 17.
Ritter.spawnEventOnBoundary(mapId, eventId, regions, boundaryName)
- mapId = The mapId of the spawn map which holds your template/source event to be copied to game map.
- eventId = The eventId of the template/source event to be copied to the game map.
- regions = The region Ids to use for spawning events on. List as an array to use multiple regionIds. [1, 2, 3]
- boundaryName = The "name" you gave your boundary that you wish to spawn on.
Example Script call using boundary created above: Ritter.spawnEventOnBoundary(4, 8, [15, 16], "spawn")
This would spawn event 8 from map 4 on a random tile marked with regionIds 15 or 16 that pass through the boundary named "spawn".
Ritter.spawnFillOnBoundary(mapId, eventId, regions, boundaryName)
- mapId = The mapId of the spawn map which holds your template/source event to be copied to game map.
- eventId = The eventId of the template/source event to be copied to the game map.
- regions = The region Ids to use for spawning events on. List as an array to use multiple regionIds. [1, 2, 3]
- boundaryName = The "name" you gave your boundary that you wish to spawn on.
Example Script call using boundary created above: Ritter.spawnFillOnBoundary(4, 8, [15, 16], "spawn")
This would spawn event 8 from map 4 on every tile marked with regionIds 15 or 16 that are along the edge of the boundary named "spawn".
Ritter.spawnEventInBoundary(mapId, eventId, regions, boundaryName)
- mapId = The mapId of the spawn map which holds your template/source event to be copied to game map.
- eventId = The eventId of the template/source event to be copied to the game map.
- regions = The region Ids to use for spawning events on. List as an array to use multiple regionIds. [1, 2, 3]
- boundaryName = the "name" you gave your boundary that you wish to spawn on.
Example Script call using boundary created above: Ritter.spawnEventInBoundary(4, 8, [15, 16], "spawn")
This would spawn event 8 from map 4 on a random tile marked with regionIds 15 or 16 that is within the boundary named "spawn".
Ritter.spawnFillInBoundary(mapId, eventId, regions, boundaryName)
- mapId = The mapId of the spawn map which holds your template/source event to be copied to game map.
- eventId = The eventId of the template/source event to be copied to the game map.
- regions = The region Ids to use for spawning events on. List as an array to use multiple regionIds. [1, 2, 3]
- boundaryName = the "name" you gave your boundary that you wish to spawn on.
Example Script call using boundary created above: Ritter.spawnFillInBoundary(4, 8, [15, 16], "spawn")
This would spawn event 8 from map 4 on all tiles marked with regionIds 15 or 16 that are within the boundary named "spawn".
Ritter.unspawnEventOnBoundary(boundaryName)
- boundaryName = the "name" you assigned to the boundary you wish to use for unspawnEventOnBoundary.
Example Script call using boundary created above: Ritter.unspawnEventOnBoundary("unspawn")
This would unspawn any events located on the boundary "unspawn".
Ritter.unspawnEventInBoundary(boundaryName)
- boundaryName = the "name" you assigned to the boundary you wish to use for unspawnEventOnBoundary.
Example Script call using boundary created above: Ritter.unspawnEventInBoundary("unspawn")
This would unspawn any events located within the boundary "unspawn".
Terms of Use:
- You are granted non-exclusive rights to use this plugin for Commercial and Non-Commercial Use in as many projects as you wish to create.
- Do not redistribute this plugin without permission.
- Do not take code from this plugin without permission.
- Do not remove my name from @Author.
- Do not take credit for creating this plugin.
- Editing of code is allowed as long as it's within plugin file.
- I do not offer support for any changes made to plugin code.
- While it's not mandatory please consider crediting me in your game credits:
- (Something similar to this would be great)
- Ultimate Event Spawner Plugin
- Craig "Ritter" Barger
Version Log:
- 1.0: Released Plugin.
- 1.1: Discovered, Isolated, and Fixed a rare crash relating to unspawning an unspawned event and then changing scenes.
- 1.2: Added spawning events by "SpawnMapName" & "EventName".
- Added unspawning events by x, y location.
- Added ability to easily edit boundary properties.
- Added new boundary script calls for filling boundaries with events.
- Added unspawnEventInBoundary script call.
- 1.5: Added Plugin Commands for Event Spawner.
- Added Plugin Commands for Boundary System.
- Added Automated Boundaries.
- Added Saved Boundary Events.
- Added Developer Mode Warning Alerts. (Work in Progress)
- Added Info Text Throughout Plugin Code.
- Fixed an issue with recycled event sprites not being removed completely.
- Fixed a Bug with Boundary Saved Events. (August 23, 2021)
- 1.6: Made Load Spawn Map code a lot cleaner and more efficient.
- Moved all SpawnMap Data into one Object. $MapData[mapId].
- 1.7: Compatible with RPG Maker MZ Corescript 1.7.
- 1.8: Made some optimization improvements to Boundary System Auto Boundaries.
- This should result in better performance under heavy load.
- 1.9: Fixed a crash relating to saved events.
Updated Demo released June 1, 2024.
Updated demo to add new scenes for Auto Boundaries.
Is this spawner missing something you need?
Have any ideas on expanding this plugin further?
I'd love to hear your thoughts in the comments below and if they're reasonable I'll see about adding them into the spawner!
Purchase
In order to download this RPG Maker MZ Plugin you must purchase it at or above the minimum price of $5 USD. You will get access to the following files:
Development log
- Ultimate Event Spawner v1.8 and Demo UpdateJun 02, 2024
- Small Update for Ritter Ultimate Event Spawner! v1.6Aug 24, 2021
- Spawner Boundary System Update (Bug Fix)Aug 24, 2021
- Ritter Ultimate Event Spawner MZ v1.5 Released!Aug 21, 2021
Comments
Log in with itch.io to leave a comment.
Hi, I am not sure why but your plugin clash with Visustella event movement core, is there a script that can blend with Visustella event movement core?
Hello! Thank you for reaching out. Unfortunately, compatibility issues with the Visustella Events and Movement Core plugin are a known problem, primarily due to the included event spawner functionality, which tends to conflict with other event-spawning plugins, including this one.
Their obfuscated code makes finding compatibility solutions tricky, but I’ve explored a few options in the past and have some new ideas to test soon. I apologize for the inconvenience, and I’m hopeful for a workaround in the near future.
Thanks for your patience!
I am unable to use it for now due to the clash, I really hope I can use it because VS spawner doesnt recycle / reset their spawns. Which is a huge let down because eventually the events stack until the game map is overload in data and makes the game lags. I sincerely hope you can soon release an updated version that can workaround together with other plugins
Hey Ritter - I'm moving this from the MV thread to the MZ thread. I removed all plugins and recreated the game + create a dropbox of it and a 5 minute video explanation/crash explanation.
Link to the video and game are within the dropbox but I have your plugin in the dropbox so I don't want to post it here so anyone who didn't purchase it can't access it. Let me know a good way to send you that folder.
Take a look and let me know why you think this is happening. I did a test where I didn't use your plugin to spawn the event, and just through the event on the map and it works fine. The crash only happens once I spawn an event into the map with self-variables and the variables increase.
I made a custom plugin where the self variable increases for every minute that passes in game (online or offline) so when I launch the game after a minute passes, the variable gets updated. Then if I go to another map, or just load from a different map, and re-enter the main map with the spanwed event, I get the crash.
Did every test possible so I think it somehow has to do with your plugin, but I'm not sure why it only crashes with spawned events and does not crash if everything is the same and the event is not spawned.
See video in dropbox folder for a walkthrough and let me know if you want to communiicate with me outside of this site. My discord is Vaksky I'm also happy to tip if you can figure this out, just let me know (:
Here's the link to the video https://streamable.com/rsm86l
As far as the link to the game, let me know the best way to send you that file. Thanks!
I uploaded via dropbox here for the demo project. I removed your plugin so you can insert it yourself when downloading:
Whenever you save the game you'll hear an error sound but don't worry it does save. Just hit the save block twice and you're good. I have to change that in the future so it autoupdates that you saved instead of seeming like it doesn't.
Also you can see what cycle each plant is on after clicking it once it's watered. You can also see the global cycle by talking to the red robot guy.
Edit: Just tested with VisualStella EventsMoveCore and it works but I would rather use your plugin because I feel like I can do a lot with boundries, and am unsure if Visual Stella will play nicely with my future plugins since I need their Engine_Core. Yours also looks like it takes up less bandwidth which is nice.
Hello, I'll take a look at it soon thank you for throwing that together, but I noticed in the spawned event in which you were saying might be the problematic one I saw that you're Erasing the event instead of unspawning it. I'm not sure if that's what's causing the problem but if you do erase a saved event then when the event is respawned it would be respawned as an erased event whenever you return to the map.
If you no longer need an event you should Unspawn it and remove the save data as well.
From what I see here it appears to me that this event would be getting respawned as an erased event, this is assuming that it's also a saved event itself, so even if it's not causing this problem it's probably unintended behavior occurring nonetheless. If you're spawning a saved event, interacting with it and erasing the event after it spawns another saved event then you're not actually removing any saved data so when you return to the map any erased events would be restored as erased events and might cause unexpected behavior. I'd say a great starting point would be to check your events and make sure if you're spawning them then you'll be unspawning them to remove them, and if you no longer need the saved data then be sure to remove that too in the plugin command.
I did run some tests in my demo project earlier after seeing your video and tried to do all the things you did in your video, just doing it manually without your plugin, I was able to spawn a saved event and set a selfVariable value to it, then i saved the game went to another map saved the game to another slot then changed the selfVariable value from the other map and then returned to the map with the event and it didn't crash. I kept trying different things to try to get it to crash and couldn't get it to happen.
One other note is the way his Self Variable plugin is structured there isn't really much of a reason for it to conflict with a spawner, as long as the spawner can retain the eventId, such as saved events, there isn't much of a reason I can see which should cause a conflict between the plugins. He's just storing data and tying it to an eventId on tied to game map ids and offers you a convenient way to access it and modify it, it's done well. He doesn't seem to be doing too much with Game_Event that would cause any problems.
Like I said though I'll be taking a look at the project you've provided soon
Let me know if this ended up being the issue, hopefully it was something as simple as this :)
Just tested it and unfortunately still crashing ):
Hey I just sent you a friend request on discord we can talk there
Resolved! Thanks for the help (:
Awesome plugin!
Question: How do I spawn an event in front my my character's current position?
I tried $gamePlayer.frontX() and $gamePlayer.frontY() but it didn't work ):
Hello! I would probably do something like this:
let player = $gamePlayer;
let x = player.x;
let y = player.y;
let d = player.direction();
let frontX = x + (d === 6 ? 1 : d === 4 ? -1 : 0);
let frontY = y + (d === 2 ? 1 : d === 8 ? -1 : 0);
front X takes player x location and adds 1 if direction is 6 (facing right) or adds -1 (subtracts 1, if player is facing left) or it adds 0 if neither (player is facing up or down)
frontY takes player y location and adds 1 if the direction is 2 (facing down) or adds -1 (subtracts 1, if the player is facing up) or it adds 0 if neither (player is facing left or right)
This code should give you the x,y coordinates for the tile in front of the player. There are countless other conditions you can set as well, as this doesn't factor in if the tile in front of the player is passable or not. So once you have the frontX and frontY you can then handle whatever other conditions, if any are necessary, before spawning an event.
Thanks much!
I also noticed issues when I try to spawn an event ontop of an existing event. For example, if I spawn an event above me, and nothing is currently there, it works fine. If I try to spawn an event on top of myself or on top of an existing event, the event i'm trying to spawn doesn't spawn. Any ideas, or is this intended?
Anyway to fix this? Not sure why this is occuring.
If you know a little bit of javascript you should be able to adjust the code within the Ritter.canSpawnOn function in the plugin code.
it's a pretty straightforward function and easy to add to or remove things from.
Ritter.canSpawnOn = function(x, y, regions) {
var region = $gameMap.regionId(x,y);
//if ($gameMap.eventsXy(x, y).length > 0) return false;
//if ($gamePlayer.x == x && $gamePlayer.y == y) return false;
if (regions && !regions.contains(region)) return false;
if (!$gameMap.isPassable(x,y)) return false;
return true;
};
So if you wanted to spawn on top of the player and on top of other events you can simply comment out the two lines as shown above, but if you wanted more control you can expand on the if statements and set more conditions as well.
This is indeed expected behavior as a basic canSpawnOn function, but I left it very easy to edit, just return true if the spawner can spawn on the tile or false if not. The function is structured so it will first attempt to return false but if it passes all the conditions it'll return true at the bottom.
I hope this helps, and if you need further help be sure to ask!
I accomplished this using your advise. Thanks much Ritter!
Hi, I'm interested in this plugin and bought the combo pack so that I can spawn events only in the player's proximity -I've followed the automatic boundaries set up and began to test but the moment the plugin is in use it crashes with "TypeError Cannot read property 'id' of undefined" irregardless if I remove potential plugin conflicts, I'm using the latest version of each plugin and I cannot proceed.
Please help asap.
Hello sorry about the delay, have you resolved this issue? Knowing which line number the error is thrown on would help to know what's happening.
Hi again, unfortunately no.
The border plugin also crashes after a few seconds of it being activated in your demo project, I don't quite understand console reports but I took a screenshot and it seems line 258 is at fault.
Thanks for getting back to me!
Hello, just posting an update here that I am working on an updated demo scene for the boundary system which should fix the problems in the demo.
When updating the plugin over time I managed to break the boundary demo and never got around to fixing it, hopefully when the demo is updated and working it will resolve your issues.
Given the error you've shown I'd say in the meantime it might help to double check for typos in both your spawn and unspawn boundary name fields within the AddAutoHandler plugin commands. I encountered the same exact error when making a typo in the unspawn. Ensure that your AutoHandler Boundary Name matches your Boundary Name, and also ensure that if you're using an unspawn boundary that the correct name is placed within the Unspawn settings as well (this should be a name of a spawn boundary, it tells the unspawn boundary what events it's allowed to unspawn.)
Good to hear your updating and fixing it, i'll be interested in trying it out once it's had a fix, for now I'll keep note about the typos since I haven't written down a great deal besides what I have shown you but I'll be eagerly awaiting the demo to follow through.
Hello! I got a little carried away with the demo but decided it's good enough to release now, I'll likely update it again in the near future to add in a few more ideas but for now it shows plenty of how boundaries work and I don't want to leave you hanging longer over nit picking details.
Give it a look, I hope it helps you!
There is also an update for the Event Spawner to v1.8 which includes an optimization improvement for auto boundaries as well.
Just download the new demo and unzip it, place the Event Spawner (preferably the newest version 1.8) and the Boundary system (Your existing copy should be up to date) plugins into the demo projects js/plugins folder then enable the Event Spawner and the Boundary system in the demo projects plugin manager.
Yeah, It looks like it's not working in 1.7
Sorry about this! I'll take a look into this as soon as I can
Sorry about the delay but I've looked into this and it seems like I've got it working for MZ corescript 1.7.
Just download the new version 1.7 of the event spawner to try it out
let me know if you encounter any issues with it
Thank you for your patience!
Its not starting with MZ 1.7 (Demo to if i update the core script to 1.7)
Sorry about the delayed response, I'm taking a look into this as soon as I can.
Oh nice! No worry, i tough this plugin can help me to fix a problem but i found a other solution. But dam this looks very good for other projects, so i would be happy about a new Version for mz 1.7 in the future. Thx for your work.
Sorry about the delay but I've looked into this and it seems like I've got it working for MZ corescript 1.7.
Just download the new version 1.7 of the event spawner to try it out
let me know if you encounter any issues with it
(the demo will likely still not work when updated, that'll need more work on my end before it works again)
Thank you for your patience!
Hello, just got this plugin and was excited to try it out as other event spawning plugins have not worked for me. But this one also doesn't seem to want to work. I'm getting the message "Error Uncaught Error: Failed to load: data/MapNaN.json". I only have 1 map that has the events on it, and I have that map in the Pre Spawn Map setting. Still doesn't load. In order to see that error message I had to comment out lines 953-954 in the code as the console told me there was an "Uncaught SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anoymous>) at Ritter_EventSpawner_v1.6.js:954.
Any help would be appreciated, and if you need any other information I can provide. I've been looking for an even spawner that handles spawning events in certain regions for a while now and thought this one would work out.
The events that I'm spawing seem to be non-functioning?
After using the typical Plugin SpawnEvent command, unlike the originals they are being copied from, the copies cannot be interacted with, the player can walk through them, the walk-in-place animation is absent, etc.
I saw in the trailer for the plugin that there is a section clearly show-casing that the shadow events move and interact with the player, but I can't really access that part of the demo because it utilizes the Region plugin add-on...
What am I doing wrong that the events end up as mere static sprites?
Hello, Sorry you're having an issue using this plugin. Typically issues such as this tend to be caused by an incompatibility with another plugin. Do you have another event spawner enabled? Have you tried testing in a project with less plugins enabled? have you tried disabling some other plugins within your existing project? Do you have your event(s) set up correctly? Without more information on what you're doing that isn't working it's hard to say for certain where the issue is.
Just did a bunch of testing, it seem the Events and Movement Core by VisuStella
(http://www.yanfly.moe/wiki/Events_and_Movement_Core_VisuStella_MZ)
completely renders the copied events non-functional.
T-T
Hello, I just ran some tests myself and seem to have found the same issue. I'll take a look into seeing if I can resolve this incompatibility.
Hopefully I'll figure something out, it might be tough with the obfuscated code.
Thank you for reporting this!
That's really nice! No pressure or anything!
Just a shame that troubleshooting with Visustella is probably difficult T-T
Out of curiosity, was a fix ever found?
unfortunately not yet, it's a little rough trying to get two spawners to work together especially with obfuscation involved. I'm trying another approach now that you've reminded me about this issue which leans into the spawner that's inside of the eventsmovecore plugin. It's more of a workaround so here's hoping I succeed on this fresh attempt.
It's really a shame that Visustella decided to group their spawner inside of the eventsmovecore plugin which has so many other helpful features. So far I'm seeing some promising signs in my testing but transforming is an issue that I'm trying to resolve.
I get this error every time I start the game for the first time
"Uncaught TypeError: Cannot set property 'events' of undefined"
But after F5 everything works fine . or restart the game.
What is the cause please?
Uncaught TypeError: Cannot set property 'events' of undefined
at XMLHttpRequest.map.onload (Ritter_EventSpawner.js:1156)
Hello version 1.2 after above is not compatible with VisuMZ_0_CoreEngine I don't know if there will be many bugs in version 1.2?
if I don't save the spawn
Should be able to use the old version, right?
Hello, I'm sorry you're having this issue! I'll take a look and see if I can find incompatibilities and fix them as soon as I can, in the meantime any additional information you can give will surely be helpful. Thank you for reporting this issue!
thanks for your reply
Can you describe the issue you're having? Are you getting thrown any errors? Is something just not working as intended?
Okay I think the issue here is actually unrelated to Visustella Core MZ. When you placed the updated version of the spawner into the demo did you reconfigure the plugin parameters?
In the spawner update to 1.5 there is a new Developer Mode which is still unfinished but this Developer Mode seems to be clashing with my own demo file. So to get around this issue just disable it.
Try this:
Open plugin manager and open Ritter_EventSpawner.
Set Developer Mode Parameter to False.
Set the Developer Mode Alert Settings to False.
Playtest again and see if it works.
Be sure to let me know if this doesn't resolve your problem!
Hello, I wanted to ask, if there is an option to unspawn "this event", the one you are interacting with?
Hello, that's quite do-able! Unspawning the Event you're interacting with should be as easy as this
On the event you're interacting with place a script call that looks like this
Ritter.unspawnEvent(this._eventId)
Thank you. It partialy worked like "delete event", but when I leave and re-enter the map, event is still spawned there where it was. Can I unspawn it permanently? :)
If the event is a Saved Event then you must do:
Ritter.unspawnEvent(this._eventId, true)
This removes the saved event data to prevent the event from being restored on map change.
If it's not a saved event then something weird is going on.
I'm currently getting close to releasing a big update for this plugin which will include Plugin Commands and making things more efficient.
Yeah, I tried with "Ritter.unspawnEvent(this._eventId, true)" myself, but that actually didn't even unspawned the event at all ^^'
Would be cool if you can fix it. Also can't wait for the update, thank you for your hard work!
Edit: Fun fact, when I erased the event after that command, it works fine! Thank you!!
Weird, I just tested this in the new version of the plugin and it's working for me without any issues.
Hmm, the unspawnEvent function should handle erasing the event itself, it should only take that one script call to unspawn the event and remove the save data while removing all trace of that event from the map.
Does the event remain on the same tile after it's unspawned or does it move to -1, -1? It definitely sounds like something isn't working as intended.
O vO now I'm back to annoy you with bugs on the MZ version lmao~
I'm not sure why, but using "Ritter.spawnEvent(2, 1, 5, 2, true);" doesn't seem to work~!
I tested this by adding true to the end of the spawns in the mz demo unspawn section and it seemed to not unspawn! "Great success" made me laugh!
https://gyazo.com/0a1c5c420ecdcd8de625297bbb3bcf82
Because I couldn't unspawn saved events I couldn't test the error we had with MV (spawning/moving new saved events on old saved+unspawned locations > map transfer)
A demo project would be great, unfortunately I have problems with unspawing spawned events.
I use this script-call to spawn an event: Ritter.spawnEvent(2, 1, 13, 2)
Then I use this script-call to unspawn it: Ritter.unspawnEvent($gameMap._lastSpawnEventId)
And I tried: Ritter.unspawnEvent(1000)
And: Ritter.unspawnEvent($gameVariables.value(3))
(I set Var 3 to $gameMap._lastSpawnEventId)
But nothing happend / nothing unspawned.
The parm is on Start with Event-ID 1000 (default).
Hello, I'm sorry you're having problems with this plugin, I'm currently unable to replicate this problem but I did recently make a demo project for the MV version of this spawner + boundary system so I'll start work on an MZ version. It should be a much faster timeframe to complete this one.
Thank you! I'll get this done as soon as I can!
The demo project has been released! I ended up doing more than I intended to do with it and now have some plans to expand on the demo once this next plugin is completed 100%.
Thank you and I hope it's helpful!
Hey, that's great!
And I found the problem: It's the "VisuMZ_1_EventsMoveCore" plugin, it also has an event spawn function, but yours is better. ^^
Plugin updated to v1.1 to fix a rare crash which occurred when unspawning an unspawned event followed by switching scenes.