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
is there a possible script where that skills costs HP in percentages?
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,289
Reaction score
11,692
First Language
English
Primarily Uses
RMVXA
Yanfly's Skill Cost Manager allows you to use HP as a skill cost, either as a percentage or as a straight number. Use the GitHub link on this web page to get it, the other link doesn't work.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,573
Reaction score
6,497
First Language
Indonesian
Primarily Uses
RMVXA
But @Kes, this is RMXP request
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
165
Reaction score
6
First Language
English
Primarily Uses
RMXP
@KK20 yeah, i know about the HP Sacrifice script but i don't know HOW it works nor how to USE IT exactly...
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,289
Reaction score
11,692
First Language
English
Primarily Uses
RMVXA
Oops!! Sorry, didn't notice that this was XP.
@TheoAllen Thanks for the heads up.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,555
Reaction score
541
First Language
English
Primarily Uses
RMVXA
i don't know HOW it works nor how to USE IT
The instructions are in the script with examples.
Shown in the script are examples for skill 28 & 30. So when those skills are used those effects are processed. KK20 will know if that is correct.
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
165
Reaction score
6
First Language
English
Primarily Uses
RMXP
OK i think i get how this script works, thanks!
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
165
Reaction score
6
First Language
English
Primarily Uses
RMXP
bump.
how do i make the HP Sacrifice Script take HP on only the allies and not the enemies
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
258
Reaction score
95
First Language
English
Primarily Uses
RMXP
In the methods make_skill_action_result and make_item_action_result, you just have to add a single line:
Code:
return if @active_battler.is_a?(Game_Enemy)
immediately after the aliased method is called.

e.g.
Code:
    alias make_skill_action_result_hp_sacrifice make_skill_action_result
    def make_skill_action_result
      make_skill_action_result_hp_sacrifice
      return if @active_battler.is_a?(Game_Enemy)   # <== add this line here
# redacting rest of code for brevity ...
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
165
Reaction score
6
First Language
English
Primarily Uses
RMXP
awoooooga bump!
i have modified the Window_Skill script
Ruby:
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.font.name = "Times New Roman"
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = sp_color
    else
      self.contents.font.color = disabledmagic_color
    end
    self.contents.font.name = "TF2 Build"
    self.contents.draw_text(x + 204, y, 48, 32, skill.sp_cost.to_s, 2)
    self.contents.draw_text(x + 232, y, 48, 32, "SP", 2)
  end
and have made this!
1597030960218.png
pretty great, isn't it?

although i don't know how to make the skills that tell you the HP cost
here is an example of this:
1597031733223.png
this has to be connected with the HP Sacrifice Script
if anyone has any idea on how to do that, let me know.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
287
Reaction score
71
First Language
English
Primarily Uses
RMXP
The answer would be using the following code:
Code:
hp_cost = HP_Sacrifice_Action['Skill'][skill.id][2]
Later you can print it the same way you did with SP cost.

Edited!
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
165
Reaction score
6
First Language
English
Primarily Uses
RMXP
where am i supposed to insert that code?
 
Last edited:

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
287
Reaction score
71
First Language
English
Primarily Uses
RMXP
Consider it already done, Mario.
Code:
 def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.font.name = "Times New Roman"
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = sp_color
    else
      self.contents.font.color = disabledmagic_color
    end
    self.contents.font.name = "TF2 Build"
    hp_cost_data = HP_Sacrifice_Action['Skill'][skill.id]
    if hp_cost_data
       text = hp_cost_data[2].to_s
       type_label = "HP"
    else
       text = skill.sp_cost.to_s
       type_label = "SP"
    end
    self.contents.draw_text(x + 204, y, 48, 32, text, 2)
    self.contents.draw_text(x + 232, y, 48, 32, type_label, 2)
  end
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
287
Reaction score
71
First Language
English
Primarily Uses
RMXP
Right, I forgot to add its module name LockeZ...
Use this version instead.
Code:
def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.font.name = "Times New Roman"
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = sp_color
    else
      self.contents.font.color = disabledmagic_color
    end
    self.contents.font.name = "TF2 Build"
    hp_cost_data = LockeZ::HP_Sacrifice_Action['Skill'][skill.id]
    if hp_cost_data
       text = hp_cost_data[2].to_s
       type_label = "HP"
    else
       text = skill.sp_cost.to_s
       type_label = "SP"
    end
    self.contents.draw_text(x + 204, y, 48, 32, text, 2)
    self.contents.draw_text(x + 232, y, 48, 32, type_label, 2)
  end
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
165
Reaction score
6
First Language
English
Primarily Uses
RMXP
ok, getting close.
1597038627277.png
it says "7 HP" as in 7% of the user HP
there is a difference of percentage cost and set cost
and HP cost are just like that in Persona.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
287
Reaction score
71
First Language
English
Primarily Uses
RMXP
Where it says...
Code:
    if hp_cost_data
       text = hp_cost_data[2].to_s
...it should be:
Code:
    if hp_cost_data
       percent = (hp_cost_data[2] * @actor.maxhp / 100).round
       text = percent.to_s
But that'll show you 7% of MAXHP. If you need the hero's current HP, then use hp instead of maxhp there.
 

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

Latest Threads

Latest Profile Posts

TRIVIA: I love Japanese food and culture! I've never been to Japan, but someday I'm going to go to Tokyo and do some touring, including Disneyland Tokyo and DisneySea! And I even prepared myself for earthquake safety.
The virus really doesn't want us to do this GameJam. v .v' Even if we don't meet the deadline because of it, still plan on making it a game we'll release.
Has anybody else noticed in the freebie Sci-fi tilesets that they have a hologram of Cybertron from Transformers?
Halloween is my favorite of the international festive days, always gets me in the mood to draw cute devil things...
Asked a child in the bus if it would pull its mask up and the mom who sat somewhere else started yelling at me and promising that she would curb stomp me if I ever dare to do that again.

Forum statistics

Threads
104,238
Messages
1,004,910
Members
135,759
Latest member
themebattle
Top