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,867
Reaction score
5,448
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 Profile Posts

Wondering how big I can make Dorothy's skill menu before the game just becomes irredeemably bad.
Studio Blue is playing the RPG Maker game Phil Alone live now! Phil may be alone, but you don't have to be, come join us in chat!

I'm in desperate need of environment sprites and tilesets for my game. If anyone is interested please DM me im willing to pay.
All badges and prizes for the Let's Make a Scene Heart Edition event SHOULD be out. If you participated and haven't received either or both, send me a PM.

Forum statistics

Threads
109,208
Messages
1,043,065
Members
141,724
Latest member
DonTaco
Top