Database Efficiency - Reduce States Needed

Forgive me if I’ve posted this in the wrong section or fail to explain the problem properly; this question isn’t very specific. This is a technical challenge that I’m certain has a verity of different approaches. I would appreciate any and all ideas if you guys have any. I’ll explain it as thoroughly as possible.

YSA Battle System: Classical ATB

YSA Battle Add-on: Lunatic CATB

Sample Video

The main issue I had with this battle system was how over-powered agility changes were. When agility is increased, you take turns more often and skills charge faster, the opposite happens when agility is decreased of course. I wanted to fix this, so I used Lunatic CATB to create formulas which adjust turn-speed and skill charge speed separately.

#---------------------------------------------------------------------- # ATB Rate Formula No.R1: CHANNEL BOOST # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Boost ATB Charge rate by x percents. # # Formula notetag: # <custom catb rate: channel boost x%> #---------------------------------------------------------------------- when /CHANNEL BOOST[ ](\d+)([%��])/i if @catb_value >= MAX_CATB_VALUE && @ct_catb_value < MAX_CATB_VALUE value_percent += $1.to_i else value_percent += 0 end #---------------------------------------------------------------------- # ATB Rate Formula No.R2: CHANNEL REDUCE # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Reduce ATB Charge rate by x percents. # # Formula notetag: # <custom catb rate: channel reduce x%> #---------------------------------------------------------------------- when /CHANNEL REDUCE[ ](\d+)([%��])/i if @catb_value >= MAX_CATB_VALUE && @ct_catb_value < MAX_CATB_VALUE value_percent = [value_percent - $1.to_i, 1].max else value_percent = [value_percent - 0, 1].max end #---------------------------------------------------------------------- # ATB Rate Formula No.R3: SPEED BOOST # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Reduce ATB Charge rate by x percents. # # Formula notetag: # <custom catb rate: speed boost x%> #---------------------------------------------------------------------- when /SPEED BOOST[ ](\d+)([%��])/i if @catb_value < MAX_CATB_VALUE && @ct_catb_value < 1 value_percent += $1.to_i else value_percent += 0 end #---------------------------------------------------------------------- # ATB Rate Formula No.R3: SPEED REDUCE # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Reduce ATB Charge rate by x percents. # # Formula notetag: # <custom catb rate: speed reduce x%> #---------------------------------------------------------------------- when /SPEED REDUCE[ ](\d+)([%��])/i if @catb_value < MAX_CATB_VALUE && @ct_catb_value < 1 value_percent = [value_percent - $1.to_i, 1].max else value_percent = [value_percent - 0, 1].max end The problem is applying these changes to the current system as efficiently as possible as I'll probably be working with notetags or code, instead of features. For example:

speed2.PNG

speed1.PNG

