Code made for starting a common event by levelling doesn't work...

hello! Recently I got some code made that looks like this:

#-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- def level_up @level += 1 self.class.learnings.each do |learning| learn_skill(learning.skill_id) if learning.level == @level end case @actor_id #these are for conversation items when 001 #This is the Actor ID $game_temp.reserve_common_event(9) #This is the common event ID when 002 $game_temp.reserve_common_event(8) end endnow, as far as I have made it work, when I have actor 1 in the party, it works. When I have actor 1 and actor 2 in the party, it works. But, when I have actor 2 only in the party, it doesn't run at all!

this is one of the two common events that it's calling:

bekb9dd.png


I'm not posting the other one cause they are practically identical.

So, what can I do to fix this?
Hi ♫

The problem (or at least, part of the problem) is that the way the that code is written it can only every trigger one common event, even if it is called multiple times for each actor. 

This topic has a better solution.

/Kai
how do I implement the code you are linking me to? Like above main or in the game_actor script or?
Hey ♫

Always above main! 

/Kai
I added that script into my file and got it to work, kai, but it still does the same thing. I have the first two lines set like this:

'0'=>9, 

'1'=>8,

 

where 9 and 8 is the common events they should be calling.

 

If actor corresponding to 0 is in party, the event plays for them.

if actor 0 and 1 is in party, the events for actor 1 and actor 2 plays correctly for each of them.

if actor 1 is in party the event for them doesn't play at all.

 

Why does this happen?

Original thread: https://forums.rpgmakerweb.com/threads/code-made-for-starting-a-common-event-by-levelling-doesnt-work.43637/