Overwriten events are getting reset when opening the menu

Psicks

Villager
Member
Joined
Oct 15, 2017
Messages
5
Reaction score
3
First Language
Eglish
Primarily Uses
RMMV
Greetings Friends.

I am overriding the event details based on when specific meta values are found during the event initialization. Everything works as expected except for the case of going into the game menu, and then exiting out. The events are restored to their previous setting. When I leave the map, and return, the initialize is called again and the events are once again restored.

Can anyone help me in the right direction or prototype/function that I need to consider?

This is for RPGMaker MV

Thanks in advance
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
The event that controls the opening sequence should end with turning self-switch A ON.
Have a second page which is completely blank except for being conditioned by that self switch. This will ensure that the event only runs once. Without it, the event will run again every time you enter that map.
 

Psicks

Villager
Member
Joined
Oct 15, 2017
Messages
5
Reaction score
3
First Language
Eglish
Primarily Uses
RMMV
I am sorry if I am not being clear enough in my request but do appreciate your attempt in helping me.

This is for plug in development specifically. So this is in JavaScript and not using the built in event editor.

My script will look for meta tagging, and then overwrite the event logic. It works perfectly. I can leave the map and come back and still get the new logic. The issue happens when I go into the menu and then exit the menu. The custom logic that my plugin writes is reverted to whatever the original event logic was.

I assumed this was enough detail but if wanted I could share the script I have.

Thanks in advance

-- also, I guess after reading paying closer attention to the board it is on it on the wrong place. It looks like I cannot delete / or move thread. Can a moderator help me move it to this board? https://forums.rpgmakerweb.com/index.php?forums/learning-javascript.127/
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
[mod]Moving to Learning Javascript[/mod]
 

Psicks

Villager
Member
Joined
Oct 15, 2017
Messages
5
Reaction score
3
First Language
Eglish
Primarily Uses
RMMV
Solved it myself. It turns out that in rpg_managers.js DataManager.loadDataFile() is being called whenever your on a map and enter then exit the menu which was overwriting my events after I overwrote them in initilize. Originally I was overwriting my event logic like such:
Code:
thisEvent.pages[0].list = [];
                var oListItem = {};
                oListItem.code = 355;
                oListItem.indent = 0;
                oListItem.parameters = [];
                oListItem.parameters.push("HarvestResource(" + this._mapId + "," + this._eventId + ");");
                //oListItem.parameters.push("alert(" + this._mapId + "," + this._eventId + ");");
                thisEvent.pages[0].list.push(oListItem);
                
                var oListItem2 = {};
                oListItem2.code = 0;
                oListItem2.indent = 0;
                oListItem2.parameters = [];
                thisEvent.pages[0].list.push(oListItem2);

To solve, I ended up overwriting the Game_Event.prototype.start function to look for the case of my custom logic, act, then perform anything in the database:


Code:
var alias_GameEventstart = Game_Event.prototype.start;
Game_Event.prototype.start = function() {
    alias_GameEventstart.call(this);
    if (this.IsResource())
    {
        this.HarvestResource();
    }
};
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,061
Members
137,575
Latest member
akekaphol101
Top