じ☆ve冰风 发表于 2026-7-12 11:39:33

Flat health regeneration for poison/regen

after some tinkering Ive learned something id like to share.. maybe it isn't new to this community but its new to me.
i dont like using % health for poison id rather do flat numbers..so..

in game_battler there is a function to regenerate hp each turn..

                Code:        
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


so this is taking your max health * health regeneration.. which is a percentage meaning 1% is actually 0.01

if you change Mhp to 100.. you multiply the percentage back into whatever number it would of been in the setup screen..
so -10% health regen is now -10 health regen.. as in 10 damage per turn.

if you want to go above 100 damage per turn its easy.. just add another one with up to 100 each time. want to go way above 100?

change the code to multiply hrg by 1000 instead!

Im pretty happy about just how simple the solution ended up being.


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