RPG Maker Forums

Is there a best practice or good root object to use for copying an event off the map during loading, then recreating all the data needed to insert a new event during gameplay or even map loading?


My goal is to be able to, during the map data loading done in Game_Map.prototype.data function:


1 - grab some events the user made in the editor, by name  (I got this part, I think).


2 - put these events back into the game just after modding the map data, but before the game runs the map.  I don't understand what the engine does with events and characters during the map scene for this part.


I've tried copying $dataMap.events to an array using JsonEx.makeDeepCopy($dataMap.events);





 





But when I put them into the gameMap object with $gameMap._events[next_id]=JsonEx.makeDeepCopy(dg_events[2]);





 





I get a terrible crash saying: 






Quote







TypeError: undefined is not a function


    at file:///C:/Users/DarkGriffin/Documents/Rpg%20maker%20mv/CodeProject/js/rpg_objects.js:6154:22


    at Array.some (native)


    at Game_Map.isAnyEventStarting (file:///C:/Users/DarkGriffin/Documents/Rpg%20maker%20mv/CodeProject/js/rpg_objects.js:6153:26)


    at Game_Map.isEventRunning (file:///C:/Users/DarkGriffin/Documents/Rpg%20maker%20mv/CodeProject/js/rpg_objects.js:5421:50)


    at Game_Player.canMove (file:///C:/Users/DarkGriffin/Documents/Rpg%20maker%20mv/CodeProject/js/rpg_objects.js:7609:18)


    at Scene_Map.isMapTouchOk (file:///C:/Users/DarkGriffin/Documents/Rpg%20maker%20mv/CodeProject/js/rpg_scenes.js:485:43)


    at Scene_Map.updateDestination (file:///C:/Users/DarkGriffin/Documents/Rpg%20maker%20mv/CodeProject/js/rpg_scenes.js:476:14)


    at Scene_Map.update (file:///C:/Users/DarkGriffin/Documents/Rpg%20maker%20mv/CodeProject/js/rpg_scenes.js:397:10)


    at Function.SceneManager.updateScene (file:///C:/Users/DarkGriffin/Documents/Rpg%20maker%20mv/CodeProject/js/rpg_managers.js:1788:25)


    at Function.SceneManager.updateMain (file:///C:/Users/DarkGriffin/Documents/Rpg%20maker%20mv/CodeProject/js/rpg_managers.js:1754:14)









 





In other words, that does not appear to be the object it's expecting there.





 





Does anyone know the object I should be copying or replacing into to make this work?  I'm having hell using the debugger and javascript code to figure out how this is working under the hood during a map display loop, or what object/function I should be "loading" my copied event data into.  Any event programmers here who know this better then me?

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,446
Members
137,820
Latest member
georg09byron
Top