Luck on direct hit

Hello,
I'm making a status of venom ailment that will deal damage over time.
Somewhat on enemies with high luck, it rarely takes effect.
I don't want to change their luck neither chances of getting other status effects like stun but i want to disable luck effect on states that deal damage (like this venom).
I've red that direct hit skills are not affected by luck parameter, but in my experience, they are also affected since my "venom" is direct hit type of skill.
I wonder if you could help me.
Regards,
Paul
I'm not 100% sure how all these things are calculated in the engine, but I would guess that increasing the percentage in the "Add state" part of the skill could work. Or you could try making enemies vulnerable to venom (this, however, would require modifying all enemies, so too much work).

P.S. Hello, neighbour :LZScheeze:
I'm not 100% sure how all these things are calculated in the engine, but I would guess that increasing the percentage in the "Add state" part of the skill could work. Or you could try making enemies vulnerable to venom (this, however, would require modifying all enemies, so too much work).

P.S. Hello, neighbour :LZScheeze:

Values of add state effects are at around 95% already.
I still want a slight possibility of not succeding or lower chance of some kind of stronger poison.

Also enemies have no element rate for poison type.
Hey,

as far as scripts go, the luck effect on states is calculated in the Game_Battler script, line 712-714. In order to change that formula you would normally create a new script entry under Materials, copy the method and surrounding class there and modify your new script like this:
Code:
class Game_Battler
 
  #--------------------------------------------------------------------------
  # * Get Effect Change Rate by Luck
  #--------------------------------------------------------------------------
  def luk_effect_rate(user)
    1.0
  end
end

(technically it is also possible to directly edit the original code, but it is discouraged mainly for clarity reasons)
Hey,

as far as scripts go, the luck effect on states is calculated in the Game_Battler script, line 712-714. In order to change that formula you would normally create a new script entry under Materials, copy the method and surrounding class there and modify your new script like this:
Code:
class Game_Battler
 
  #--------------------------------------------------------------------------
  # * Get Effect Change Rate by Luck
  #--------------------------------------------------------------------------
  def luk_effect_rate(user)
    1.0
  end
end

(technically it is also possible to directly edit the original code, but it is discouraged mainly for clarity reasons)

Hi,
Unfortunately this change will remove impact of luck on other skills and states like stuns etc.
And that's important mechanic for me to prevent permanent stun on bosses.

Is there a way to separate skills influenced by luck?
To make some being affected or not by this attribute.

Eventually i would have to give all significant enemies resistance to some specific states, but that would be a lot of work. (and same for every new state)
Is there a way to separate skills influenced by luck?
To make some being affected or not by this attribute.
Change the formula in the code at the bottom to whatever you want.
use note tag on skill <no luck skill>
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Battle skill luck chance     ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║                                     ╠════════════════════╣
# ║ Alternate Luck for Battle skills    ║    02 Sep 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║                                                          ║
# ║   Place note tag on skill that will use alternate        ║
# ║   chance for luck. <no luck skill>                       ║
# ║                                                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker - except nudity           ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Luck_Effect_Skills
    Luck_Effect = /<no luck skill>/i
end

class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * [Add State] Effect: Normal Attack
  #--------------------------------------------------------------------------
  def item_effect_add_state_attack(user, item, effect)
    user.atk_states.each do |state_id|
      chance = effect.value1
      chance *= state_rate(state_id)
      chance *= user.atk_states_rate(state_id)
      if luk_effect_skill(item)
        chance *= luk_effect_skill_rate(user)
      else
        chance *= luk_effect_rate(user)
      end
      if rand < chance
        add_state(state_id)
        @result.success = true
      end
    end
  end
  #--------------------------------------------------------------------------
  # * [Add State] Effect: Normal
  #--------------------------------------------------------------------------
  def item_effect_add_state_normal(user, item, effect)
    chance = effect.value1
    chance *= state_rate(effect.data_id) if opposite?(user)
      if luk_effect_skill(item)
        chance *= luk_effect_skill_rate(user) if opposite?(user)
      else
        chance *= luk_effect_rate(user)      if opposite?(user)
      end
    if rand < chance
      add_state(effect.data_id)
      @result.success = true
    end
  end
  #--------------------------------------------------------------------------
  # * Get Effect Change Rate by Luck
  #--------------------------------------------------------------------------
  # here for reference
