I've been having problems with this script snippet I devised for a friend. Said friend wanted enemies to react to getting hit with specific elements, but only if they dealt damage. So I came up with the idea of making them react to a switch that's thrown in response to a spell dealing damage.
I've tested it, and found that the snippet nulls instead the damage outright. Can someone help me figure out what's wrong?
class Game_Battler < Game_BattlerBase def no_damage?(a, b, base_dmg, atk_mod, def_mod, switch_id) c = ( base_dmg + ( a.atk * atk_mod ) - ( b.def * def_mod ) ) if c > 0 $game_switches[switch_id] == 1 return c else return 0 end endendScript call in damage formula:
I've tested it, and found that the snippet nulls instead the damage outright. Can someone help me figure out what's wrong?
class Game_Battler < Game_BattlerBase def no_damage?(a, b, base_dmg, atk_mod, def_mod, switch_id) c = ( base_dmg + ( a.atk * atk_mod ) - ( b.def * def_mod ) ) if c > 0 $game_switches[switch_id] == 1 return c else return 0 end endendScript call in damage formula:
Code:
c = no_damage(a, b, int, int, int, int); c