Ok, I can't test this on MV right now, so I'll put the code here instead of GitHub:
I added the plugin command "delete this event" that will call the erase command and stop the event from re-appearing on map changes.
Edit: Removed old code.
It didn't work in my tests. Would either result in a crash or event would re-spawn upon re-entering map.
I appreciate it, though, and will try to work it out with Estriole's script. So far it's worked quite well alongside yours. Causes some issues like lag with Pathfinder and door interaction, but I only need this much eventing for this one map. Thanks again!
Well, I'll fix this first thing when I get home tonight.
Here are my findings thus far:
So far your script works perfectly to copy an event onto a different map multiple times. The lag this causes might be because of how Rpg Maker handles this. Or so I'm told anyways. Either way, I can fill a 27x18 map with events before the lag starts to get really bad.
And Estriole is correct, I did some more testing after my last post, and your script will indeed cause lag with PathFinder. Copying events and then using Pathfinder in that same map stutters the game.
PS: Thanks, Estriole, Hudell, you two are quite friendly. I'm new to this community so I was nervous xD
Thanks, unfortunately I don't have time to do it right now but I'll test this out as soon as possible!
All right, so I tested the Script multiple times, and trying multiple things. And it worked perfectly across all tests.
*Deleted Events will be removed, and reloading the map won't re-spawn them.
*Doors will also function correctly, even after reloading the map.
*Events set to Pathfind will also properly be reset upon reloading the map now. However, your script still causes lag with PathFinder. Other than that, it's exactly everything I needed! Thank you very much!
the fps drop happen only when this two condition met:
1) adding new event using your plugin even just one event. and NOT leaving the map
2) executing Pathfinder.
it will loss fps until we move to new map.
when we leave the map... reenter... it won't be fps loss...
but when we execute Pathfinder again... it will be fps loss again...
hope this test can help you point the problem...
edit: found the possible culprit... it's because when you create new event you add event_id with 1000
Game_Map.prototype.getIndexForNewEvent = function() { var index = this._events.length; if (index < 1000) { index += 1000; } return index; };maybe there's some code that iterate 1 to event id and 1 to 1000++ is lots of iteration...
from what i see in pathfinder plugin... there's no such iteration... but maybe there's a function called by the plugin which have that iteration (would be harder to trace)
i tested by changing + 1000 with + 50 and the lag is gone.
in my plugin i detect the next event id instead.
event id currently exist on map: 1, 2, 3, 4, 5, 6, 9, 10,11
next id generated will be 7. then 8. then 12.
thus no fps loss
What's the size of the map you're testing it on and how many events does it have?
small map (17x13) with only 5-8 events... and add only one new event using your plugin. so total final event max 9 event.