This state handles every level of speed reduction and the number of turns the state will last. When the skill applying this state is used, all the necessary adjustments are made before the state is applied. Due to recent changes, agility is no longer directly affected by speed debuffs/increases. This means that I can no longer use this method to reduce the number of state items in my database. I need a way to do something similar or at least maintain some of the efficiency of this state. It’s really important that I’m able to reduce the number of individual items in my database (because there's a lot of them already).

I want to apply the changes to how speed works without having to notetag each individual state(too many extra states that do the same thing). Any script suggestions or possibly eventing techniques are welcome.
So you want to write everything in that script instead of writing notetags on those states' noteboxes right?

If that's the case, try this snippet:

Spoiler
class RPG::State < RPG::BaseItem def load_notetags_lcatbra super case @id when x1 @catb_rate += [string_x1_1, string_x1_2, string_x1_3, ..., string_x1_n] when x2 @catb_rate += [string_x2_1, string_x2_2, string_x2_3, ..., string_x2_n] when x3 @catb_rate += [string_x3_1, string_x3_2, string_x3_3, ..., string_x3_n] ... when xm @catb_rate += [string_xm_1, string_xm_2, string_xm_3, ..., string_xm_n] end end # load_notetags_lcatbraend # RPG::State
Where xi is the id of states that affect the atb rate, and string_xi_j are string in <custom catb rate: string>.

P.S.: This might also help:

Some Hidden YSA Battle System: Classical ATB Tips And Tricks
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
So you want to write everything in that script instead of writing notetags on those states' noteboxes right?

If that's the case, try this snippet:

Spoiler
class RPG::State < RPG::BaseItem def load_notetags_lcatbra super case @id when x1 @catb_rate += [string_x1_1, string_x1_2, string_x1_3, ..., string_x1_n] when x2 @catb_rate += [string_x2_1, string_x2_2, string_x2_3, ..., string_x2_n] when x3 @catb_rate += [string_x3_1, string_x3_2, string_x3_3, ..., string_x3_n] ... when xm @catb_rate += [string_xm_1, string_xm_2, string_xm_3, ..., string_xm_n] end end # load_notetags_lcatbraend # RPG::State
Spoiler
Where xi is the id of states that affect the atb rate, and string_xi_j are string in <custom catb rate: string>.

P.S.: This might also help:

Some Hidden YSA Battle System: Classical ATB Tips And Tricks
Actually, I'm attempting to maintain the functionality of the previous state by having these notetags apply different values based on a variable set by the skill which applies the state.

In the example I provided, the skill "Tornado" mentions "Slow by 40%". This just means the skill reduces Agility by 40%. You'll see "<state 3 turn: +3>" which sets the number of turns the state will last (0 if not set). You can't see this in the screenshot, but there's a formula that sets variable 1000 to 4. On the state, all of the listed features have conditions that must be met. When variable 1000 == 4, Agility is multiplied by 60%. This allows me to get different values from a single Slow state without having to fill my database.

Second Example: Your character has two skills, one reduces agility by 50%, the other reduces agility by 30%. Normally, you'd need two separate states for that. I solved this problem previously, however, I'm not working with features anymore so the implementation has to change.

Problem is, I'm no longer using Agility to modify turn and channel speed, so I have to take a different approach.
Actually, I'm attempting to maintain the functionality of the previous state by having these notetags apply different values based on a variable set by the skill which applies the state.

In the example I provided, the skill "Tornado" mentions "Slow by 40%". This just means the skill reduces Agility by 40%. You'll see "<state 3 turn: +3>" which sets the number of turns the state will last (0 if not set). You can't see this in the screenshot, but there's a formula that sets variable 1000 to 4. On the state, all of the listed features have conditions that must be met. When variable 1000 == 4, Agility is multiplied by 60%. This allows me to get different values from a single Slow state without having to fill my database.

Second Example: Your character has two skills, one reduces agility by 50%, the other reduces agility by 30%. Normally, you'd need two separate states for that. I solved this problem previously, however, I'm not working with features anymore so the implementation has to change.

Problem is, I'm no longer using Agility to modify turn and channel speed, so I have to take a different approach.
Something like these might work:

Spoiler
#---------------------------------------------------------------------- # ATB Rate Formula No.R1: CHANNEL BOOST # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Boost ATB Charge rate by x percents. # # Formula notetag: # <custom catb rate: channel boost x%> #---------------------------------------------------------------------- when /CHANNEL BOOST[ ](\d+)([%��])/i if @catb_value >= MAX_CATB_VALUE && @ct_catb_value < MAX_CATB_VALUE value_percent += $game_variables[$1.to_i] else value_percent += 0 end #---------------------------------------------------------------------- # ATB Rate Formula No.R2: CHANNEL REDUCE # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Reduce ATB Charge rate by x percents. # # Formula notetag: # <custom catb rate: channel reduce x%> #---------------------------------------------------------------------- when /CHANNEL REDUCE[ ](\d+)([%��])/i if @catb_value >= MAX_CATB_VALUE && @ct_catb_value < MAX_CATB_VALUE value_percent = [value_percent - $game_variables[$1.to_i], 1].max else value_percent = [value_percent - 0, 1].max end #---------------------------------------------------------------------- # ATB Rate Formula No.R3: SPEED BOOST # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Reduce ATB Charge rate by x percents. # # Formula notetag: # <custom catb rate: speed boost x%> #---------------------------------------------------------------------- when /SPEED BOOST[ ](\d+)([%��])/i if @catb_value < MAX_CATB_VALUE && @ct_catb_value < 1 value_percent += $game_variables[$1.to_i] else value_percent += 0 end #---------------------------------------------------------------------- # ATB Rate Formula No.R3: SPEED REDUCE # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Reduce ATB Charge rate by x percents. # # Formula notetag: # <custom catb rate: speed reduce x%> #---------------------------------------------------------------------- when /SPEED REDUCE[ ](\d+)([%��])/i if @catb_value < MAX_CATB_VALUE && @ct_catb_value < 1 value_percent = [value_percent - $game_variables[$1.to_i], 1].max else value_percent = [value_percent - 0, 1].max end
Now x becomes the id of the variable to be used 🙂
I face-palmed when I saw your post lol, so obvious now. Thanks a lot DoubleX, that did the trick.

Original thread: https://forums.rpgmakerweb.com/threads/database-efficiency-reduce-states-needed.45396/