Conditioned Traits Stacking (Solved)

So I'm experimenting with lots of scripts at the moment to try to get a feel for different ones and different features that work well in my system. In the future I am going to be building the game I'm working on from the ground up with all my own scripts but it's nice to get a feel for how other scripts run with your own and which methods of doing things work best.

I have a script I wrote that has variables and under certain conditions I want it to decrease the ATK, DEF, MATK, MDEF and AGI parameters and I've been looking at different ways of approaching this.

At the moment I'm experimenting with Kread-EX's Conditioned Traits which allows me to put a notetag in the class of the actor I wants stats reduced and link it to a switch, I can then within my script put in code so that it switches the game switch on if the conditions are met and off if they are not so that the stats changes can go through and in essence, I thought this might be a good way to do it.

Within my script I have something along these lines:

module Settings # Enable V EnableVA = true EnableVB = true EnableVC = true EnableVD = true EnableVE = false # Start Values for V StartVA = 100 StartVB = 100 StartVC = 100 StartVD = 100 StartVE = 0 # Point at which Stats Decrease VAStatDecrease = 60 VBStatDecrease = 40 VCStatDecrease = 40 VDStatDecrease = 40 VEStatDecrease = 300 # Defining Variable Settings def self.create_V_commands $V_v = V_Variables.new $V_v[1] = StartVA $V_v[2] = StartVB $V_v[3] = StartVC $V_v[4] = StartVD $V_v[5] = StartVE endendclass Game_Actor < Game_Battler if $V_v[1] <= Settings::VAStatDecrease && Settings::EnableVA == true $game_switches[8] == true endendNow I've set up Game Switches 8, 9, 10, 11 and 12 all to do different stat decreases in the traits menu using Kread-Ex's Conditioned Traits, switch 8 sets the stats to 80%, 9 to 60%, 10 to 40%, 11 to 20% and at the moment I'm not using 12, it was extra I put in my code as an idea I don't actually need in my game for the possibility I might release the completed script to the public once I'm done with it.

So, if we're just going by the first 4 (5 if you wish but it'll likely be more complex) I was looking for a way to set it so that like in the code above, if the variable $V_v value of each is less than the value set in the VStatDecrease and it's Enabled, then the game switches will trigger, but I want it to stack, so if 2 of them are less than their defined value, the first switch untriggers (to prevent errors) and the next triggers so the stats are reduced by 20% if one is too low, 40% if two are too low, etc...

The $V_v values are all altered elsewhere in my script and it all works perfectly in the fashion I want it to meaning all the values and variables defined here will work in the way I've described, It's more a problem with structuring this complicated mess of if weavery.

I guess my question is, does anyone have any suggestions of either a simpler method of doing what I am currently doing or can anyone assist in the structuring of this complicated things so that I don't end up with strings of IF IF IF IF taking up most of my script.

Also, I am aware I put part of the script in the Game_Actor class, the reason for this was my previous experimentation with stats was in this place and I'm not really sure which class to move this into yet so I've just kept it here.

All comments and suggestions are welcome.
I look forward to your replies.

EDIT:
I was looking through my old posts and forgot I'd posted this here. In the end like with all my work, I try to replace old scripts with my own devices and managed to trigger parameter changes through my own scripting without the use of KREAD's script.

As my problem has been solved, it can be marked as such and closed.

Original thread: https://forums.rpgmakerweb.com/threads/conditioned-traits-stacking-solved.18348/