So I might just be missing something but here's the problem I've been having. I have added some stats to Game_BatterBase to keep track of some values for me. Normal enough.
Object.defineProperties(Game_BattlerBase.prototype, { hpgr: { writable: true, value: Compat.Param.HPGrowthRate }, hpgmin: { writable: true, value: Compat.Param.HPGrowthMax }, hpgmax: { writable: true, value: Compat.Param.HPGrowthMin } });The Compat.Param.* guys are just the defaults as defined in the plugin's parameters in RPG Maker MV setup by the user.
Now, that all seems to work fine and when I call something like actorObject.hpgr it'll return the variables I want. So far so good. The problem comes in when I try to modify those values through notetags.
I've decided to just make my plugin require the Yanfly Core since I'm not sure I want to release my spaghetti into the world, so I piggy-backed on his code when it gets all of the notetags and added in my own grab after his like this:
Compat.BE.DataManager_processCORENotetages3 = DataManager.processCORENotetags3;DataManager.processCORENotetags3 = function(group) { Compat.BE.DataManager_processCORENotetages3(group); for (var n = 1; n < group.length; n++) { var obj = group[n]; var notedata = obj.note.split(/[\r\n]+/); obj.hpgr = Compat.Param.HPGrowthRate; for (var i = 0; i < notedata.length; i++) { var line = notedata; if (line.match(/<(?:HPGR):[ ](\d+.?\d+?)>/i)) { obj.hpgr = parseFloat(RegExp.$1); if (obj.hpgr < 0) obj.hpgr = 0; } } }};Pretty wonky but right now I'm just trying to get the HPGR value alone and once I can get that one working I'll make it work a little bit more elegantly for grabbing a large amount of extra statistics. Anyway, this code actually works fine. The problem is, obj doesn't appear to be a Game_Actor (as I found out when I sent the obj to console_log(obj)).
Not sure what to do as everything appears to be functioning correctly, but it just refuses to save the newly created parameter's value from the notetag during processCORENotetags3.
I hope I've provided enough information to get help here. I know the code is pretty copy/pasta, which is also why this is so confusing. I had originally tried to write the notetag getter on my own but it didn't work so I tried doing what other people had done and still nothing. Any help would be appreciated. Thanks!
Object.defineProperties(Game_BattlerBase.prototype, { hpgr: { writable: true, value: Compat.Param.HPGrowthRate }, hpgmin: { writable: true, value: Compat.Param.HPGrowthMax }, hpgmax: { writable: true, value: Compat.Param.HPGrowthMin } });The Compat.Param.* guys are just the defaults as defined in the plugin's parameters in RPG Maker MV setup by the user.
Now, that all seems to work fine and when I call something like actorObject.hpgr it'll return the variables I want. So far so good. The problem comes in when I try to modify those values through notetags.
I've decided to just make my plugin require the Yanfly Core since I'm not sure I want to release my spaghetti into the world, so I piggy-backed on his code when it gets all of the notetags and added in my own grab after his like this:
Compat.BE.DataManager_processCORENotetages3 = DataManager.processCORENotetags3;DataManager.processCORENotetags3 = function(group) { Compat.BE.DataManager_processCORENotetages3(group); for (var n = 1; n < group.length; n++) { var obj = group[n]; var notedata = obj.note.split(/[\r\n]+/); obj.hpgr = Compat.Param.HPGrowthRate; for (var i = 0; i < notedata.length; i++) { var line = notedata; if (line.match(/<(?:HPGR):[ ](\d+.?\d+?)>/i)) { obj.hpgr = parseFloat(RegExp.$1); if (obj.hpgr < 0) obj.hpgr = 0; } } }};Pretty wonky but right now I'm just trying to get the HPGR value alone and once I can get that one working I'll make it work a little bit more elegantly for grabbing a large amount of extra statistics. Anyway, this code actually works fine. The problem is, obj doesn't appear to be a Game_Actor (as I found out when I sent the obj to console_log(obj)).
Not sure what to do as everything appears to be functioning correctly, but it just refuses to save the newly created parameter's value from the notetag during processCORENotetags3.
I hope I've provided enough information to get help here. I know the code is pretty copy/pasta, which is also why this is so confusing. I had originally tried to write the notetag getter on my own but it didn't work so I tried doing what other people had done and still nothing. Any help would be appreciated. Thanks!