Hello, I have a doubt
Well, I want to make a passive state (using Yanfly's script for that) to make a state like Serene grace for Pokemon, in case you don't know what I'm talking about, basically it works like this: it doubles the chance of adding a state with an attack (for example, if an attack has a 20% chance of adding x state, the chance will be increased to 40%) I actually COULD make this using the formula box, BUT I want it respects target's state rate, and that doesn't happen if I use the formula box.
Anyways, if you can solve this I'd be really grateful.
Serene grace-like state
● ARCHIVED · READ-ONLY
-
-
BUMP
-
BUMP
-
All right, I'll try it again, is there a way to make a state like that?
-
BUMP
-
you may want to try having the Serene Grace affect luck, as that influences the likelihood of inflicting a status. If it doubles your luck, then it should have a correlating effect on status infliction.
-
Isn't there another way? I don't want this is reflected in the statsyou may want to try having the Serene Grace affect luck, as that influences the likelihood of inflicting a status. If it doubles your luck, then it should have a correlating effect on status infliction.
-
You could put this:
b.add_state(n) if rand (100) * b.state_rate(n) > (b.state?(serene_grace) : (100 - state_chance) ? (100 - state_chance * 2)); damage
keep in mind I didn't test it -
Hi! sorry for delay, let's see, if I want an attack has a 20% of chance to add the poison state (40% with that serene grace-like state, it'd be the state id 41 for this case) and makes 500 of damage, it'd be:You could put this:
b.add_state(n) if rand (100) * b.state_rate(n) > (b.state?(serene_grace) : (100 - state_chance) ? (100 - state_chance * 2)); damage
keep in mind I didn't test it
b.add_state(2) if rand (100) * b.state_rate(2) > (b.state?(41) : (100 - 20) ? (100 - 20 * 2)); 500
Idk why but I'm reading that like the attack would have a 80% to add this state if it doesn't have the state (the 100 - 20 thing) but maybe I'm mistaken, could you explain the logic process behind this formula? I'm quite confused :l -
add state 2 if random number that can reach 100 multiplied by chance of getting the effect is greater than (if in state 41 it is greater than 80 (100 - 20), else it is greater than 60 (100 - 40, since it does the multiplication before the subtraction)).
the thing you are confusing is with the bigger than, means it will only apply the state if the random value is higher than 80, meaning 20% of chance.
Although now that I see it, I guess I made it a bit wrong, instead you should use
b.add_state(2) if rand (100) > (b.state?(41) : (100 - 20 * b.state_rate(2)) ? (100 - 20 * 2 * b.state_rate(2))); 500
since the other way it affects the random number, making it possible to be impossible to get an effect if the rate is too low but still not zero. 50% rate, for example, would already be impossible
it is too big for the skillbox though, you'd need to make this to get it to work... -
Would it be something like that?
class Game_Battler < Game_BattlerBase
def custom_damage_poison(a, B)
b.add_state(2) if rand (100) > (b.state?(41) : (100 - 20 * b.state_rate(2)) ?
(100 - 20 * 2 * b.state_rate(2))); 500
end
end
And then put that in the damage box: a.custom_damage_poison(a, B) right? -
think so. to tell the truth I didn't try it yet, didn't make a skill that required me to use it on my game yet.
-
It shows this mistake:
Formal argument cannot be a constant
def custom_damage_poison(a, B)
What does it mean with formal argument? sorry, I'm quite dumb for this scripting part -
you are using upper case B, you have to use lower case b. Upper case is reserved for constants, which you can't use there according to the error.
-
Another mistake :l

I have made damage formulas with script commands, but I have used the if x; a; else; b; end format, I don't know how to adapt this formula to this format
Again, I'm quite dumb with this -
sorry, my fault this time, didn't even notice I inverted the ? and the :
Code:class Game_Battler < Game_BattlerBase def custom_damage_poison(a, b.add_state(2) if rand (100) > (b.state?(41) ? (100 - 20 * b.state_rate(2)) : (100 - 20 * 2 * b.state_rate(2))); 500 endend -
Well, it doesn't show mistake anymore, but skill is not working, it's not doing any damage and the test has used this attack like 15 times but it hasn't added this state (even when I put the posibility to 50%)
-
been testing it, and the problem seems to be
the add_state... weird...
no, the problem was the space in rand (100), it is supposed to be rand(100), sorry.
Try this now:
class Game_Battler < Game_BattlerBase def custom_damage_poison(a, b.add_state(2) if rand(100) > (b.state?(41) ? (100 - 20 * 2 * b.state_rate(2)) : (100 - 20 * b.state_rate(2))); 500 endendYou'll notice I changed something else, the state was instead of increasing the chance of getting the state when iin Serene Grace, increasing when without. sorry again. -
Tested and it works, Thank you! Just a little mistake, I almost didn't notice it, but the idea was the caster of the spell would have this state to increase the chance to add states, so it'd be a.state, no b.state, but well, it works nowbeen testing it, and the problem seems to be
the add_state... weird...
no, the problem was the space in rand (100), it is supposed to be rand(100), sorry.
Try this now:
class Game_Battler < Game_BattlerBase def custom_damage_poison(a, b.add_state(2) if rand(100) > (b.state?(41) ? (100 - 20 * 2 * b.state_rate(2)) : (100 - 20 * b.state_rate(2))); 500 endendYou'll notice I changed something else, the state was instead of increasing the chance of getting the state when iin Serene Grace, increasing when without. sorry again. -
Uhhh hi again, I have been looking for this and I have another question, with this formula, the luck is irrelevant, right? I mean the luck stat normally has effect when adding a state, but with this formula it doesn't have any effect, right?