Script that displays state rate?

Hey I'm looking for a script that displays state rate whenever a state is attempted to be applied. Something like the popups from Yanfly's Buff and State Manager but with some kind of chance display, like '+statename 80%' or 'xstatename 80%' when a state with 80% application rate applys or not, or even just something simpler that somehow shows whether a state application skill had a high or low chance of working when used. I found the Himeworks script 'state rate popups' here:
but it only shows if an enemy has state resistance or not, and doesnt seem to have any way to show how much, or if a skill just has a naturally low chance of applying it. Does anyone know if theres a good script out there for what I'm looking for?
add to the script you mentioned
Ruby:
class Game_BattlerBase
  #-----------------------------------------------------------------------------
  # Create the state chance rate popup.
  #-----------------------------------------------------------------------------
  def make_state_chance_rate_popup(state_id)
    rate = state_rate(state_id)
    return if rate < 0 || rate >= 1.0
    state = $data_states[state_id]
    return if state.icon_index == 0
    flags = ["state", state.icon_index]
    dr = (rate*100).to_i
    text = "#{dr} % #{state.name}"
    rules = "DEFAULT"
    create_popup(text, rules, flags)
  end
end

class Game_Battler < Game_BattlerBase
 
  def item_effect_add_state_normal(user, item, effect)
    old_states = @states.clone
    th_state_rate_popup_item_effect_add_state_normal(user, item, effect)
    new_states = @states - old_states
    make_state_chance_rate_popup(effect.data_id)
    make_state_rate_popup(effect.data_id) unless dead? || new_states.include?(effect.data_id)
  end
end
But this only displays the state rate on the enemy. To get the actor chance to apply is a value that is not in this method. I'll keep looking to find that.
add to the script you mentioned
Ruby:
class Game_BattlerBase
  #-----------------------------------------------------------------------------
  # Create the state chance rate popup.
  #-----------------------------------------------------------------------------
  def make_state_chance_rate_popup(state_id)
    rate = state_rate(state_id)
    return if rate < 0 || rate >= 1.0
    state = $data_states[state_id]
    return if state.icon_index == 0
    flags = ["state", state.icon_index]
    dr = (rate*100).to_i
    text = "#{dr} % #{state.name}"
    rules = "DEFAULT"
    create_popup(text, rules, flags)
  end
end

class Game_Battler < Game_BattlerBase
 
  def item_effect_add_state_normal(user, item, effect)
    old_states = @states.clone
    th_state_rate_popup_item_effect_add_state_normal(user, item, effect)
    new_states = @states - old_states
    make_state_chance_rate_popup(effect.data_id)
    make_state_rate_popup(effect.data_id) unless dead? || new_states.include?(effect.data_id)
  end
end
But this only displays the state rate on the enemy. To get the actor chance to apply is a value that is not in this method. I'll keep looking to find that.
Thanks for helping out, the script doesnt seem to be working quite right though, I've got a test skill setup to apply 4 different states with different % chances of working (and 1 in damage formula) and test enemies that have 99% state rates for all but one state (as the % popups dont seem to show at all if enemies dont have any resistance), and state resist for the other one, but in the popups every state seems to be showing 99%
here are some pics to show it better
Oh and thanks for checking into the actor chances too, that'd be a nice thing to have as well
Oh and thanks for checking into the actor chances too, that'd be a nice thing to have as well
No I think we are thinking of different things. I'm not really sure what you would want with actors.
What I meant was the percentage change getting adjusted based on the actors item or skill being used.
I quickly found what data to use to find that.
So this...
Spoiler: script
Ruby:
class Game_BattlerBase
 
  #-----------------------------------------------------------------------------
  # Create the state rate popup.
  #-----------------------------------------------------------------------------
  def make_state_chance_rate_popup(user, item, effect)
    rate = state_rate(effect.data_id)
    return if rate < 0 || rate >= 1.0
    state = $data_states[effect.data_id]
    return if state.icon_index == 0
    flags = ["state", state.icon_index]
    edr = (rate*100).to_i
    adr = (effect.value1*100).to_i
    tdr = (edr*adr/100).to_i
    return if tdr < 0
    text = "#{tdr}% #{state.name}"
    rules = "DEFAULT"
    create_popup(text, rules, flags)
  end
end

class Game_Battler < Game_BattlerBase
 
  def item_effect_add_state_normal(user, item, effect)
    old_states = @states.clone
    make_state_chance_rate_popup(user, item, effect)
    th_state_rate_popup_item_effect_add_state_normal(user, item, effect)
    new_states = @states - old_states
    make_state_rate_popup(effect.data_id) unless dead? || new_states.include?(effect.data_id)
  end
