Hey, @Zephyrim, I'm going to point you to Yanfly's Plug-In list first.
I happened to pass this thread and noticed your post here, but before you start investigating what may be wrong with this Plug-In, it would be beneficial for you to first fix your Plug-In order with Yanfly's things.
Yanfly's Plug-Ins do need to be in a specific order in order for them to work, the order in which they show up on this page here is the order all of those YEP Plug-Ins need to be in. You'd be surprised how many issues this can fix.
Then, make sure all Plug-Ins that are not YEP are loaded either before, or after the YEP Plug-Ins, unless there documentation says otherwise.
Can't really tell if this is necroposting (sorry if it is), but I'm having a problem with this script and I don't think it has to do with the other scripts (But I'm no expert, so I can't say).
TypeError: Cannot read property 'split' of undefined
at Function.XUtil.resolve (/D:/willb/Documents/MVGames/Wrongfultale002/js/plugins/PersistentData.js:173)
at Function.PersistManager.applyData (/D:/willb/Documents/MVGames/Wrongfultale002/js/plugins/PersistentData.js:145)
at Function.PersistManager.load (/D:/willb/Documents/MVGames/Wrongfultale002/js/plugins/PersistentData.js:118)
at Function.DataManager.createGameObjects (/D:/willb/Documents/MVGames/Wrongfultale002/js/plugins/PersistentData.js:78)
at Function.DataManager.setupNewGame (rpg_managers.js:211)
at Scene_Boot.start (rpg_scenes.js:211)
at Function.SceneManager.updateScene (rpg_managers.js:1668)
at Function.SceneManager.updateMain (rpg_managers.js:1641)
at Function.SceneManager.update (rpg_managers.js:1576)
I added a screenshot of all my active plugins, just in case it is necessary.
EDIT: I found out about the file name requirements, and I fixed that, yet the problem persists.
EDIT EDIT: Nevermind. For some strange reason, the plugin suddenly started working perfectly... Not sure why, but now that I can try it out, it's awesome, thank you so much for this!
Your persistent data plugin worked great until updated my Yanfly plugins. Now I get the "Cannot read property width of null" error regardless of where I put your plugin.
I used to load yours as the very first plugin, but now that error happens on start up regardless of where it is positioned. Any way to fix it? I really need persistent data/variables.
Are you certain it's the persistent data plugin that is causing the issue? (Toggling it off and trying to playtest the game without it?) Otherwise, I'll probably need a list/order of plugins in your game and the error log to try to find the issue. I don't think anything in this plugin checks the width of anything (or interacts with displayables of any kind).
Are you certain it's the persistent data plugin that is causing the issue? (Toggling it off and trying to playtest the game without it?) Otherwise, I'll probably need a list/order of plugins in your game and the error log to try to find the issue. I don't think anything in this plugin checks the width of anything (or interacts with displayables of any kind).
Yes I am certain. If i disable it, the problem disappears. It worked fine for a long time. But I just updated my Yanfly suite to the latest plugin version and BOOM.
Here is the error I get as soon as I launch my game when the JKL_PersistentData plugin is set to ON.
And here is the order in which my plugins have always been set. **I turned off the JKL_PersistentData plugin to get my game to run, that's why it shows as off in the screen shot below. I even tried changing the order and put it last, but the same problem occurs as long as JKL_PersistentData plugin status = ON. As soon as i turn it off... no issues. But I need it on
Here is a copy of the log. I redacted the file path for security purposes, but it appears that your plugin specifically conflicts with several Yanfly Plugin Javascript files as yours and his tries to "latch on" to the same DataManager.stuff functions. It also seems to conflict with the built in RPGMakerMV js files for version 1.5.0 where DataManager.stuff is.
If it's the overwriting of the createGameObjects causing the problem, maybe try the hotfix from page 2 of this thread (which I also added to the front page). Otherwise, I'll need more time to look into this. A lot of these things shouldn't be interconnected, as far as I can tell.
Edit: Looking at the plugins, I have an idea. Which switch do you have set for the Auto-Dash switch? If that is in the range of persistent switches, it might cause odd behavior. No idea why it'd cause the game to fail to get the width of a map, though.
Edit 2: I think I figured it out, maybe. The auto-dash switch must be listed as persistent for this to make sense, though. My theory: the game loads, checks persistent switches as it loads. Through a line of shared code it somehow ends up checking whether a tile is slippery or not. Because no map is loaded, the "current map" is null, and thus can't be checked for width. If this is the case, remove the auto-dash switch from the range of persistent switches.
If it's the overwriting of the createGameObjects causing the problem, maybe try the hotfix from page 2 of this thread (which I also added to the front page). Otherwise, I'll need more time to look into this. A lot of these things shouldn't be interconnected, as far as I can tell.
Edit: Looking at the plugins, I have an idea. Which switch do you have set for the Auto-Dash switch? If that is in the range of persistent switches, it might cause odd behavior. No idea why it'd cause the game to fail to get the width of a map, though.
Edit 2: I think I figured it out, maybe. The auto-dash switch must be listed as persistent for this to make sense, though. My theory: the game loads, checks persistent switches as it loads. Through a line of shared code it somehow ends up checking whether a tile is slippery or not. Because no map is loaded, the "current map" is null, and thus can't be checked for width. If this is the case, remove the auto-dash switch from the range of persistent switches.
I spent some more time examining the code, and the bad news is there actually isn't anything that can be done to make my implementation of persistent switches work with Yanfly's Auto Switches and Slippery Tiles. The way Yanfly overwrites the switch code, any time a switch value is checked it requires the player to be on a map or in battle to avoid this error. But my code runs as the title screen opens and tries to check/set switches right away.
The potentially good news is that there might be a workaround. I vaguely remember my code breaking if it's below some of Yanfly's other plugins (not sure if the old hotfix helps in all cases), so any attempts to fix the problem in my code would probably fail. But if you catch the trail before it causes the error in a small snippet of code, it might be useful as a workaround. A potential hotfix is in the code below:
(function() {
var _Game_Map_isSlippery = Game_Map.prototype.isSlippery;
Game_Map.prototype.isSlippery = function(mx, my) {
if (Game_Map.mapId == 0) return false; // important line
return _Game_Map_isSlippery.call(this, mx, my);
};
})();
The "important line" is the one that may need to be changed to work; I've yet to test it properly. But the basic idea is that you turn this code into a standalone plugin file and put it at the very bottom of your plugin list. Hopefully it works on the first try...
Alternatively, if you don't need either Slippery Tiles or Auto Switches, removing one or both of them should remove this particular issue.
Edit: Actually, there *might* be a way to make my plugin compatible with Yanfly's set. The problem lies in that we override the same function for setting switches, but I needed an additional argument that wasn't in the base function. Since Yanfly's code doesn't have that argument, it defaults to the code that leads to the error. If I'm right, I might be able to fix my code to work with Yanfly's and also get rid of some redundant lines. But first, here's the hotfix below:
PersistManager.applyData = function(persist) {
var persistswexp = parameters['Persistent Switches'];
var switches = XUtil.resolve(persistswexp);
var persistvarexp = parameters['Persistent Variables'];
var variables = XUtil.resolve(persistvarexp);
if(typeof switches !== 'undefined' && typeof persist.switches !== 'undefined'){
for(var x of switches){
if(typeof x !== 'undefined'){
_Game_Switches_setValue.call(this, x, persist.switches[x]);
}
}
}
if(typeof variables !== 'undefined' && typeof persist.variables !== 'undefined'){
for(var y of variables){
if(typeof y !== 'undefined'){
_Game_Variables_setValue.call(this, y, persist.variables[y]);
}
}
}
};
This replaces the function of the same name in my plugin. If this works, I'll probably update the main code with this version.
I will try this out as soon as I can. I may not get to it for another few days as I am eyeball deep in some other work unrelated to RPGMakerMV. But when I do, I will post my findings here. If I don't post, it means I have not gotten a chance to test it. It realistically may take me several weeks to get back to that point. Time... gotta love how much of it there isn't.
I spent some more time examining the code, and the bad news is there actually isn't anything that can be done to make my implementation of persistent switches work with Yanfly's Auto Switches and Slippery Tiles. The way Yanfly overwrites the switch code, any time a switch value is checked it requires the player to be on a map or in battle to avoid this error. But my code runs as the title screen opens and tries to check/set switches right away.
The potentially good news is that there might be a workaround. I vaguely remember my code breaking if it's below some of Yanfly's other plugins (not sure if the old hotfix helps in all cases), so any attempts to fix the problem in my code would probably fail. But if you catch the trail before it causes the error in a small snippet of code, it might be useful as a workaround. A potential hotfix is in the code below:
(function() {
var _Game_Map_isSlippery = Game_Map.prototype.isSlippery;
Game_Map.prototype.isSlippery = function(mx, my) {
if (Game_Map.mapId == 0) return false; // important line
return _Game_Map_isSlippery.call(this, mx, my);
};
})();
The "important line" is the one that may need to be changed to work; I've yet to test it properly. But the basic idea is that you turn this code into a standalone plugin file and put it at the very bottom of your plugin list. Hopefully it works on the first try...
Alternatively, if you don't need either Slippery Tiles or Auto Switches, removing one or both of them should remove this particular issue.
Edit: Actually, there *might* be a way to make my plugin compatible with Yanfly's set. The problem lies in that we override the same function for setting switches, but I needed an additional argument that wasn't in the base function. Since Yanfly's code doesn't have that argument, it defaults to the code that leads to the error. If I'm right, I might be able to fix my code to work with Yanfly's and also get rid of some redundant lines. But first, here's the hotfix below:
PersistManager.applyData = function(persist) {
var persistswexp = parameters['Persistent Switches'];
var switches = XUtil.resolve(persistswexp);
var persistvarexp = parameters['Persistent Variables'];
var variables = XUtil.resolve(persistvarexp);
if(typeof switches !== 'undefined' && typeof persist.switches !== 'undefined'){
for(var x of switches){
if(typeof x !== 'undefined'){
_Game_Switches_setValue.call(this, x, persist.switches[x]);
}
}
}
if(typeof variables !== 'undefined' && typeof persist.variables !== 'undefined'){
for(var y of variables){
if(typeof y !== 'undefined'){
_Game_Variables_setValue.call(this, y, persist.variables[y]);
}
}
}
};
This replaces the function of the same name in my plugin. If this works, I'll probably update the main code with this version.
I can't speak to running games in a browser... I've not been able to get games to run that way very often. However, that does seem to be the issue here, based on what I can tell from the logs. Basically, I've never needed to know how web storage for RMMV works, so I never wrote a way for this plugin to interact with it.
If we're lucky, adding this code under the function redefinition for StorageManager.localFilePath will fix your problem. This is basically the sister function for web saving (as opposed to local saving to a file).
Code:
var _StorageManager_webStorageKey = StorageManager.webStorageKey;
StorageManager.webStorageKey = function(savefileId) {
var name;
if (savefileId === "Persistent")
name = 'RPG Persistent';
else
name = _StorageManager_webStorageKey.call(this,savefileId);
return name;
};
Let me know if that works. If it does, I might need to update the main code with this included.
Hi and thanks for your plugin. But I was wondering if I could use a scriptcall to delete the persistent save in the save folder. Is it possible?
Thanks in advance.
Edit: I used some node.js scripts to erase the file but, I noticed that as soon as the file is touched, the plugin will recreate it with the same vaeiables because of the save when set feature, is it possible to turn off this feature within the game? Thanks
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.