MZ Play a SE or ME when Level Up

Hello guys, i've been searching high and low for this, and the alternatives i found didn't worked for me.
I need a plugin that plays a SE or ME when the text "Actor X levels up to Level Y" on the victory aftermath window.
More especifically, when this window pops up:

767.png


I have managed to make the SE plays when battle ends, but i need to play exactly when this window shows up, and for every actor that levels up.

Thanks for all the help, guys!
You should be able to find with a quick Google plugins that run a common event on level up.

If the timing doesn't quite match for your purposes, let us know and we can go from there.
@ATT_Turan
I tried a lot of solutions, but none worked for my purpose.
The closer I got was using this plugin:
but it only managed to play the SE after the battle ends and the map screen shows up.

A probably better solution that i thought could be easier, is to play a SE everytime a certain phrase is shown, in my case "rose to Level".
This way, it's certain that the SE would play exactly when i want it to be played.
But i don't know if the battle aftermath (image above) is considered a message window.
Try this.

Code:
var origDisplayLevelUp = Game_Actor.prototype.displayLevelUp;
Game_Actor.prototype.displayLevelUp = function(newSkills) {
    AudioManager.playSe({name: "filename", pan: 0, pitch: 100, volume: 90});
    origDisplayLevelUp.call(this, newSkills);
};

Change filename to be the filename of the sound effect you want to play (no extension).

Copy and paste into a text editor, save as a *.js file, include as a plugin.
If ATT_Turan's solution doesn't work Eli Message Actions might be able to do it if you tie the play SE script to the "leveled up!" message

@ATT_Turan
your plugin worked the same as the plugin i mentioned, it plays the SE when the map screen shows up.

@AquaEcho
i installed the Hakuen plugin, but was unable to set it to work. I couldn't figured it out how to tie the SE script to a specific text being show.
You must have some other plugins that are changing things, then, because in my new MZ test project it works exactly as expected.

You can even see in the code I typed that the sound effect line is happening before the default code is called - there's no way, without something else affecting it, that it would instead happen afterward.
You must have some other plugins that are changing things, then, because in my new MZ test project it works exactly as expected.

You can even see in the code I typed that the sound effect line is happening before the default code is called - there's no way, without something else affecting it, that it would instead happen afterward.
I had an active plugin that showed the actor's parameters change in level up
I disabled it, and the SE started playing as soon as the last enemy is down and the victory window pops up.
What i need is to the SE plays only when the level up text shows.

I started a fresh test project with only your plugin on, and the result was the same. The SE plays the moment the victory windows pops up, and only once.
@ATT_Turan
your plugin worked the same as the plugin i mentioned, it plays the SE when the map screen shows up.

@AquaEcho
i installed the Hakuen plugin, but was unable to set it to work. I couldn't figured it out how to tie the SE script to a specific text being show.
There's a playSE escape code. Looks like it's \PSE[Attack1] in the plugin sample. You would it add it before/after the %1 is now %2 %3 message here (under the terms section of the database).
There's a playSE escape code. Looks like it's \PSE[Attack1] in the plugin sample. You would it add it before/after the %1 is now %2 %3 message here (under the terms section of the database).
It worked like a charm.
Thank you so much @AquaEcho ! I've been stuck in this for several days!

Thread can be closed, problem solved.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/play-a-se-or-me-when-level-up.165827/