end
will process some data and give you this...
1765502341761.png


based on a similar set of percentages like what you provided.
1765502397289.png
1765502416926.png


All I did with this was a basic calculation Found that most people say this is multiplicative not additive. Not that I am sure it is accurate. I'll have to investigate more to see if there is something going on that actual controls what the chance of the enemy getting the state applied to it actually is. since 89% chance of poison seems ok and 15% chance of silence getting applied where it does not seems correct. Seems the formula hidden in the code is Chance (%) = 100 + (user's luck - target's luck) ÷ 10
Then that somehow gets applied to the state rate chance.

Now the code above is also not condensed as it is passing data that is not used. But it may be used depending on what else you want or if you can explain what you wanted with actors.
No I think we are thinking of different things. I'm not really sure what you would want with actors.
What I meant was the percentage change getting adjusted based on the actors item or skill being used.
I quickly found what data to use to find that.
So this...
Spoiler: script
Ruby:
class Game_BattlerBase
 
  #-----------------------------------------------------------------------------
  # Create the state rate popup.
  #-----------------------------------------------------------------------------
  def make_state_chance_rate_popup(user, item, effect)
    rate = state_rate(effect.data_id)
    return if rate < 0 || rate >= 1.0
    state = $data_states[effect.data_id]
    return if state.icon_index == 0
    flags = ["state", state.icon_index]
    edr = (rate*100).to_i
    adr = (effect.value1*100).to_i
    tdr = (edr*adr/100).to_i
    return if tdr < 0
    text = "#{tdr}% #{state.name}"
    rules = "DEFAULT"
    create_popup(text, rules, flags)
  end
end

class Game_Battler < Game_BattlerBase
 
  def item_effect_add_state_normal(user, item, effect)
    old_states = @states.clone
    make_state_chance_rate_popup(user, item, effect)
    th_state_rate_popup_item_effect_add_state_normal(user, item, effect)
    new_states = @states - old_states
    make_state_rate_popup(effect.data_id) unless dead? || new_states.include?(effect.data_id)
  end
end
will process some data and give you this...
View attachment 354832

based on a similar set of percentages like what you provided.
View attachment 354833View attachment 354834

All I did with this was a basic calculation Found that most people say this is multiplicative not additive. Not that I am sure it is accurate. I'll have to investigate more to see if there is something going on that actual controls what the chance of the enemy getting the state applied to it actually is. since 89% chance of poison seems ok and 15% chance of silence getting applied where it does not seems correct. Seems the formula hidden in the code is Chance (%) = 100 + (user's luck - target's luck) ÷ 10
Then that somehow gets applied to the state rate chance.

Now the code above is also not condensed as it is passing data that is not used. But it may be used depending on what else you want or if you can explain what you wanted with actors.
I'm not actually sure what I meant by the actors part yesterday either (I was dead tired)
Aside from just getting it working right if I were to want any changes it probably be that it'd be nice if the 'RESIST' popups didnt show since theyre kind of redundant with a percentage displayed, and if the percent popups showed even if the enemy wasnt resistant (but I could probably work around that one by just making every enemy at least 99% resistant to every player addable state, and adding +1 or +2 percent to app rates)
But yeah the main thing I want is just for whenever a skill tries to apply a state for there to be a popup, and for it to show in some way the chance the state had of succeeding- which this is on the right track for
Oddly in my tests I was getting more accurate numbers than in your screenshotsUseDisplay.PNGTestEnemy.PNGSkill used.PNG
I think all of these check out and I couldnt replicate the off 15% for silence, I'm fairly tired now too so I'll probably test it more thoroughly tomorrow but I wonder why our numbers were different? Using the skill on the same enemies over and over again gave me the same display every time, and I tried sliding my actors luck around but going from 1 to 999 luck didnt make any change in the displayed chances
but I wonder why our numbers were different? Using the skill on the same enemies over and over again gave me the same display every time, and I tried sliding my actors luck around but going from 1 to 999 luck didnt make any change in the displayed chances
The screenshot I had was before I made the final changes.
Luck is not a part of this calculation, that is for determining if the state will be applied.
Apologies, not actually applied to the rate displayed, but the final determination if the state is applied.
The screenshot I had was before I made the final changes.
Luck is not a part of this calculation, that is for determining if the state will be applied.
Apologies, not actually applied to the rate displayed, but the final determination if the state is applied.
Oh ok great then, after more testing everything seems to be working how I'd expect
Thanks a lot for the help! I'll leave the thread open a little while longer just while I play around with it a bit more

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/script-that-displays-state-rate.181387/