Level Up Common ACE
by Kyonides
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
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[LvUpCm::COMMON_EVENT]
$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
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
Terms & Conditions
Free for use in ANY game.
Due credit is mandatory.
Mention this forums in your game credits.
That's it! 😛