じ☆ve冰风 发表于 2026-8-3 10:34:41

Level Up Common ACE

Level Up Common ACE

by Kyonides​

Introduction

This simple scriptlet will let you call a given Common Event by leaving an extremely simple note tag in an Actor's Note Box.

Instructions for the Old Script

Spoiler: Old Script                Ruby:       
<level up ce 50>


Thus once the leveling up process ends, and the level up message shows up on screen, the game will call that common event in no time.

                Ruby:       
# * Level Up Common ACE * #
#Scripter : Kyonides Arkanthes
#2024-03-18

# Leave a tag in a given Actor's notebox.
# Example: <level up ce 100>
# And it will call that common event after the actor finishes leveling up.

module LvUpCm
COMMON_EVENT = /<level up ce (\d+)>/i
end

class RPG::Actor
def level_up_common_event
    @note
    $1.to_i
end
end

class Game_Actor
alias :kyon_lvl_up_cmmn_gm_act_lvl_up :level_up
def level_up
    kyon_lvl_up_cmmn_gm_act_lvl_up
    call_level_up_common_event
end

def call_level_up_common_event
    event_id = actor.level_up_common_event
    $game_temp.reserve_common_event(event_id) if event_id > 0
end
end


Instructions for the New Script

Spoiler: New Script                Ruby:       
<level up 1-5 ce 100>


There 1 and 5 define the range of levels while 100 stands for the Common Event #100.

Thus once the leveling up process ends, and the level up message shows up on screen, the game will call that common event in no time.

                Ruby:       
# * Level Up Common ACE * #
#   Scripter : Kyonides Arkanthes
#   2024-03-20

# Leave a tag in a given Actor's notebox.
# Example: <level up 1-5 ce 100>
# And it will call that common event after the actor finishes leveling up.

module LvUpCm
COMMON_EVENT = /<level up \d+-\d+ ce \d+>/i
end

class RPG::Actor
def level_up_common_events
    notes = @note.scan(LvUpCm::COMMON_EVENT)
    return if notes.empty?
    notes.map! {|s| s[/(\d+)-(\d+)....(\d+)/]; [$1.to_i, $2.to_i, $3.to_i] }
end
end

class Game_Actor
alias :kyon_lvl_up_cmmn_gm_act_lvl_up :level_up
def level_up
    kyon_lvl_up_cmmn_gm_act_lvl_up
    call_level_up_common_event
end

def call_level_up_common_event
    ce = actor.level_up_common_events
    return unless ce
    group = ce.find {|a,b,c| @level.between?(a, b) }
    lvl1, lvl2, event_id = group
    return unless lvl1 and lvl2 and event_id
    $game_temp.reserve_common_event(event_id)
end
end


Download Demo​

Terms & Conditions

Free for use in ANY game.
Due credit is mandatory.
Mention this forums in your game credits.
That's it!
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7


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