You do not have to include the .png in the filename, I just put that there to suggest that it was the image's filename. The battle system automatically finds the battler graphic from the start, my little snippet just lets the OP change it whenever. (Actually, I'm not 100% sure that NeonBlack's BS sets it from the get-go, but we'll find out, won't we? Honestly this code was off of my cuff; I don't have RM in front of me.)
I haven't figured out a general solution but you may want to try a case-specific approach which requires scripting knowledge yourself or asking scripters to do these for you per request:
Instead of changing the notetag data of $data_actors(or RPG::Actor) directly, make new instance variables of $game_actors overriding those notetag data when some game switches are ON. For example:
module Whatever_Note Note_Symbol = [:whatever_note_1, :whatever_note_2, :whatever_note_3, ..., :whatever_note_n] Override_Switch = [switch_id_1, switch_id_2, switch_id_3, ..., switch_id_n]endclass Game_Actor < Game_Battler # new public instance variable attr_accessor :whatever_note # alias method: initialize alias initialize_whatever initialize def initialize(actor_id) initialize_whatever(actor_id) initialize_whatever_note end # new method: initialize_whatever_note def initialize_whatever_note @whatever_note ||= {} Whatever_Note::Note_Symbol.each { |symbol| @whatever_note[symbol] ||= "" end endend
Then depending on what particular notes you want to override and how those notes are implemented by their scripts, modify those methods to let the game actors use @whatever_note instead of their original notetag:
alias original_whatever_note_method whatever_note_methoddef whatever_note_method if $game_switches[Whatever_Note:verride_Switch[x]] && @whatever_note[Whatever_Note::Note_Symbol[x]] != "" override_whatever_note_method else original_whatever_note_method endend
Sometimes you may have to rewrite the methods instead of just aliasing them.
and $game_actors[actor_id] should use "whatever_note_x" instead of the original notetag if $game_switches[switch_id_x] is true.
It doesn't modify the orignal notetag data and you can switch between them and the whatever_note whenever you want just by using the game switches in Whatever_Note module.
Using a part of my dynamic cost script as an example:
class Game_BattlerBase #----------------------------------------------------------------------------| # Alias method: skill_mp_cost | #----------------------------------------------------------------------------| alias skill_mp_cost_dynamic_cost skill_mp_cost def skill_mp_cost(skill) skill_mp_cost_dynamic_cost(skill) + (dynamic_cost("mp") ? dynamic_skill_mp_cost(skill) : 0) end # skill_mp_cost #----------------------------------------------------------------------------| # Alias method: skill_tp_cost | #----------------------------------------------------------------------------| alias skill_tp_cost_dynamic_cost skill_tp_cost def skill_tp_cost(skill) skill_tp_cost_dynamic_cost(skill) + (dynamic_cost("tp") ? eval("(" + skill.dynamic_tp + ").to_i") : 0) end # skill_mp_cost #----------------------------------------------------------------------------| # New method: dynamic_skill_mp_cost | #----------------------------------------------------------------------------| def dynamic_skill_mp_cost(skill) eval("((" + skill.dynamic_mp + ")" + (DoubleX_RMVXA:ynamic_Cost::Multiply_MCR ? " * mcr" : "") + ").to_i") end # dynamic_skill_mp_cost #----------------------------------------------------------------------------| # New method: dynamic_cost | #----------------------------------------------------------------------------| def dynamic_cost(cost) states.each { |state| return true if eval("state.dynamic_" + cost) } false end # dynamic_costend # Game_BattlerBase
skill.dynamic_mp is a $data_skills(or RPG::Skill) notetag. Suppose I want to use something else instead of that notetag when I want, I can add the below snippet:
module Whatever_Note Note_Symbol = [:dynamic_mp] Override_Switch = [switch_id_1]endclass Game_BattlerBase attr_accessor :whatever_note alias initialize_whatever_note initialize def initialize initialize_whatever_note @whatever_note ||= {} Whatever_Note::Note_Symbol.each { |symbol| @whatever_note[symbol] ||= "" } end alias dynamic_skill_mp_cost_whatever_note dynamic_skill_mp_cost def dynamic_skill_mp_cost(skill) if $game_switches[Whatever_Note:verride_Switch[0]] && @whatever_note[Whatever_Note::Note_Symbol[0]] != "" eval(@whatever_note[Whatever_Note::Note_Symbol[0]]) else dynamic_skill_mp_cost_whatever_note(skill) end end # dynamic_skill_mp_costend
Now if $game_switches[switch_id_1] is true and you used a script call:
$game_actors[actor_id] should use "whatever_dynamic_mp" instead of the original notetag to evaluate the dynamic mp.
It didn't modify the original skill.dynamic_mp notetag. It just uses your @whatever_note instead of the original notetag whenever you want. You can always switch between them as you wish.
For example, if the original notetag was "self.def" and you want to change it to "self.def * 0.5", using the above script call with "whatever_dynamic_mp" being "self.def * 0.5" should do the trick.
If you want to use the original "self.def" notetag again, just set $game_switches[switch_id_1] as false. So now you can switch between these 2 notetags just by using that game switch.
Of course this case-specific approach needs scripting knowledge and understanding of those particular scripts involved with the notetags you want to override on the fly, so you'll either have to ask someone capable to do these for you per specific request or learn how to script yourself
At the end, a general solution is of course better but a case-specific approach is all I can come up with right now
Zoltor, the only reason it would ever be a "bad idea" to change the note tag contents of an Actor is because most script authors don't actually bother checking what the value of the note tag is -- instead, they assume that the value won't change and cache the information. For some reason, they assume that this will bring some "performance benefit" over making a call to the note method which -- at its absolute worst -- generates a single string which will most likely either be used or garbage collected.
Compared to the egregious abuse of iterations, for loops, poor Bitmap management and overall slipshod programming I've seen from the majority of the scripting community, generating a single string every once in a while hardly seems like a problem.
I'm not sure that I agree with the implication that it is a bad idea to preserve the data you are collecting from a note tag. Even if the performance issue is usually negligible, I don't see a reason to repeatedly access a data object and parse the string to extract the information I want from it. If it is a value that the script will change as the game progresses (such as the initial value of a new stat for actors), I would save it with each instance of the Game_Whatever class in the game data (though in that case I would probably not save it as an instance variable in the data object). If it is a value that I want the user to be able to change manually as the game progresses, then I would provide a mechanism to do that instead of relying on the person finding some way to alter the note tag in-game (for which there is no default mechanism). And even when I expect the data to remain constant, I don't see why I shouldn't just initialize it the first time I need it and save it for the run-time at least if I am going to need it frequently.
I really only wouldn't when I don't expect to access the particular data often. For the new stat example, for instance, I would save the value in the Game_Actor instance when it is first initialized, but I probably wouldn't save it in the RPG::Actor class. That is because it seems unlikely that the same actor would be initialized more than once in the same play-through, and for most plays would never be.
Put another way, I don't think it's bad to assume that the notetag data will not change during a play, any more than it would be bad to assume that any other data from a data file will not change.
Mind you, I don't have any programming background, and I am probably one of the worst offenders for the other things you mention in your post. I might just be missing something.
Agreed. All my scripts using notes read them once at the start of the game, and put the data into instance variables. Any changes are to the instance variables, not to the notes. So there's no reason to keep reading the notes. I also do this with scripts that utilize the event comments to do stuff - set it all up when the event page is loaded/activated, so I don't have to check through the list every single time I reference the event to see if it's got a particular setting.
And would you need to make these calls right at the start of the game, or would it pick it up correctly from the note tag the first time, then you just use the above to change it?
I didn't see the second page of the thread until after I posted that. I was talking about something on page one. Nevermind me, I blame sleep deprivation lol
But you don't, because NeonBlack's script initializes the values from when the actor is setup, via the Game_Actor#setup method (he / she aliases it, and it is called by Game_Actor's #initialize method, so no need to create the instance variables on the fly).
Also, not sure why you'd need to update two strings...but the snippet I've posted works as-is. No strings attached. Hahaha (pitiful joke, but lol).
But you don't, because NeonBlack's script initializes the values from when the actor is setup, via the Game_Actor#setup method (he / she aliases it, and it is called by Game_Actor's #initialize method, so no need to create the instance variables on the fly).
Also, not sure why you'd need to update two strings...but the snippet I've posted works as-is. No strings attached. Hahaha (pitiful joke, but lol).
I'm not sure that I agree with the implication that it is a bad idea to preserve the data you are collecting from a note tag. Even if the performance issue is usually negligible, I don't see a reason to repeatedly access a data object and parse the string to extract the information I want from it. If it is a value that the script will change as the game progresses (such as the initial value of a new stat for actors), I would save it with each instance of the Game_Whatever class in the game data (though in that case I would probably not save it as an instance variable in the data object). If it is a value that I want the user to be able to change manually as the game progresses, then I would provide a mechanism to do that instead of relying on the person finding some way to alter the note tag in-game (for which there is no default mechanism). And even when I expect the data to remain constant, I don't see why I shouldn't just initialize it the first time I need it and save it for the run-time at least if I am going to need it frequently.
I really only wouldn't when I don't expect to access the particular data often. For the new stat example, for instance, I would save the value in the Game_Actor instance when it is first initialized, but I probably wouldn't save it in the RPG::Actor class. That is because it seems unlikely that the same actor would be initialized more than once in the same play-through, and for most plays would never be.
Put another way, I don't think it's bad to assume that the notetag data will not change during a play, any more than it would be bad to assume that any other data from a data file will not change.
Mind you, I don't have any programming background, and I am probably one of the worst offenders for the other things you mention in your post. I might just be missing something.
Honestly, I just stated my points rather poorly. Really, the core issue with note tag caching, to me, is that most script authors make absolutely no attempt to make the values they gather dynamic. By not caching the information -- just gathering it when needed -- the entire script instantly becomes far more reactive. This, in effect, gives script users far more freedom when making use of such scripts (battle systems, in particular, would really benefit from a more dynamic approach). The fact that RPG Maker itself doesn't easily allow dynamic modification of note tag information is a secondary concern to me, personally -- there are numerous ways to approach that problem.
In short, I actually agree with everything that you just said -- for any script author who knows what they're doing, all of the options you presented are far better than collecting a note and parsing it. For every decent usage of note caching I see, though, I see another example of it done poorly, introducing arbitrary limitations that can be difficult for individual users to work around.
(Admittedly, my disdain for this kind of note tag caching also comes from the fact that I wrote a script which would dynamically generate note tag contents and got numerous "bug reports" about it not working when it actually was -- the problem was a script which cached the information and didn't react to the dynamic note tag value.)
Edit: The existence of this topic, by the way, is what I'm talking about when I mention note caching introducing arbitrary limitations (in combination with RPG Maker's inability to save changed note tag information to the save file by default, of course).
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
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.
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.