- Joined
- Sep 3, 2013
- Messages
- 23
- Reaction score
- 3
- First Language
- English
- Primarily Uses
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:
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?
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?

