Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Take 0 damage

VCA

Member

Is there a script that you in a state like Super Shield or something. But as the enemy hit you with whatever attack and you take Zero damage. Can someone help me?
 
Here just try this, PM me if there is any problems I wrote it in like 2 minutes...

Code:
class Game_Battler

  Damage0State = 2 # id of state

  alias_method :damage0state_gmbtlr_atkeffect, :attack_effect

  alias_method :damage0state_gmbtlr_skleffect, :skill_effect

  alias_method :damage0state_gmbtlr_itmeffect, :item_effect

  def attack_effect(attacker)

    if self.states.include?(Damage0State)

      self.damage = 0

      return

    end

    damage0state_gmbtlr_atkeffect(attacker)

  end

  def skill_effect(user, skill)

    if self.states.include?(Damage0State)

      unless skill.power < 0

        self.damage = 0

        return

      end

    end

    damage0state_gmbtlr_skleffect(user, skill)

  end

  def item_effect(user, item)

    if self.states.include?(Damage0State)

      unless (item.recovery_hp_rate > 0 ||

      item.recovery_hp > 0)

        self.damage = 0

        return

      end

    end

    damage0state_gmbtlr_itmeffect(user, item)

  end

end

Assuming you're using a skill/item which appears to recover HP, this will allow the effect of that item/skill but certain things such as common events which damage the target's HP isn't something that this is going to be looking for. Good luck :thumb:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top