so i wanted to ask yanfly, are you planning a skill equip system, reason i ask is alot of your plugins seam to have close ties with FFT, and it would really help out alot if you where planning on some sort of passive skill equip system (i dont use moggle_x's because it adds new learning system and it wont work with learning with jp and wouldnt apply all your notetags, like jpboost
anyways hope to hear back from ya
[YEP] Yanfly Engine Plugins
● ARCHIVED · READ-ONLY
-
-
Found a bug with your equip core.
When using it, it shows Max MP, on the right side when you go to equip something. However, I have renamed MP to something else. So it's not using the default name for MP? Just a heads up! -
I love the Stat Upgrades.
Didn´t had the time to try it out yet, but I have a few questions.
Will you be able to upgrade custom created stats? I´d like to have the stats "Strength", "Agility", etc. and would like to upgrade these with your system.
And will that plugin disable the default way of automatically upgrade your stats after level up?
Would you consider creating a custom stats plugin? I really don´t like the default stats and how they work, as I have a long history of Pen & Paper RPG (Pathfinder, D&D, Shadowrun, etc.) and love these systems and how attributes, stats, etc. work. -
Second this one. Encountered same minor bug.Found a bug with your equip core.
When using it, it shows Max MP, on the right side when you go to equip something. However, I have renamed MP to something else. So it's not using the default name for MP? Just a heads up! -
Definitely as it's one of the staples in my previous script libraries. :) I guess it's just a matter of time as to when to get it released. And yeah, FFT is probably my favorite FF. XDso i wanted to ask yanfly, are you planning a skill equip system, reason i ask is alot of your plugins seam to have close ties with FFT, and it would really help out alot if you where planning on some sort of passive skill equip system (i dont use moggle_x's because it adds new learning system and it wont work with learning with jp and wouldnt apply all your notetags, like jpboost
anyways hope to hear back from ya
It uses whatever you call it in the default editor. You probably renamed MP, but did you rename Max MP, too?Found a bug with your equip core.
When using it, it shows Max MP, on the right side when you go to equip something. However, I have renamed MP to something else. So it's not using the default name for MP? Just a heads up!

Hi jet_blackI love the Stat Upgrades.
Didn´t had the time to try it out yet, but I have a few questions.
Will you be able to upgrade custom created stats? I´d like to have the stats "Strength", "Agility", etc. and would like to upgrade these with your system.
And will that plugin disable the default way of automatically upgrade your stats after level up?
Would you consider creating a custom stats plugin? I really don´t like the default stats and how they work, as I have a long history of Pen & Paper RPG (Pathfinder, D&D, Shadowrun, etc.) and love these systems and how attributes, stats, etc. work.
If you're able to upgrade those custom stats with JavaScript (most likely you'd be able to), then yes, you can.
Disabling the default way of auto updating your stats after a level up is entirely up to you. If you want to do that, you'll have to set the parameter curves for each class in your database to show no changes.
I considered creating a custom stats plugin, but the problem with that is, there's no global way of making it work for all the possible plugins out there, thus causing incompatibilities so I'd like to avoid this. However, I may make custom attributes, which will be different from stats.
Second this one. Encountered same minor bug.
-
Yuudai, on 25 Nov 2015 - 11:03 PM, said:

Super long awwwwwwwwwwwwwwwww (^౪)/ that would be awesome! *excited*mhh...I see
is it possible to create a shop scene charging JP instead of gold?
thats what I want *_*
Hmmm, that might actually be something worthy of a Plugin idea. :o
hope you can squeeze this in to your busy schedule! :p -
TY! How I overlooked that I will never know.
also, in the stats upgrade, how do you use custom parameters, ex and sp-parameters? -
Hi Yanfly. I was wondering if you could move the processing of notetags to a separate function from DataManager.isDatabaseLoaded() in YEP_CoreEngine, as this function should only be used to check if the database files are all available, and not perform any actions in and of itself. In my PreloadManager plugin, for instance, I need to check if the database is done loading until it is, at which point I start reading it and preloading data on boot. This can sometimes cause a problem because if the database is done loading, running this will cause it to load the notetags multiple times.
Below is the relevant code:
Code:# Starts on line 577 of YEP_CoreEngine.jsYanfly.Core.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { if (!Yanfly.Core.DataManager_isDatabaseLoaded.call(this)) return false; this.processCORENotetags1($dataItems); this.processCORENotetags1($dataWeapons); this.processCORENotetags1($dataArmors); this.processCORENotetags2($dataEnemies); this.processCORENotetags3($dataActors); this.processCORENotetags4($dataClasses); return true;}; -
It's the same for me. The notetag loading doesn't occur unless the database is fully loaded. Also, the methods to load the notetags won't load multiple instances of the data. Nothing gets added multiple times over.Hi Yanfly. I was wondering if you could move the processing of notetags to a separate function from DataManager.isDatabaseLoaded() in YEP_CoreEngine, as this function should only be used to check if the database files are all available, and not perform any actions in and of itself. In my PreloadManager plugin, for instance, I need to check if the database is done loading until it is, at which point I start reading it and preloading data on boot. This can sometimes cause a problem because if the database is done loading, running this will cause it to load the notetags multiple times.
Below is the relevant code:
# Starts on line 2173 of YEP_CoreEngine.jsYanfly.Core.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { if (!Yanfly.Core.DataManager_isDatabaseLoaded.call(this)) return false; this.processCORENotetags1($dataItems); this.processCORENotetags1($dataWeapons); this.processCORENotetags1($dataArmors); this.processCORENotetags2($dataEnemies); this.processCORENotetags3($dataActors); this.processCORENotetags4($dataClasses); return true;}; -
This is doable with Quasi's Params Plus plugin. As long as you put the following in the skills note tag:Will you be able to upgrade custom created stats? I´d like to have the stats "Strength", "Agility", etc. and would like to upgrade these with your system.
And will that plugin disable the default way of automatically upgrade your stats after level up?
Would you consider creating a custom stats plugin? I really don´t like the default stats and how they work, as I have a long history of Pen & Paper RPG (Pathfinder, D&D, Shadowrun, etc.) and love these systems and how attributes, stats, etc. work.
<Learn Cost Eval>
user._cParamPlus[0] += 1; // <- the cParamPlus[0] = the first custom parameter in the data/Parameters.json file.
user.forgetSkill(21);
user.refresh();
</Learn Cost Eval>
The only issue I have yet to resolve is when using Quasi's Params Plus plugin, some of yanflys lovely menus (equip/item core, party system) dont display the custom stats. ;_; -
I don't see anything stopping it from going through looking for notetags on every database item again every time the original aliased isDatabaseLoaded() function returns true, however. Everytime isDatabaseLoaded() gets called with the quoted code, your functions will look through the $data* objects for notetags as there's no internal check to see if notetags have already been loaded.It's the same for me. The notetag loading doesn't occur unless the database is fully loaded. Also, the methods to load the notetags won't load multiple instances of the data. Nothing gets added multiple times over.
I must also insist that there shouldn't be functions that read/alter data within a function like isDatabaseLoaded(), as its function name implies it returns true or false depending on the database status. Having data altering code in it isn't a good idea in general. -
So maybe DataManager.onLoad can be a better choice? As DataManager.extractMetadata is called there(or maybe even just touch DataManager.extractMetadata directly instead):I don't see anything stopping it from going through looking for notetags on every database item again every time the original aliased isDatabaseLoaded() function returns true, however. Everytime isDatabaseLoaded() gets called with the quoted code, your functions will look through the $data* objects for notetags as there's no internal check to see if notetags have already been loaded.
I must also insist that there shouldn't be functions that read/alter data within a function like isDatabaseLoaded(), as its function name implies it returns true or false depending on the database status. Having data altering code in it isn't a good idea in general.
SpoilerCode:DataManager.onLoad = function(object) { var array; if (object === $dataMap) { this.extractMetadata(object); array = object.events; } else { array = object; } if (Array.isArray(array)) { for (var i = 0; i < array.length; i++) { var data = array[i]; if (data && data.note !== undefined) { this.extractMetadata(data); } } }};DataManager.extractMetadata = function(data) { var re = /<([^<>:]+)(:?)([^>]*)>/g; data.meta = {}; for (; { var match = re.exec(data.note); if (match) { if (match[2] === ':') { data.meta[match[1]] = match[3]; } else { data.meta[match[1]] = true; } } else { break; } }}; -
Yes, each time DataManager.isDatabaseLoaded() is called, it will preload those notetags and overwrite the existing notetag data. This is intended on my part. This is done twice because at times, $data_ arrays are sometimes rewritten over and added data isn't retained.I don't see anything stopping it from going through looking for notetags on every database item again every time the original aliased isDatabaseLoaded() function returns true, however. Everytime isDatabaseLoaded() gets called with the quoted code, your functions will look through the $data* objects for notetags as there's no internal check to see if notetags have already been loaded.
I must also insist that there shouldn't be functions that read/alter data within a function like isDatabaseLoaded(), as its function name implies it returns true or false depending on the database status. Having data altering code in it isn't a good idea in general.
So maybe DataManager.onLoad can be a better choice? As DataManager.extractMetadata is called there(or maybe even just touch DataManager.extractMetadata directly instead):
SpoilerDataManager.onLoad = function(object) { var array; if (object === $dataMap) { this.extractMetadata(object); array = object.events; } else { array = object; } if (Array.isArray(array)) { for (var i = 0; i < array.length; i++) { var data = array; if (data && data.note !== undefined) { this.extractMetadata(data); } } }};DataManager.extractMetadata = function(data) { var re = /<([^<>:]+):)?)([^>]*)>/g; data.meta = {}; for (; { var match = re.exec(data.note); if (match) { if (match[2] === ':') { data.meta[match[1]] = match[3]; } else { data.meta[match[1]] = true; } } else { break; } }};
Spoiler
I'm assuming this message is directed at me? If it is, my response is the same as here: http://forums.rpgmakerweb.com/index.php?/topic/45412-community-core-script/?p=462359
In particular this response:
SpoilerI've attempted to do that already. However, I've stumbled upon a couple problems:
- It's just raw data. It doesn't detect if it's from $dataItems, $dataWeapons, etc.
- It's doing it as it loads, which means, if I were to make a notetag that would copy or reference the properties of another object that would be loaded later, it wouldn't be able to do so.
-
I see no reason to put the notetag reads in the function isDatabaseLoaded(), however. Why not in, say, Scene_Boot.terminate? isDatabaseLoaded() is for running checks to see whether the db objects have loaded; it should not contain transactional logic like this. It's not a huge compatibility issue for me, but it will be for others. It's the wrong place to put it.
-
I've used Scene_Boot.terminate() before. However, this is the main problem.I see no reason to put the notetag reads in the function isDatabaseLoaded(), however. Why not in, say, Scene_Boot.terminate? isDatabaseLoaded() is for running checks to see whether the db objects have loaded; it should not contain transactional logic like this. It's not a huge compatibility issue for me, but it will be for others. It's the wrong place to put it.
Scene_Boot.prototype.start = function() { Scene_Base.prototype.start.call(this); SoundManager.preloadImportantSounds(); if (DataManager.isBattleTest()) { DataManager.setupBattleTest(); SceneManager.goto(Scene_Battle); } else if (DataManager.isEventTest()) { DataManager.setupEventTest(); SceneManager.goto(Scene_Map); } else { this.checkPlayerLocation(); DataManager.setupNewGame(); SceneManager.goto(Scene_Title); Window_TitleCommand.initCommandPosition(); } this.updateDocumentTitle();};In setting up the battle test, new games, etc. there are instances where notetags aren't loaded yet, thus, inconsistencies and errors occur.
And as far as compatibility issues go, I fail to see where the compatibility issues will arise unless someone intends to completely rewrite the isDatabaseLoaded function. If that was the case, there'd be more problems than just compatibility issues alone.
When notedata is preloaded, it doesn't add upon itself, but rather, overwrites itself and does not affect anything else but its own intended changes. Though, if this is what's causing incompatibilities, please enlighten me as to how it's causing them and what it's making your plugin(s) doing differently than intended. -
Yeah, and I'm also thinking about these issues too, as I'm comparing between DataManager.isDatabaseLoaded and DataManager.extractMetadata.Yes, each time DataManager.isDatabaseLoaded() is called, it will preload those notetags and overwrite the existing notetag data. This is intended on my part. This is done twice because at times, $data_ arrays are sometimes rewritten over and added data isn't retained.
I'm assuming this message is directed at me? If it is, my response is the same as here: http://forums.rpgmakerweb.com/index.php?/topic/45412-community-core-script/?p=462359
In particular this response:
SpoilerI've attempted to do that already. However, I've stumbled upon a couple problems:
- It's just raw data. It doesn't detect if it's from $dataItems, $dataWeapons, etc.
- It's doing it as it loads, which means, if I were to make a notetag that would copy or reference the properties of another object that would be loaded later, it wouldn't be able to do so.
Right now, what I can see is this(I'm trying to figure out the full picture):
Extreme case 1 - Only 1 datatype has notetags
Example:
Extreme case 2 - All datatype has different notetags needing different notetag reading functionsSpoilerUsing DataManager.extractMetadata -
AuthorName.PluginName.DataManager_loadDataFile = DataManager.loadDataFile;DataManager.loadDataFile = function(name, src) { this._pluginNameSrc = src; // Added to mark the current source file name AuthorName.PluginName.DataManager_loadDataFile.call(this, name, src);}; // DataManager.loadDataFileAuthorName.PluginName.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { this._pluginNameSrc = undefined; // Added return AuthorName.PluginName.DataManager_isDatabaseLoaded.call(this);}; // DataManager.isDatabaseLoadedAuthorName.PluginName.DataManager_extractMetadata = DataManager.extractMetadata;DataManager.extractMetadata = function(data) { AuthorName.PluginName.DataManager_extractMetadata.call(this, data); // Added to load all skill notetags if the current source file is Skills if (this._pluginNameSrc.match(/Skills/)) { this.loadPluginNameSkillNotes(data); } //}; // DataManager.extractMetadataUsing DataManager.isDatabaseLoaded -
AuthorName.PluginName.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { // Rewritten if (!AuthorName.PluginName.DataManager_isDatabaseLoaded.call(this)) { return false; } this.loadAllPluginNameNotes(); return true; //}; // DataManager.isDatabaseLoadedDataManager.loadAllPluginNameNotes = function() { // New $dataSkills.forEach(function(skill) { if (skill) { this.loadPluginNameSkillNotes(skill); } }, this);} // DataManager.loadAllPluginNameNotes
Example:
While I personally prefer to use DataManager.isDatabaseLoaded, if that's really proven to be absolutely 100% evil under any possible circumstance, I'll switch to use DataManager.extractMetadata instead :)SpoilerUsing DataManager.extractMetadata -
AuthorName.PluginName.DataManager_loadDataFile = DataManager.loadDataFile;DataManager.loadDataFile = function(name, src) { this._pluginNameSrc = src; // Added to mark the current source file name AuthorName.PluginName.DataManager_loadDataFile.call(this, name, src);}; // DataManager.loadDataFileAuthorName.PluginName.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { this._pluginNameSrc = undefined; // Added return AuthorName.PluginName.DataManager_isDatabaseLoaded.call(this);}; // DataManager.isDatabaseLoadedAuthorName.PluginName.DataManager_extractMetadata = DataManager.extractMetadata;DataManager.extractMetadata = function(data) { AuthorName.PluginName.DataManager_extractMetadata.call(this, data); // Added to load each data type notetag via its own notetag reading function this.loadAllPluginNameNotes(data); //}; // DataManager.extractMetadataDataManager.loadAllPluginNameNotes = function(data) { // New if (this._pluginNameSrc.match(/Actors/)) { this.loadPluginNameActorNotes(data); } else if (this._pluginNameSrc.match(/Classes/)) { this.loadPluginNameClassNotes(data); } else if (this._pluginNameSrc.match(/Skills/)) { this.loadPluginNameSkillNotes(data); } else if (this._pluginNameSrc.match(/Items/)) { this.loadPluginNameItemNotes(data); } else if (this._pluginNameSrc.match(/Weapons/)) { this.loadPluginNameWeaponNotes(data); } else if (this._pluginNameSrc.match(/Armors/)) { this.loadPluginNameArmorNotes(data); } else if (this._pluginNameSrc.match(/Enemies/)) { this.loadPluginNameEnemyNotes(data); } else if (this._pluginNameSrc.match(/Troops/)) { this.loadPluginNameTroopNotes(data); } else if (this._pluginNameSrc.match(/States/)) { this.loadPluginNameStateNotes(data); } else if (this._pluginNameSrc.match(/Animations/)) { this.loadPluginNameAnimationNotes(data); } else if (this._pluginNameSrc.match(/Tilesets/)) { this.loadPluginNameTilesetNotes(data); } else if (this._pluginNameSrc.match(/CommonEvents/)) { this.loadPluginNameCommonEventNotes(data); } else if (this._pluginNameSrc.match(/System/)) { this.loadPluginNameSystemNotes(data); } else if (this._pluginNameSrc.match(/MapInfos/)) { this.loadPluginNameMapInfoNotes(data); }}; // DataManager.loadAllPluginNameNotesUsing DataManager.isDatabaseLoaded -
AuthorName.PluginName.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { // Rewritten if (!AuthorName.PluginName.DataManager_isDatabaseLoaded.call(this)) { return false; } this.loadAllPluginNameNotes(); return true; //}; // DataManager.isDatabaseLoadedDataManager.loadAllPluginNameNotes = function() { // New $dataActors.forEach(function(actor) { if (actor) { this.loadPluginNameSkillNotes(actor); } }, this); $dataClasses.forEach(function(class) { if (class) { this.loadPluginNameClassNotes(class); } }, this); $dataSkills.forEach(function(skill) { if (skill) { this.loadPluginNameSkillNotes(skill); } }, this); $dataItems.forEach(function(item) { if (item) { this.loadPluginNameItemNotes(item); } }, this); $dataWeapons.forEach(function(weapon) { if (weapon) { this.loadPluginNameWeaponNotes(weapon); } }, this); $dataArmors.forEach(function(armor) { if (armor) { this.loadPluginNameArmorNotes(armor); } }, this); $dataEnemies.forEach(function(enemy) { if (enemy) { this.loadPluginNameEnemyNotes(enemy); } }, this); $dataTroops.forEach(function(troop) { if (troop) { this.loadPluginNameTroopNotes(troop); } }, this); $dataStates.forEach(function(state) { if (state) { this.loadPluginNameStateNotes(state); } }, this); $dataAnimations.forEach(function(animation) { if (animation) { this.loadPluginNameAnimationNotes(animation); } }, this); $dataTilesets.forEach(function(tileset) { if (tileset) { this.loadPluginNameTilesetNotes(tileset); } }, this); $dataCommonEvents.forEach(function(commonEvent) { if (commonEvent) { this.loadPluginNameCommonEventNotes(commonEvent); } }, this); $dataSystem.forEach(function(system) { if (system) { this.loadPluginNameSystemNotes(system); } }, this); $dataMapInfos.forEach(function(mapInfo) { if (mapInfo) { this.loadPluginNameMapInfoNotes(mapInfo); } }, this);} // DataManager.loadAllPluginNameNotes
P.S.: I somehow suspect that DataManager.isDatabaseLoaded is the only timing that can be used to load custom plugin notetags conveniently, even though it's supposed to be referentially transparent(no side effects). If that's the case, then the issue might lie in the very default RMMV codebase itself, as violating the referential transparency in DataManager.isDatabaseLoaded would be the best balance for we plugin developers in this case. Of course, that's just my wild guess :D -
I received this report of an error occurring, which is what got me onto this topic: http://forums.rpgmakerweb.com/index.php?/topic/46515-preload-manager/?p=510196
Based on your code the error shouldn't really happen (it seems like one of the $data* arrays are nil in this example), so I'm not saying that the notetag reading being placed in the isDatabaseLoaded() function necessarily is the culprit, but it made me aware of it and I just see it as bad practice to put data altering code into a function meant to simply read the status of file loading. As you've seen I call this function repeatedly until I can ensure that the database is fully loaded, and I figure it's likely that many other plugins will do this too (it's why it's there), which means your notetags will be read over and over perhaps dozens of time on startup. -
Then Yanfly might do something like this to stick with his/her way:I received this report of an error occurring, which is what got me onto this topic: http://forums.rpgmakerweb.com/index.php?/topic/46515-preload-manager/?p=510196
Based on your code the error shouldn't really happen (it seems like one of the $data* arrays are nil in this example), so I'm not saying that the notetag reading being placed in the isDatabaseLoaded() function necessarily is the culprit, but it made me aware of it and I just see it as bad practice to put data altering code into a function meant to simply read the status of file loading. As you've seen I call this function repeatedly until I can ensure that the database is fully loaded, and I figure it's likely that many other plugins will do this too (it's why it's there), which means your notetags will be read over and over perhaps dozens of time on startup.
Of course he/she will have to be 100% sure that his/her notetag reading codes will always work as intended :)SpoilerAuthorName.PluginName.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { // Rewritten if (!AuthorName.PluginName.DataManager_isDatabaseLoaded.call(this)) { return false; } if (!this._isPluginNameNotesLoaded) { this.loadAllPluginNameNotes(); } return this._isPluginNameNotesLoaded; //}; // DataManager.isDatabaseLoadedDataManager.loadAllPluginNameNotes = function() { // New // The notetag reading codes go here // this._isPluginNameNotesLoaded = true;} // DataManager.isDatabaseLoaded -
Yeah, and I'm also thinking about these issues too, as I'm comparing between DataManager.isDatabaseLoaded and DataManager.extractMetadata.
Right now, what I can see is this(I'm trying to figure out the full picture):
Extreme case 1 - Only 1 datatype has notetags
Example:
SpoilerUsing DataManager.extractMetadata -
AuthorName.PluginName.DataManager_loadDataFile = DataManager.loadDataFile;DataManager.loadDataFile = function(name, src) { this._pluginNameSrc = src; // Added to mark the current source file name AuthorName.PluginName.DataManager_loadDataFile.call(this, name, src);}; // DataManager.loadDataFileAuthorName.PluginName.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { this._pluginNameSrc = undefined; // Added return AuthorName.PluginName.DataManager_isDatabaseLoaded.call(this);}; // DataManager.isDatabaseLoadedAuthorName.PluginName.DataManager_extractMetadata = DataManager.extractMetadata;DataManager.extractMetadata = function(data) { AuthorName.PluginName.DataManager_extractMetadata.call(this, data); // Added to load all skill notetags if the current source file is Skills if (this._pluginNameSrc.match(/Skills/)) { this.loadPluginNameSkillNotes(data); } //}; // DataManager.extractMetadataUsing DataManager.isDatabaseLoaded -
AuthorName.PluginName.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { // Rewritten if (AuthorName.PluginName.DataManager_isDatabaseLoaded.call(this)) { return false; } this.loadAllPluginNameNotes(); return true; //}; // DataManager.isDatabaseLoadedDataManager.loadAllPluginNameNotes = function() { // New $dataSkills.forEach(function(skill) { if (skill) { this.loadPluginNameSkillNotes(skill); } }, this);} // DataManager.loadAllPluginNameNotesWhile I personally prefer to use DataManager.isDatabaseLoaded, if that's really proven to be absolutely 100% evil under any possible circumstance, I'll switch to use DataManager.extractMetadata instead :)SpoilerExtreme case 2 - All datatype has different notetags needing different notetag reading functions
Example:
Using DataManager.extractMetadata -
AuthorName.PluginName.DataManager_loadDataFile = DataManager.loadDataFile;DataManager.loadDataFile = function(name, src) { this._pluginNameSrc = src; // Added to mark the current source file name AuthorName.PluginName.DataManager_loadDataFile.call(this, name, src);}; // DataManager.loadDataFileAuthorName.PluginName.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { this._pluginNameSrc = undefined; // Added return AuthorName.PluginName.DataManager_isDatabaseLoaded.call(this);}; // DataManager.isDatabaseLoadedAuthorName.PluginName.DataManager_extractMetadata = DataManager.extractMetadata;DataManager.extractMetadata = function(data) { AuthorName.PluginName.DataManager_extractMetadata.call(this, data); // Added to load each data type notetag via its own notetag reading function this.loadAllPluginNameNotes(data); //}; // DataManager.extractMetadataDataManager.loadAllPluginNameNotes = function(data) { // New if (this._pluginNameSrc.match(/Actors/)) { this.loadPluginNameActorNotes(data); } else if (this._pluginNameSrc.match(/Classes/)) { this.loadPluginNameClassNotes(data); } else if (this._pluginNameSrc.match(/Skills/)) { this.loadPluginNameSkillNotes(data); } else if (this._pluginNameSrc.match(/Items/)) { this.loadPluginNameItemNotes(data); } else if (this._pluginNameSrc.match(/Weapons/)) { this.loadPluginNameWeaponNotes(data); } else if (this._pluginNameSrc.match(/Armors/)) { this.loadPluginNameArmorNotes(data); } else if (this._pluginNameSrc.match(/Enemies/)) { this.loadPluginNameEnemyNotes(data); } else if (this._pluginNameSrc.match(/Troops/)) { this.loadPluginNameTroopNotes(data); } else if (this._pluginNameSrc.match(/States/)) { this.loadPluginNameStateNotes(data); } else if (this._pluginNameSrc.match(/Animations/)) { this.loadPluginNameAnimationNotes(data); } else if (this._pluginNameSrc.match(/Tilesets/)) { this.loadPluginNameTilesetNotes(data); } else if (this._pluginNameSrc.match(/CommonEvents/)) { this.loadPluginNameCommonEventNotes(data); } else if (this._pluginNameSrc.match(/System/)) { this.loadPluginNameSystemNotes(data); } else if (this._pluginNameSrc.match(/MapInfos/)) { this.loadPluginNameMapInfoNotes(data); }}; // DataManager.loadAllPluginNameNotesUsing DataManager.isDatabaseLoaded -
AuthorName.PluginName.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() { // Rewritten if (AuthorName.PluginName.DataManager_isDatabaseLoaded.call(this)) { return false; } this.loadAllPluginNameNotes(); return true; //}; // DataManager.isDatabaseLoadedDataManager.loadAllPluginNameNotes = function() { // New $dataActors.forEach(function(actor) { if (actor) { this.loadPluginNameSkillNotes(actor); } }, this); $dataClasses.forEach(function(class) { if (class) { this.loadPluginNameClassNotes(class); } }, this); $dataSkills.forEach(function(skill) { if (skill) { this.loadPluginNameSkillNotes(skill); } }, this); $dataItems.forEach(function(item) { if (item) { this.loadPluginNameItemNotes(item); } }, this); $dataWeapons.forEach(function(weapon) { if (weapon) { this.loadPluginNameWeaponNotes(weapon); } }, this); $dataArmors.forEach(function(armor) { if (armor) { this.loadPluginNameArmorNotes(armor); } }, this); $dataEnemies.forEach(function(enemy) { if (enemy) { this.loadPluginNameEnemyNotes(enemy); } }, this); $dataTroops.forEach(function(troop) { if (troop) { this.loadPluginNameTroopNotes(troop); } }, this); $dataStates.forEach(function(state) { if (state) { this.loadPluginNameStateNotes(state); } }, this); $dataAnimations.forEach(function(animation) { if (animation) { this.loadPluginNameAnimationNotes(animation); } }, this); $dataTilesets.forEach(function(tileset) { if (tileset) { this.loadPluginNameTilesetNotes(tileset); } }, this); $dataCommonEvents.forEach(function(commonEvent) { if (commonEvent) { this.loadPluginNameCommonEventNotes(commonEvent); } }, this); $dataSystem.forEach(function(system) { if (system) { this.loadPluginNameSystemNotes(system); } }, this); $dataMapInfos.forEach(function(mapInfo) { if (mapInfo) { this.loadPluginNameMapInfoNotes(mapInfo); } }, this);} // DataManager.loadAllPluginNameNotes
P.S.: I somehow suspect that DataManager.isDatabaseLoaded is the only timing that can be used to load custom plugin notetags conveniently, even though it's supposed to be referentially transparent(no side effects). If that's the case, then the issue might lie in the very default RMMV codebase itself, as violating the referential transparency in DataManager.isDatabaseLoaded would be the best balance for we plugin developers in this case. Of course, that's just my wild guess :D
In the times I've made the shifts regarding notetag loading, this is what I've came up with:
- DataManager.extractMetaData fails to distinguish types of data.
- DataManager.onLoad loads strictly in the order of actors, classes, skills, items, weapons, armors, enemies, troops, states, animations, tilesets, common events, system, and types. This becomes a problem when you need an actor notetag to reference something in say, an enemy notetag.
- Scene_Boot.start is a no go for me because some plugins completely overwrite it.
- Scene_Boot.create also gets overwritten in some plugins.
- Scene_Boot.terminate occurs too late, in some instances where functions that fun in Scene_Boot.start already occur and require the note data.
The error most likely came from the person tampering with the JSON file as there should be a notedata entry for each database entry.I received this report of an error occurring, which is what got me onto this topic: http://forums.rpgmakerweb.com/index.php?/topic/46515-preload-manager/?p=510196
Based on your code the error shouldn't really happen (it seems like one of the $data* arrays are nil in this example), so I'm not saying that the notetag reading being placed in the isDatabaseLoaded() function necessarily is the culprit, but it made me aware of it and I just see it as bad practice to put data altering code into a function meant to simply read the status of file loading. As you've seen I call this function repeatedly until I can ensure that the database is fully loaded, and I figure it's likely that many other plugins will do this too (it's why it's there), which means your notetags will be read over and over perhaps dozens of time on startup.
And what you consider to be bad practice, I consider to be perfectly fine. isDatabaseLoaded() should return true or false depending on if the entirity of the database is completely loaded, is it not? To me, I deem that the database is not completely loaded unless the notetag data within it is loaded and parsed. So unless my notetags, which I deem to be part of each and every database entry's data, are loaded, isDatabaseLoaded() returning true/false without my notetags loaded in there is delivering false information. If you are able to suggest a better timing for me to load notetags without encountering any of the above listed problems, I'll see to your suggestion.
And no, not really. I estimate that a good 99.99% of the plugins created now and within the future will not run DataManager.isDatabaseLoaded() any time past the initial opening steps. It's a one-to-two time run at best. This is because once the database is loaded, there is no further reason to check it again mid-game to see if it has been loaded.
Of course he/she will have to be 100% sure that his/her notetag reading codes will always work as intended :)Then Yanfly might do something like this to stick with his/her way:
SpoilerAuthorName.PluginName.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded = function() {
// Rewritten
if (!AuthorName.PluginName.DataManager_isDatabaseLoaded.call(this)) {
return false;
}
if (!this._isPluginNameNotesLoaded) {
this.loadAllPluginNameNotes();
}
return this._isPluginNameNotesLoaded;
//
}; // DataManager.isDatabaseLoaded
DataManager.loadAllPluginNameNotes = function() { // New
// The notetag reading codes go here
//
this._isPluginNameNotesLoaded = true;
} // DataManager.isDatabaseLoaded
Not quite, I've tried that before and sometimes, $data_ arrays reset themselves to their default editor state until isDatabaseLoaded is set true indefinitely. -
I remember old visual enemy have a selection window on their name
but now it only show name. please do it have window again if you think it better :)
thank you very much