How can I create a slash for exp?

I'm creating a custom menu by images to deviate a little from the standard, I managed to make an hp and mp bar, but I can't do the same with exp, which would be something similar to this:

level_bar.png


when the actor gains exp the bar goes up, until it reaches the next level and then it resets again:

level_bar2.png


These images are from the Visustella project menu, basically this is what I want to do.
When you say you're making a custom menu through Images, do you mean an evented menu?
When you say you're making a custom menu through Images, do you mean an evented menu?
Yes, through events I managed to do it with hp and mp like this:
hp_bar.png

But doing this for exp is different right? I do not know how to do
(ignore the name "nextxptest" it's just the image name)
For exp bar it is mainly the same thing, just a 'bit' different:
JavaScript:
let expLevel = $gameActors._data[actorID].expForLevel($gameActors._data[actorID]._level);
let expBar = Math.floor(($gameActors._data[actorID].currentExp() - expLevel) / ($gameActors._data[actorID].nextLevelExp() - expLevel) * 100);

//  $gameScreen.showPicture(Picture ID, "Image/Location/Name",0,X-Coordinate,Y-Coordinate,X-%,Y-%,Opacity,Blend-Type

$gameScreen.showPicture(1,"menus/status/ExpBar_Empty_2",0,X,Y,100,100,255,0);
$gameScreen.showPicture(2,"menus/status/ExpBar_Fill_2",0,X,Y,expBar,100,255,0);

What this does is first, finds how much exp the actor needs to level up for their current level.
Then, it does some math to determine how much % of the level they finished.
Next, it displays the Empty Exp bar where you want it.
Finally, it displays the Filled Exp bar in the same place, BUT the width % of the picture, is determined by how much %exp they actually have.
So if they're only 30% of the level finished, the bar will show the full empty bar, and 30% of the filled bar.

Note - The picture just gets smushed smaller, not cut off 70% and show 30%.
For exp bar it is mainly the same thing, just a 'bit' different:
JavaScript:
let expLevel = $gameActors._data[actorID].expForLevel($gameActors._data[actorID]._level);
let expBar = Math.floor(($gameActors._data[actorID].currentExp() - expLevel) / ($gameActors._data[actorID].nextLevelExp() - expLevel) * 100);

//  $gameScreen.showPicture(Picture ID, "Image/Location/Name",0,X-Coordinate,Y-Coordinate,X-%,Y-%,Opacity,Blend-Type

$gameScreen.showPicture(1,"menus/status/ExpBar_Empty_2",0,X,Y,100,100,255,0);
$gameScreen.showPicture(2,"menus/status/ExpBar_Fill_2",0,X,Y,expBar,100,255,0);

What this does is first, finds how much exp the actor needs to level up for their current level.
Then, it does some math to determine how much % of the level they finished.
Next, it displays the Empty Exp bar where you want it.
Finally, it displays the Filled Exp bar in the same place, BUT the width % of the picture, is determined by how much %exp they actually have.
So if they're only 30% of the level finished, the bar will show the full empty bar, and 30% of the filled bar.

Note - The picture just gets smushed smaller, not cut off 70% and show 30%.
It worked, thanks a lot, after hours trying to do this you showed me the solution, thanks again
I was testing here and I think I found a small error, the image of the bar that moves when it increases it also ends up walking forward and leaving the place
exp_bar.png
exp_bar2.png
Ahh yes, the reason why that happens is because of how it draws the image squished up.
A solution is possible, but it's easier to 'show' than to explain.
ExpBar_Empty_2.png
ExpBar_Fill_2.png


Here are the 'empty' and 'fill' bars I've used with this script before.
The 'trick' is that when placing the 'fill' bar, make sure it's 2 pixels to the right.

For example: If you place the 'empty' bar at X-coordinate 100, you put the 'fill' bar at X-coordinate 102.

This may not work for you depending on screen resolution and image size in relation to the screen. BUT it just requires a little bit of tweaking. I had the same issue when first creating it myself, and this was the solution that worked for me.
Ahh yes, the reason why that happens is because of how it draws the image squished up.
A solution is possible, but it's easier to 'show' than to explain.View attachment 215036View attachment 215037

Here are the 'empty' and 'fill' bars I've used with this script before.
The 'trick' is that when placing the 'fill' bar, make sure it's 2 pixels to the right.

For example: If you place the 'empty' bar at X-coordinate 100, you put the 'fill' bar at X-coordinate 102.

This may not work for you depending on screen resolution and image size in relation to the screen. BUT it just requires a little bit of tweaking. I had the same issue when first creating it myself, and this was the solution that worked for me.
Ok thanks for the solution again GmOcean ^^ 👍 😀
Hello, I wanted a similar help, I want to do this with the character's hp create a health bar for him, but I still don't understand much about how I can do this

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-create-a-slash-for-exp.144572/