Run common event on level-up?

Yummytiger22

Villager
Member
Joined
May 25, 2012
Messages
17
Reaction score
4
First Language
English
Primarily Uses
Hello everyone!

I was wondering if anyone would have a suggestion on how to go about having the game run a common event every time the player levels up? I'd like to have messages (kind of like Morrowind) when the player levels up detailing how the player has grown. I've manually adjusted every level up to reflect specific growth for the main character, and want the player to understand why growth is so uneven. So, I'd need to be able to call up a common event and then have specific messages based on the level gained. I'm pretty sure I can already set up conditional branches based on main character level, so that part should be easy.

Thanks for any suggestions people have! This community is awesome!

YT
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,769
First Language
German
Primarily Uses
RMMV
Use one variable per actor to store old level


make a common event checking current level of each actor against the variable, displaying message and updating whenever the current level is higher.


call that common event after each event that rewards XP, and once after each battle
 

Lecode

(─‿‿─)
Veteran
Joined
Dec 18, 2013
Messages
490
Reaction score
646
First Language
French
Primarily Uses
N/A
Hi.

Try this: (Not working in battle however :x )

Code:
module CommonEvent_OnLevelUp  ID = 1endclass Game_Interpreter    def launch_common_event(ce_id)    common_event = $data_common_events[ce_id]    if common_event      child = Game_Interpreter.new(@depth + 1)      child.setup(common_event.list, same_map? ? @event_id : 0)      child.run    end  end  endclass Game_Actor    alias lecode_lceolu_level_up level_up  def level_up    lecode_lceolu_level_up    $game_map.interpreter.launch_common_event(CommonEvent_OnLevelUp::ID)  end  end
 
Last edited by a moderator:

Lantiz

Biterkid
Veteran
Joined
Dec 29, 2012
Messages
719
Reaction score
1,069
First Language
Portuguese
Primarily Uses
RMMV
I did something a little different, so you can call a different event for each party member:

 

module On_Level_Up # define the common event id for each party member # eq. when the first party member (index 0) level up, run the common event that has this ID and so on # you can add more if you have more party members EVENTS = {'0'=>1, '1'=>2, '2'=>3, '3'=>4 }endclass Game_Actor alias :very_old_level_up :level_up def level_up very_old_level_up member = nil for i in 0..(On_Level_Up::EVENTS.length - 1) member = i if $game_party.members && $game_party.members.id == @actor_id end $game_temp.reserve_common_event(On_Level_Up::EVENTS[member.to_s]) endendEdit: so you can use as many party members you want
 
Last edited by a moderator:

Yummytiger22

Villager
Member
Joined
May 25, 2012
Messages
17
Reaction score
4
First Language
English
Primarily Uses
Thank you both so much! I really, really appreciate it.

@Magno: I was just happy someone put something together and was trying Lecode's script when I realized the issue with more than one party member :). I was actually redesigning things to make that work, but you fixed that problem. All I can say is awesome. I've tested it and it works as intended.

YT
 

Lantiz

Biterkid
Veteran
Joined
Dec 29, 2012
Messages
719
Reaction score
1,069
First Language
Portuguese
Primarily Uses
RMMV
Thank you both so much! I really, really appreciate it.

@Magno: I was just happy someone put something together and was trying Lecode's script when I realized the issue with more than one party member :). I was actually redesigning things to make that work, but you fixed that problem. All I can say is awesome. I've tested it and it works as intended.

YT
Awesome! Glad to help.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

As for the Coronavirus? Well: "People that spend their life avoiding death are already dead (they're also rich, and I like to spend my life with their money.)"
- R. Sanchez, "Edge of Tomorty: Rick, Die, Repeat"
making pierogi and corrupting my game files wbu
Trying to regain my will to work on maps T_T
I miss working in rpgmaker but I can only do one thing at a time. Maybe after drawing lessons I can come back.
Ever have a day like... you play minesweeper and your very first click is always a mine?

Forum statistics

Threads
94,340
Messages
920,075
Members
124,100
Latest member
Vulgourso
Top