じ☆ve冰风 发表于 2026-7-12 11:22:18

KLevelChange XP

KLevelChange XP​

by Kyonides Arkanthes​


Introduction

This is a simple scriptlet that will let you call common events whenever the hero levels up or down via gaining or losing experience points, thus changing his or her current level, or by leveling up or down directly. Please read the instructions embedded in the script to learn how to set them up.

There is also the possibility to trigger it randomly by changing the LVLUP_ACTIVATION_RATE or LVLDOWN_ACTIVATION_RATE.
Set their value to 100 if you always need them to get triggered by the system.
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7

                Ruby:        
# * KLevelChange XP
#   Scripter : Kyonides Arkanthes
#   2021-09-30
# Free for use in any kind of game!

# The LVLUP_COMMON_EVENT_ID and LVLDOWN_COMMON_EVENT_ID Constants will let you
# call a common event whenever a hero levels up or down during gameplay. Even so
# that will depend on the corresponding value of the ACTIVATION_RATEs.
# Set them to 100 if you want them to be triggered automatically.

class Game_Actor
LVLUP_COMMON_EVENT_ID = 1
LVLDOWN_COMMON_EVENT_ID = 2
LVLUP_ACTIVATION_RATE = 75
LVLDOWN_ACTIVATION_RATE = 65
alias :kyon_level_reaction_exp= :exp=
def exp=(new_exp)
    level = @level
    kyon_level_reaction_exp = new_exp
    if @level > level and rand(100) < LVLUP_ACTIVATION_RATE
      $game_temp.common_event_id = $data_common_events
    elsif @level < level and rand(100) < LVLDOWN_ACTIVATION_RATE
      $game_temp.common_event_id = $data_common_events
    end
    @exp
end
end


Terms & Conditions

Free for use in any kind of game.
Mention me in your game credits.



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