Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.
This is how I would do it. Keep in mind I use an alias instead of overwritting the origional method (an alias is used to add code before/after an old method is called)
Code:
class Game_Actor < Game_Battler
alias_method :seplaywhenlevel_gmactor_chgexp, :exp=
def exp=(exp)
# Store old level...
old_level = self.level
# Call old method...
seplaywhenlevel_gmactor_chgexp(exp)
# If now level is less than previous
if self.level < old_level
# Play level down sound
Audio.se_play("Audio/SE/058-Wrong02", 100, 100)
# Else if now level is more than previous
elsif self.level > old_level
# Play level up sound
Audio.se_play("Audio/SE/056-Right02", 100, 100)
end
end
end
i used Audio.se_play("Audio/SE/056-Right02", 100, 100)
and put it in Window_BattleStatus
after self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
this seems to work it was that i didnt know how to reference a sound
thanks Kain Nobel