a script that where skill costs HP percentage costs

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
170
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,290
Reaction score
11,699
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,499
First Language
Indonesian
Primarily Uses
RMVXA
But @Kes, this is RMXP request
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
170
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,290
Reaction score
11,699
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,579
Reaction score
545
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
170
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
170
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
263
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
170
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
170
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
170
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: 2)

Latest Threads

Latest Posts

Latest Profile Posts

Stream will be live shortly with a session of the Interactive Text Adventure! Feel free to drop by!
Took a break from spriting dinosaurs to carve a dinosaur pumpkin.

Little early but to all of you that celebrate it :

Tomorrow is Halloween! I can't wait to go to Boxi Park and show off my costume! Also one of Dad's friends is staying the night, so he might get to see the show.
Here's the title-screen for the game I'm working on: :LZSgrin:

Forum statistics

Threads
104,665
Messages
1,007,951
Members
136,153
Latest member
FinnEver
Top