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,957
Reaction score
5,581
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

I am adamant about not having missable quests, which means having to write entirely new scenes at each plot progression that takes into account that time and events have passed since the quest could first be accepted while still having there be a quest to solve in the first place. It's worth every second.
Surprisingly useful and thought provoking
Working on animation. Trying to see if I can apply it meaningfully to my games!
ddwk.png

working on the sprite for Devali <3
My Game Development Livestream

Forum statistics

Threads
110,377
Messages
1,052,787
Members
143,419
Latest member
haniffauziyatun
Top