QUOTE (Mr. Bubble @ Mar 10 2009, 11:16 AM)
Hey Mithran, I've made a script for myself similar to how stat parameters are drawn, but it's for an actor's elemental rate instead. Here's a small piece of it so you know the context I'm talking in:
class Window_Status < Window_Base
def draw_actor_element_rate(actor, x, y, type)
when 0 # Melee
parameter_icon = 132
parameter_value = actor.element_rate(1)
I've just tested it with the State Parameters+ script and it's working well. Though, with this, I realized that rate stacking isn't additive. Let's say I have two states applied on an actor at the same time. Each of these states provide 20% element resist to Melee. The result would be 36% resist. I know that this kind of rate stacking is like this by default and I'm going to go with that.
It should be simple, but I'm having trouble figuring out the stacking formula.
Also, stat rate stacking multiplicative (120% * 120% = 144%). Again, not a problem for me, but putting it out there in case anyone is wondering.
All in all, I also do much perfer rate application and only included the direct/additive application for special circumstances or for people who want that sort of system. Direct application is a lot less balanced for a base system, because you can stack to complete immunity and weaknesses dont get covered as well by resists.
If you wanted to use direct resist stacking rather than multiplicitave stacking, you just need to omit the percent (%) sign in the note tag. In other words, instead of:
/element 1 resist + 20%
(subtract 20% of whatever the calcualted element rate is, each appiled in turn)
(one of these would multiply the total rate by 0.8, two would multiply by 0.8 * 0.8, three would multiply the total rate by 0.8 * 0.8 * 0.8, etc)
You would type:
/element 1 resist + 20
(subtract 20 from the element rate directly)
(1 would subtract 20 from the rate, 2 would sutract 40, 3 would subtract 60, etc)
Dont use the equal sign without a percent though, because that is a special case that sets the base value instead.
/element 1 resist = 20
(base element rate becomes 20, only the highest display priority state value applies, this happens before other values are applied)
In the code, its about lines 1302 through 1337, divided into three methods. The seperate methods resolve each indiviudal value before applying them to the result. In hindsight, its probably a bit more confusing because you are applying element 'resists' instead of adding or subtracting directly from the rate, but I thought the language would be easier at the time. I'll probably eventually add the other language in addition to this (/element 1 rate + 20, etc) but its not a priority right now.
The formula for element rates goes pretty much like this:
initial = the letter value resist
initial becomes -100 if absorb is set (overriding the above)
initial becomes the new letter value if a new letter value is set (overriding both the above)
if the element absorbs (any negative element rate), no additional resists are applied. (this becomes the final result)
subtract the total additive resist rate (values without the percent sign)
calculate the multiplicative resist rate. Initial value is 100 (100% of the previous rate) and is each is applied in turn by the formula
"new value = last value * (100 - resist) / 100.0"
apply the rate to the above result
the minimum of the above result is capped at 0, therefore, adding resists in this way can never make an absorb value, the best they can do is immunity
And yes, the formula for rate based stat progression is exactly like the one used in the database. 120% rate on one and 120% rate on a second state is a 144% total rate (44% bonus). The plus and minus options here is are just different ways of writing it (/atk + 20% is the same as /atk = 120%; /atk - 20% is the same as /atk = 80%). Using exact values on base parameters (equal sign without the percent) however, makes them ignore all other states. I havent found a really useful application for this, so I am thinking about changing it to the same methods used in element/state resist rates, where if an exact value is set is simply overrides the base, allowing for other states to still modify it.
Understanding the difference between using rate and using direct/additive application is key to using this script, so if anyone has any further questions, please let me know.