じ☆ve冰风 发表于 3 天前

KPermaDamage VX

KPermaDamage VX

by Kyonides Arkanthes​


Introduction

Would Ralph love to lose n amount of HP or MP every time he moves in any direction?
Well, now he gotta live with it if he does and it happens to have the death sentence already configured in the KPermaDmg module.

Plus, he could also die if his MP goes kaboom. :S
And there is also the dreadful perma-death. :S

Read the notes on how to configure the CONSTANTS that will affect the target Actors.

FAQ

Question: Isn't that redundant or unnecessary?
Answer: Who cares?


                Ruby:        
# * KPermaDamage VX * #
#   Scripter : Kyonides Arkanthes
#   v1.0.1 - 2023-02-04

# Make certain Heroes permanently lose HP or MP or even collapse for having
# no more MP left!

# * CONSTANTS * #
# LOSE_HP or LOSE_MP or MP_DEATH or PERMA_DEATH

# The only way to cure the permanent HP or MP damage or the MP Death would be
# the following Script Calls:

# $game_actors.perma_hp_dmg = 0
# $game_actors.perma_mp_dmg = 0
# $game_actors.mp_death = nil
# $game_actors.perma_death = nil

module KPermaDmg
# ActorID => Points Lost, etc. separated by a commas
LOSE_HP = { 1 => 5 }
LOSE_MP = { 1 => 3 }
# Just Add as Many ActorIDs as deemed necessary
MP_DEATH =
PERMA_DEATH = []
end

class Game_Battler
alias :kyon_gm_btlr_hp_set :hp=
alias :kyon_gm_btlr_mp_set :mp=
alias :kyon_gm_btlr_rec_all :recover_all
def hp=(new_hp)
    return 0 if @perma_death
    kyon_gm_btlr_hp_set(new_hp)
end

def mp=(new_mp)
    return 0 if @perma_death
    kyon_gm_btlr_mp_set(new_mp)
    check_mp_death if @mp_death
end

def recover_all
    return if @perma_death
    kyon_gm_btlr_rec_all
end
end

class Game_Actor
alias :kyon_gm_act_setup :setup
def setup(actor_id)
    kyon_gm_act_setup(actor_id)
    setup_permanent_damage
end

def setup_permanent_damage
    @perma_hp_dmg = KPermaDmg::LOSE_HP[@actor_id] || 0
    @perma_mp_dmg = KPermaDmg::LOSE_MP[@actor_id] || 0
    @mp_death = KPermaDmg::MP_DEATH.include?(@actor_id)
    @perma_death = KPermaDmg::PERMA_DEATH.include?(@actor_id)
end

def permanent_damage
    self.hp -= @perma_hp_dmg
    self.mp -= @perma_mp_dmg
end

def check_mp_death
    if @mp == 0 and !@immortal
      @hp = 0
      add_state(1)
      @added_states << 1
    else
      @hp = 1 if @hp == 0
      remove_state(1)
      @removed_states << 1
    end
end
attr_accessor :perma_hp_dmg, :perma_mp_dmg, :mp_death, :perma_death
end

class Game_Party
def permanent_damage
    @actors.each{|aid| $game_actors.permanent_damage }
end
end

class Game_Player
alias :kyon_gm_plyr_incr_steps :increase_steps
def increase_steps
    kyon_gm_plyr_incr_steps
    $game_party.permanent_damage
end
end


Download Up-to-Date RGSS Scripts​

Terms & Conditions

Free as in beer.
Include my nickname in your game credits.
Do not repost it!


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