a script that where skill costs HP percentage costs

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
165
Reaction score
6
First Language
English
Primarily Uses
RMXP
glitchy bump!
1597900886487.png
when an ally uses a physical attack when their HP is insufficient to the skill's HP cost...

1597900988823.png
this happens! is there a way to prevent this from happening?
like where:
User's Current SP: 10 < Skill's SP Cost: 20 = Can't use because Insufficient SP!
but do the same with HP:
User's Current HP: 750/6750 < Skill's HP Cost: 17% (945) = Can't use because Insufficient HP!
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
287
Reaction score
71
First Language
English
Primarily Uses
RMXP
It would need to add some condition in skill_can_use?(skill_id) method...

EDIT
Isn't it Skill #121?
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
165
Reaction score
6
First Language
English
Primarily Uses
RMXP
Assault Dive is Skill #136

@kyonides
i tested this with your patched script of HP Sacrifice
Ruby:
class Game_Battler
  alias :why_on_earth_skill_costs_hp_scu? :skill_can_use?
  def skill_can_use?(skill_id)
    if skill_id == 136 #Assault Dive's Skill ID
      data = LockeZ::HP_Sacrifice_Action['Skill'][skill_id]
      hp_percent = data[2] * self.hp / 100
      return self.hp >= hp_percent.round
    end
    why_on_earth_skill_costs_hp_scu?(skill_id)
  end
end
it just didn't work...
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
287
Reaction score
71
First Language
English
Primarily Uses
RMXP
Code:
class Game_Battler
  HP_COST_SKILLS = [121, 136]
  alias :why_on_earth_skill_costs_hp_scu? :skill_can_use?
  def skill_can_use?(skill_id)
    if HP_COST_SKILLS.include?(skill_id)
      data = LockeZ::HP_Sacrifice_Action['Skill'][skill_id]
      hp_percent = data[2] * self.maxhp / 100
      return self.hp >= hp_percent.round
    end
    why_on_earth_skill_costs_hp_scu?(skill_id)
  end
end
In HP_COST_SKILLS constant add as many Skill ID's as needed.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
287
Reaction score
71
First Language
English
Primarily Uses
RMXP
Yeah, the old fix didn't check for any new skills and it still calculated the cost based on current HP instead of MAXHP... :( That's why I've changed the code.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I think in the pursuit of making the game look and sound custom, we never really start making a game. Finish the game first using all necessary plugins (with placeholder assets), then replace it with the real ones.

I haven't finished a game, but I try this method. Progress seems to be faster. :D
Every now and then I think about all the things I need in my project, and get overwhelmed. Just focus on your tilesets, me. You can't build your maps without 'em!
If a picture speaks 1000 words, how many pictures does a video speak??
I don't really get the "Pass Interference" Flag in (American) Football. Aren't you SUPPOSED to interfere with passes in Defense?? What exactly is the threshold that warrants a Flag?
TS Zeta.. blow your ass east... I cant take a round 3.

Forum statistics

Threads
104,435
Messages
1,006,329
Members
135,957
Latest member
parttimerpgmaker
Top