Serene grace-like state

hmm... maybe b.luk_effect_rate(a)? Not sure, I honestly forgot all about the "luck" status 😛
According to help window, it works like this:

The change in states and debuff effectiveness due to luck is as shown below. Note, however, that 0 is the lower limit.

Chance (%) = 100 + (user's luck - target's luck) ÷ 10 So, is there a way to apply that in the damage formula you made?

 
let's do one better: let's remake the formula so it not only fixes this lack and another I figured out, let's make it more generic so you can call the same code for every state attack instead of making one for each state.

class Game_Battler < Game_BattlerBase def custom_damage_state(a, b, state, state_chance, damage) (b.state?(41) ? (100 - 20 * 2 * b.state_rate(2)) : (100 - 20 * b.state_rate(2))); chance = state_chance chance *= b.state_rate(state) chance *= a.atk_states_rate(state) chance *= b.luk_effect_rate(a) chance /= 2 if b.state?(41) b.add_state(2) if rand(100) < chance damage endendthis way you'll call your poison skill with a.custom_damage_state(a, b, 2, 20, 500)

didn't test yet, but it is based on the normal add_state, so it should work.
let's do one better: let's remake the formula so it not only fixes this lack and another I figured out, let's make it more generic so you can call the same code for every state attack instead of making one for each state.

class Game_Battler < Game_BattlerBase def custom_damage_state(a, b, state, state_chance, damage) (b.state?(41) ? (100 - 20 * 2 * b.state_rate(2)) : (100 - 20 * b.state_rate(2))); chance = state_chance chance *= b.state_rate(state) chance *= a.atk_states_rate(state) chance *= b.luk_effect_rate(a) chance /= 2 if b.state?(41) b.add_state(2) if rand(100) < chance damage endendthis way you'll call your poison skill with a.custom_damage_state(a, b, 2, 20, 500)

didn't test yet, but it is based on the normal add_state, so it should work.
Just a dumb question

Considering it'd be more generic, that means I can put any single state with any percent and any damage, using this damage formula, why in the script it looks like it only affect the state id 2 with 20%? I meant specially by this part

(b.state?(41) ? (100 - 20 * 2 * b.state_rate(2)) : (100 - 20 * b.state_rate(2)));

Also, I guess it's almost the same if I want to make the same for an attack adds a debuff, right?

Sorry if I'm asking/requesting too much
Because I forgot to remove that line 😛

Sorry, here is the right code:

class Game_Battler < Game_BattlerBase def custom_damage_state(a, b, state, state_chance, damage) chance = state_chance chance *= b.state_rate(state) chance *= a.atk_states_rate(state) chance *= b.luk_effect_rate(a) chance /= 2 if b.state?(41) b.add_state(2) if rand(100) < chance damage endendonly if  your "debuff" is a state, the actual debuff option is a bit different, although I'm not sure how much
Is the "b.add_state(2) if rand(100) < chance" still necessary for the general state formula? It sounds quite specific with the state id and all that
ops, let it pass again, sorry.

this one should work

class Game_Battler < Game_BattlerBase def custom_damage_state(a, b, state, state_chance, damage) chance = state_chance chance *= b.state_rate(state) chance *= a.atk_states_rate(state) chance *= b.luk_effect_rate(a) chance /= 2 if b.state?(41) b.add_state(state) if rand(100) < chance damage endendSorry for all the mistakes
ops, let it pass again, sorry.

this one should work

class Game_Battler < Game_BattlerBase def custom_damage_state(a, b, state, state_chance, damage) chance = state_chance chance *= b.state_rate(state) chance *= a.atk_states_rate(state) chance *= b.luk_effect_rate(a) chance /= 2 if b.state?(41) b.add_state(state) if rand(100) < chance damage endendSorry for all the mistakes
Thanks a lof for the help, just a last question... Multipling a.atk_states_rate(state) by b.luk_effect_rate(a) has the same effect than (a.luck-b.luck)/10, just like the luck state has effect in the game?
what? no!

b.state_rate is the chance of b getting the state
a.atk_states_rate is the chance of a adding the effect to a b with 100%
b.luk_effect_rate(a) is where luck is calculated.
Woah, I misreaded what you wrote, sorry

Anyways, tested and even when the user of this attack has 999 of luck and 100% of chance to add it, it just doesn't add the state, odd...
even without the Serene Grace?

try this one:
 

Code:
class Game_Battler < Game_BattlerBase  def custom_damage_state(a, b, state, state_chance, damage)    chance = state_chance    chance *= b.state_rate(state)    chance *= b.luk_effect_rate(a)    chance *= 2 if a.state?(41)    b.add_state(state) if rand(100) <= chance    damage  endend
 

removed the chance *= a.atk_states_rate(state) line, it was the problem. it is for something else, not this
even without the Serene Grace?

try this one:

class Game_Battler < Game_BattlerBase def custom_damage_state(a, b, state, state_chance, damage) chance = state_chance chance *= b.state_rate(state) chance *= b.luk_effect_rate(a) chance *= 2 if a.state?(41) b.add_state(state) if rand(100) <= chance damage endend 

removed the chance *= a.atk_states_rate(state) line, it was the problem. it is for something else, not this
Now it does work, wow, it's really cool seeing those ideas in process, thanks a lot :3

Original thread: https://forums.rpgmakerweb.com/threads/serene-grace-like-state.27287/