How to stop PROTECT/COVER on character being healed

● ARCHIVED · READ-ONLY
Started by Nugem 8 posts View original ↗
  1. Alright, I'm having some issues with the PROTECT / COVER skill.

    The character will "cover" a weak ally even when he is being HEALED.

    How to negate it?

    def check_substitute(target, item)
        target.hp < target.mhp / 4 && (!item || !item.certain?)
    end


    I've though about stating in the def to return if a item of element (3) HEAL.

    But would this work? I dont know even how to declare it.

    Little hand here?
  2. All I can tell you is the game pretty much treats all battle 'actions' the same. I've got potions dealing 'painful blows' when they land a critical heal and people 'nullifying the magic' when they try to guard. I remember vaguely there is a spot where it checks for item.recover?.

    Eventually I'll dig through and find out where to put the switch, unless someone here can answer it.

    For now, I'm just calling them "features".
  3. Mouser said:
    All I can tell you is the game pretty much treats all battle 'actions' the same. I've got potions dealing 'painful blows' when they land a critical heal and people 'nullifying the magic' when they try to guard. I remember vaguely there is a spot where it checks for item.recover?.

    Eventually I'll dig through and find out where to put the switch, unless someone here can answer it.

    For now, I'm just calling them "features".
    I see. I've tried something like:

      def check_substitute(target, item)

        target.hp < target.mhp / 4 && (!item || !item.certain?)

        return if item.damage.recover? && item.damage.to_hp? && hp < mhp

      end

    But it throws a error:

    undefined local variable or method 'hp' for scene_battle...

    Unfortunately I dont know exactly how to comunicate this sistuation for the game.
  4. This seems like it might be a little involved/complicated, so I'm moving it into its own thread.
  5. change the hp on the last line to target.hp...

    also that method should return a boolean...

    Also, I don't think HP recover and HP damage can coexist on a single item/skill at the same time, so that will probably always be false

    Code:
      def check_substitute(target, item)    return false if item.damage.recover? #So that it won't work for recovery     target.hp < target.mhp / 4 && (!item || !item.certain?)  end
  6. Yanfly's Core engine has a fix but I think it's this?
     

    Code:
    class Scene_Battle < Scene_Base    #--------------------------------------------------------------------------  # alias method: check_substitute  #--------------------------------------------------------------------------  alias scene_battle_check_substitute_ace check_substitute  def check_substitute(target, item)    return false if @subject.actor? == target.actor?    return scene_battle_check_substitute_ace(target, item)  end
  7. Engr. Adiktuzmiko said:
    change the hp on the last line to target.hp...

    also that method should return a boolean...

    Also, I don't think HP recover and HP damage can coexist on a single item/skill at the same time, so that will probably always be false

    def check_substitute(target, item) return false if item.damage.recover? #So that it won't work for recovery target.hp < target.mhp / 4 && (!item || !item.certain?) end
    Works perfectly!

    Thanks!

    @Archeiahttp://forums.rpgmakerweb.com/index.php?/user/11-archeia/

    Yeah! I'm using VE Engine instead of YEA. That's why I'm having this problem.

    But thanks for your help too! 

    This one is solved!
  8. 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.