How to stop PROTECT/COVER on character being healed

Status
Not open for further replies.

Nugem

The Hobbit
Veteran
Joined
Jun 28, 2013
Messages
93
Reaction score
0
First Language
PT-BR
Primarily Uses
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?
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
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".
 

Nugem

The Hobbit
Veteran
Joined
Jun 28, 2013
Messages
93
Reaction score
0
First Language
PT-BR
Primarily Uses
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
This seems like it might be a little involved/complicated, so I'm moving it into its own thread.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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
 
Last edited by a moderator:

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
15,141
Reaction score
15,473
First Language
Filipino
Primarily Uses
RMMZ
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
 
Last edited by a moderator:

Nugem

The Hobbit
Veteran
Joined
Jun 28, 2013
Messages
93
Reaction score
0
First Language
PT-BR
Primarily Uses
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!
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,574
Latest member
nikisknight
Top