Turn null damage (0 damage) into a miss or evade with a sound effect

Discussion in 'RGSS3 Script Requests' started by tobbecool53, Dec 1, 2019.

  1. tobbecool53

    tobbecool53 Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    Swedish
    Hi,


    This is something which has been annoying me for a while now.


    My game does not use agility to determine hits and misses. Instead, the other parameters do. For example; if the attacker’s ATK is high enough, and the target’s DEF is low enough, there will be a guaranteed hit. If not, then the target takes no damage.


    What has been annoying me for a while now, is that I am unable to signal targets taking 0 damage to the player. For example; a miss is signaled to the player through the sound effect section in the system tab in the editor but I have not been able to figure out a way to do the same when targets take 0 damage.


    I have been unable to figure out a way to fix this. I figured I might need a script for this, but if there is some other way around this that I haven’t thought about, I would really appreciate it if someone could help me out here.


    In summary, I would like to turn an attack dealing null damage into a miss or evade to the player.


    Thanks.
     
    #1
  2. A-Moonless-Night

    A-Moonless-Night WINTER IS COMING Veteran

    Messages:
    524
    Likes Received:
    372
    Location:
    New Zealand
    First Language:
    English
    Primarily Uses:
    RMVXA
    Untested, but I believe you'll need to alter the 'make_damage_value' method in Game_Battler to something like this:
    Code:
    class Game_Battler < Game_BattlerBase
    
      def make_damage_value(user, item)
        value = item.damage.eval(user, self, $game_variables)
        value *= item_element_rate(user, item)
        value *= pdr if item.physical?
        value *= mdr if item.magical?
        value *= rec if item.damage.recover?
        value = apply_critical(value) if @result.critical
        value = apply_variance(value, item.damage.variance)
        value = apply_guard(value)
    #~     return @result.missed if value.to_i == 0 ### use one of these lines
        return @result.evaded if value.to_i == 0 ### use one of these lines
        @result.make_damage(value.to_i, item)
      end
     
    end
    
    Of course, if you have other scripts that alter 'make_damage_value', then there might be a bit more work involved. I believe all the item effects will still apply as well.
     
    #2
  3. tobbecool53

    tobbecool53 Villager Member

    Messages:
    9
    Likes Received:
    0
    First Language:
    Swedish
    Thanks! I'll give it a test soon!
     
    #3

Share This Page