じ☆ve冰风 发表于 2026-8-2 14:58:45

Constant HP damage instead of percentage.

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 = .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               
Click to expand...




本贴来自国际rpgmaker官方论坛作者:Fen_Star处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/constant-hp-damage-instead-of-percentage.128785/
页: [1]
查看完整版本: Constant HP damage instead of percentage.