[SOLVED] Levelup Sounds

Hey. As the title says, I need a script that will randomly play 1 of specific sounds designated per character when they level up.

The main purpose is to use the VA lines I have from the game's voice actors.

Diamondplatinum3's "Actor Voice in Battle" script, which I already use, does that, but it's limited to when gaining exp from battling monsters, and my game uses a lot of dialogue checks that can give exp to the party (it's actually the main source of exp).

Can anyone help?

Respectfully,
Rutsah

(PS: Naturally, I will give credit properly.)
it's limited to when gaining exp from battling monsters
Do you have an older version of the script?
I have v2.6
LIne 746 or something says
# What Actor One Will Say when LevelUp Occurs
Leveling up sounds are included in DP3 Actor Voice in Battle script.
Do you have an older version of the script?
I have v2.6
LIne 746 or something says
# What Actor One Will Say when LevelUp Occurs
Leveling up sounds are included in DP3 Actor Voice in Battle script.
That's the one I have too but it doesn't work for the levelup outside of battle. (and all the other battle voices work normally, so I don't think I'm using it wrong)
Edit: Just tested it IN battle with an event that adds exp and it works normally, so it simply doesn't work outside of it.
the levelup outside of battle
Is that the command levelup in the editor?
Not gain exp?

I see it now. That method was not checked.
add this. Take it apart and add it to the script or add it below.

It actually should replace gain Exp method. Otherwise it will play twice when gaining exp.
Ruby:
class Game_Actor < Game_Battler

  alias dp3_gameactor_level_up_1s098yu9j               level_up
  #--------------------------------------------------------------------------
  # * Aliased Method: Change Level
  #--------------------------------------------------------------------------
  def level_up
    last_level = @level
    dp3_gameactor_level_up_1s098yu9j # Call Original Method
    if @level > last_level
      DiamondandPlatinum3::BattleVoices::play_leveledup_voice(@actor_id)
    end
  end
 
end
Is that the command levelup in the editor?
Not gain exp?

I see it now. That method was not checked.
add this. Take it apart and add it to the script or add it below.

It actually should replace gain Exp method. Otherwise it will play twice when gaining exp.
Ruby:
class Game_Actor < Game_Battler

  alias dp3_gameactor_level_up_1s098yu9j               level_up
  #--------------------------------------------------------------------------
  # * Aliased Method: Change Level
  #--------------------------------------------------------------------------
  def level_up
    last_level = @level
    dp3_gameactor_level_up_1s098yu9j # Call Original Method
    if @level > last_level
      DiamondandPlatinum3::BattleVoices::play_leveledup_voice(@actor_id)
    end
  end
 
end
Still doesn't work. No crashes or anything mind you, just doesn't seem to change anything for the voices.

The events I'm talking about are a simple +500exp or something.
Do you have scripts below this one?
Something could be overwriting it.
The original script would work fine for +500exp. it calls the gain_exp method so that's the original code.
Game_Interpreter command_315 calls actor.change_exp which calls level_up if the actor gains a level.

I don't see anything wrong. And it works fine in battle when you level up?
Very strange.
The battle calls gain_exp which calls change_exp so... ?

So I would be interested in knowing what other scripts you have below this one.

Wait just found it. There is a check for if you are in battle.
So it will only work in battle.
Comment out line 1068 - from the original script. return true if !allowed_to_play_voice?() under
def self.play_leveledup_voice(actor_id)
Do you have scripts below this one?
Something could be overwriting it.
The original script would work fine for +500exp. it calls the gain_exp method so that's the original code.
Game_Interpreter command_315 calls actor.change_exp which calls level_up if the actor gains a level.

I don't see anything wrong. And it works fine in battle when you level up?
Very strange.
The battle calls gain_exp which calls change_exp so... ?

So I would be interested in knowing what other scripts you have below this one.

Wait just found it. There is a check for if you are in battle.
So it will only work in battle.
Comment out line 1068 - from the original script. return true if !allowed_to_play_voice?() under
def self.play_leveledup_voice(actor_id)
That did it. Thanks man.

Original thread: https://forums.rpgmakerweb.com/threads/solved-levelup-sounds.144035/