#  def luk_effect_rate(user)
#    [1.0 + (user.luk - luk) * 0.001, 0.0].max
#  end
  #--------------------------------------------------------------------------
  # * Scan for regex
  #--------------------------------------------------------------------------
  def luk_effect_skill(item)
    results = item.note.scan(R2_Luck_Effect_Skills::Luck_Effect)
    results.each do |res|
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * new luck based effect
  #--------------------------------------------------------------------------
  def luk_effect_skill_rate(user)
    0.95 # change as you see fit
  end
end
Change the formula in the code at the bottom to whatever you want.
use note tag on skill <no luck skill>
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Battle skill luck chance     ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║                                     ╠════════════════════╣
# ║ Alternate Luck for Battle skills    ║    02 Sep 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║                                                          ║
# ║   Place note tag on skill that will use alternate        ║
# ║   chance for luck. <no luck skill>                       ║
# ║                                                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker - except nudity           ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Luck_Effect_Skills
    Luck_Effect = /<no luck skill>/i
end

class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * [Add State] Effect: Normal Attack
  #--------------------------------------------------------------------------
  def item_effect_add_state_attack(user, item, effect)
    user.atk_states.each do |state_id|
      chance = effect.value1
      chance *= state_rate(state_id)
      chance *= user.atk_states_rate(state_id)
      if luk_effect_skill(item)
        chance *= luk_effect_skill_rate(user)
      else
        chance *= luk_effect_rate(user)
      end
      if rand < chance
        add_state(state_id)
        @result.success = true
      end
    end
  end
  #--------------------------------------------------------------------------
  # * [Add State] Effect: Normal
  #--------------------------------------------------------------------------
  def item_effect_add_state_normal(user, item, effect)
    chance = effect.value1
    chance *= state_rate(effect.data_id) if opposite?(user)
      if luk_effect_skill(item)
        chance *= luk_effect_skill_rate(user) if opposite?(user)
      else
        chance *= luk_effect_rate(user)      if opposite?(user)
      end
    if rand < chance
      add_state(effect.data_id)
      @result.success = true
    end
  end
  #--------------------------------------------------------------------------
  # * Get Effect Change Rate by Luck
  #--------------------------------------------------------------------------
  # here for reference
#  def luk_effect_rate(user)
#    [1.0 + (user.luk - luk) * 0.001, 0.0].max
#  end
  #--------------------------------------------------------------------------
  # * Scan for regex
  #--------------------------------------------------------------------------
  def luk_effect_skill(item)
    results = item.note.scan(R2_Luck_Effect_Skills::Luck_Effect)
    results.each do |res|
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * new luck based effect
  #--------------------------------------------------------------------------
  def luk_effect_skill_rate(user)
    0.95 # change as you see fit
  end
end

Thank you very much,
Could you give me some explanation on how i use this script?
I'm not very good at scripts.


I paste it under Materials and when i insert "<no luck skill>" at skill description, chances of status will be % chance multiplicated by value of 84 line of code (currenctly 0.95)?
I'm not very good at scripts.


I paste it under Materials and when i insert "<no luck skill>" at skill description, chances of status will be % chance multiplicated by value of 84 line of code (currenctly 0.95)?
Follow the link in my signature for a tutorial on using scripts.

The tag does not go in the description, it goes in the note box.
Change the formula at the bottom of the script to whatever you want.

All as described in the script

Line 84 in the code is the end.

It is currently set to 0.95 so the function will check for the tag and if found use the alternate formula and multiple it to the current chance value.

If you want a different chance formula then change it.
Follow the link in my signature for a tutorial on using scripts.

The tag does not go in the description, it goes in the note box.
Change the formula at the bottom of the script to whatever you want.

All as described in the script

Line 84 in the code is the end.

It is currently set to 0.95 so the function will check for the tag and if found use the alternate formula and multiple it to the current chance value.

If you want a different chance formula then change it.

It works!

Will it work also with states that are triggered through other states?
For exaple I've got "poison attacks" state that makes an attack inflict "poison" state on enemy.
It works!

Will it work also with states that are triggered through other states?
For exaple I've got "poison attacks" state that makes an attack inflict "poison" state on enemy.
If the script your using to so that causes the state to use one of the two methods included it should work.
If the script your using to so that causes the state to use one of the two methods included it should work.

I'm using no additional script for that.
In state of "poison attacks" i use feature Atk State "poison".
States are not able to attack as far as I know. No idea if that would work.
Well it works, but it seem not being affected by <no luck skill> note
Maybe if I would use note on basic attack skill it would work, but I dont want to do it, since normal attacks can stun in some scenarios.

Anyway thank you all, my issue is resolved.

Original thread: https://forums.rpgmakerweb.com/threads/luck-on-direct-hit.160848/