Constant HP damage instead of percentage.

Fen_Star

Villager
Member
Joined
Oct 17, 2020
Messages
17
Reaction score
8
First Language
English (Americ
Primarily Uses
RMVXA
A lot of the scrips for this are a bit more complicated. I just wanted something super simple and easy to understand, but I couldn't find it. I think the context is self-explanatory, but feel free to ask a question.
Ruby:
# replaces %n hp damage with constant damage n
# Also wotks for MP and TP, just change the letters
# !NOTE! removes = vars "@result.hp_damage", and "damage".
# Obvs if something else uses those vars it won't work right
class Game_Battler < Game_BattlerBase
    def regenerate_hp
       self.hp += hrg*100
       #perform_map_damage_effect if $game_party.in_battle #uncomment if you want screen flash
    end
end

For reference:
# in game_battler
#--------------------------------------------------------------------------
# * Regenerate HP
#--------------------------------------------------------------------------
def regenerate_hp
damage = -(mhp * hrg).to_i
perform_map_damage_effect if $game_party.in_battle && damage > 0
@result.hp_damage = [damage, max_slip_damage].min
self.hp -= @result.hp_damage
end
#--------------------------------------------------------------------------
# * Regenerate MP
#--------------------------------------------------------------------------
def regenerate_mp
@result.mp_damage = -(mmp * mrg).to_i
self.mp -= @result.mp_damage
end
#--------------------------------------------------------------------------
# * Regenerate TP
#--------------------------------------------------------------------------
def regenerate_tp
self.tp += 100 * trg
end
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,852
Reaction score
5,424
First Language
English
Primarily Uses
RMVXA
@Fen_Star I'm happy to approve this topic this time (and thank you for sharing it!), but there are some obvious issues with your scriptlet. For example, I believe the popups will never display when a character takes negative (or even positive) regeneration from a state in your approach, and there will also be no way to prevent slip damage from killing a player even if the designer wants to prevent this (due to the lack of a check against max_slip_damage).
In the future, please work on your scripts and make sure they're at least as good as default RPG Maker functionality before posting them on the Scripts board. (If you need help tuning it up, the people on the Learning Ruby/RGSS board are great!)
 

Fen_Star

Villager
Member
Joined
Oct 17, 2020
Messages
17
Reaction score
8
First Language
English (Americ
Primarily Uses
RMVXA
@Fen_Star I'm happy to approve this topic this time (and thank you for sharing it!), but there are some obvious issues with your scriptlet. For example, I believe the popups will never display when a character takes negative (or even positive) regeneration from a state in your approach, and there will also be no way to prevent slip damage from killing a player even if the designer wants to prevent this (due to the lack of a check against max_slip_damage).
In the future, please work on your scripts and make sure they're at least as good as default RPG Maker functionality before posting them on the Scripts board. (If you need help tuning it up, the people on the Learning Ruby/RGSS board are great!)

My bad.
I should have posted it like this probably?
Although I am not sure what you mean by no damage popups though?

Ruby:
#--------------------------------------------------------------------------
# * Constant HP, MP and TP Damage instead of percentage
#--------------------------------------------------------------------------
class Game_Battler < Game_BattlerBase
    def regenerate_hp
        damage= -hrg*100
        damage = -(mhp * hrg).to_i
        perform_map_damage_effect if $game_party.in_battle && damage > 0
        @result.hp_damage = [damage, max_slip_damage].min
        self.hp -= @result.hp_damage
    end
   
    def regenerate_mp
        @result.mp_damage = -mrg*100
        self.mp -= @result.mp_damage
    end
   
    def regenerate_tp
        @result.mp_damage = -trg*100
        self.mp -= @result.mp_damage
    end
end

I guess what I was going for was making it for myself, but I didn't consider the usual method of use by others.
 

Latest Threads

Latest Posts

Latest Profile Posts

Megumi_Aramaki wrote on Takeshi014's profile.
Here you go! Enjoy mapping!
Megumi_Aramaki wrote on Takeshi014's profile.
Valley can be done by outside mountain town tilesets I will send you right away!
Hi everyone! I've relased a demo about my new game in "Games in Development". Someone interested? :3
Going live at 2pm EST
Today is the day! I will be productive in game dev work! I will - *gets distracted by cat playing with her toy mouse* Awww <3
Whelp. I tried to be productive.

Forum statistics

Threads
109,043
Messages
1,041,567
Members
141,530
Latest member
jno8034
Top