Displaying HP Bars in Bakin
When developing a game in Bakin, youâll eventually want to display HP bars not just for the player and allies, but for enemies as well.
However, this is an area where the official Wiki isnât especially clear on implementation, and I suspect many people have struggled with it (I certainly did).
This article explains how to display HP bars for both allies and enemies.
Using the Layout Tool
When you want to change anything related to the on-screen display in Bakin, the first approach to consider is whether it can be accomplished with the âLayout Tool.â
The âLayout Toolâ is one of Bakinâs core features, accessible directly from the master menu. It provides detailed control over screen layout-related settings.
Most display-related issues can be resolved with the Layout Tool, though some more complex requirements may still need to be handled through event scripts.
For the HP bars covered in this article, a small amount of event script assistance is needed, but the majority is achievable with the Layout Tool alone.

Configuring the Playerâs HP Bar
Letâs start by setting up the HP bar for the player. First, open the âLayout Toolâ from Bakinâs master menu.
You should see a screen showing the various default layout configurations used in-game, like the one below.

Youâll customize layouts here to suit your needs, but the default layouts are locked and cannot be edited directly.
To modify a layout, copy and paste the original to create a duplicate, then modify the copy.
For example, to change the menu display, select the âMenuâ layout category, copy and paste the âMainMenuâ default layout, and edit the copy.
For the HP bar, youâll need to decide which screen to display it on, but thereâs also a general-purpose layout option separate from those screen-specific layouts.
That layout is the âEvent Free Layoutâ found under âIn-Game Presentation.â

The âEvent Free Layoutâ can be called freely from event scripts, which means it requires a bit of event-side work to invoke, but itâs the most flexible layout type available.
For the ally and enemy HP bars covered in this article, Iâll use the âEvent Free Layoutâ to create a versatile, reusable solution.
With âEvent Free Layoutâ selected, click the âAdd Layoutâ button that appears in the âAssign Layoutâ section. Give the new layout a descriptive nameâIâll use âAlly HP Bar Displayâ here.

With the new layout selected, click the âPartsâ button under âLayout Parts.â
A part selection screen will appear. Select âDraw Containerâ and click âOK.â

The added layout part will now appear in the preview area. The purple region is the âDraw Containerââthis is where HP bars and other elements will be added.

The purple background isnât needed for this purpose, so click the âImageâ field in the right column and change it to âNone.â

The unnecessary image display has been removed. Also, update âDisplay Position X,â âDisplay Position Y,â âWidth,â and âHeightâ to position the HP bar in the lower-left of the screen.
Feel free to adjust these values to match your preferences.

Now click the âPartsâ button again to add an element inside the container. Select âSlider Panelâ from the list and click âOK.â
The âSlider Panelâ is the layout part that displays a gauge based on a numeric valueâperfect for HP bars.

The HP bar slider panel has now been added. Give it a descriptive name and drag and drop it into the draw container you created earlier.

To use this slider panel as an HP bar, you need to set the playerâs HP in the âParameter to Reflect in Sliderâ field on the right.
Click âParameter to Reflect in Sliderâ to bring up the parameter selection screen, then click âpartyhp[x].â
The âParameterâ field at the top will now show âpartyhp[0].â This refers to the HP of party member index 0âthe player character.
Note: in event scripts, the player is treated as party member 1, but in the Layout Tool itâs party member 0. Keep this difference in mind (itâs a bit inconsistent, I know).
In practice, the value stored here is likely a percentage (0â100) rather than the raw HP number, but that doesnât matter for this purpose.
Confirm that âpartyhp[0]â is shown in the Parameter field, then click âOK.â

The slider panel is now configured to display the playerâs HP. The default size is too small, so adjust âOffset X,â âOffset Y,â âWidth,â and âHeightâ to get the size and position you want.

To change the color of the HP bar, click the âSlider Image Colorâ field in the right column. Thereâs also a very useful option called âChange Slider Color by Valueâ further down.
This feature lets you change the HP bar color dynamicallyâgreen when HP is high, yellow when it drops, red when itâs critical.
For example, setting âColor Change Start Ratioâ to â70â with yellow means the bar turns yellow when HP falls below 70%. Setting another color change to â30â with red makes the bar turn red below 30%.

That completes the HP bar layout configuration. Adding a player portrait or other elements in the remaining space on the left would make the HUD even clearerâtry adding those once youâre comfortable with the basics.
Next, letâs look at how to actually display this HP bar on-screen.
Displaying the HP Bar On-Screen
To display the âEvent Free Layoutâ HP bar you just created, it needs to be called from an event. This means calling it from a Common Event or from an individual cast event.
For this example, Iâll call it from a Common Event. Open âCommon Eventsâ from the master menu. Click the â+â button to add an event, then under âScreen Presentationâ select âShow Event Free Layout.â
Set âEvent Startâ to âStart Automatically (Repeat in Parallel).â

In the layout settings, select the HP bar display layout you created. For the display method, choose âAdd and Show.â Using âShowâ alone would overwrite any other layouts you want to display at the same time.
To hide the layout later, use âHide Selected Layout.â

The layout will now appear on-screen, but letâs also verify that the HP bar actually decreases. Add a script to the Common Event that reduces the playerâs HP by 1 at regular intervals.
As mentioned in the layout section, in events the player is party member 1, so make sure youâre targeting the correct index.

Finally, add a âWait for Specified Timeâ script at the end. Without it, HP will drop instantly, making it impossible to observe the animation. Temporarily boosting the playerâs max HP also helps with testing.

Running the game, the HP bar gradually decreases, changing from green to yellow to red, and finally triggers a game over when HP reaches zeroâas shown in the screenshots below.
The Layout Toolâs Slider Panel makes it easy to display the playerâs HP bar, and the same approach works for MP bars and other gauges. Ally HP bars for other party members can also be set up the same way by changing the index number.




Displaying Enemy HP Bars
The approach above covers ally HP bars, but enemy HP bars canât be set up the same way because thereâs no built-in display parameter for them.
However, the Slider Panel in the Layout Tool supports âVariables,â so you can manage enemy HP changes through a variable and display it as a gauge.
Specifically: in the enemyâs cast event, store the âCurrent HP (%)â value into a âNormal Variable,â then display that variable using a Slider Panel.
This may sound complicated, but the actual steps are straightforward. Hereâs how to do it.
First, set up the enemy cast you want to work with. For this example, Iâll use the âSlimeâ cast included in the default âNormalâ asset set.

Select the cast in âDatabaseâ from the master menu and click âCast Event Settings.â

In the cast event, create a âNormal Variableâ called âCurrent HP (%)â and use the âSet Event Total Statusâ command to store âCurrent HP (%)â into it.
Note: variables have typesââNormalâ and âLocalâ among others. Slider Panels do not support âLocalâ variables, so be sure to create this variable as âNormal.â
Also set âEvent Startâ to âStart Automatically (Repeat in Parallel)â so the variable stays updated continuously.

Once the cast event is configured, create a new layout in the Layout Toolâjust as you did for the playerâs HP barâand add a Slider Panel. Set the color and size as desired.
For this example, Iâll display a purple HP bar in the lower-right corner. Once adjustments are done, click âParameter to Reflect in Slider.â

This time, the value to set is the variable configured in the cast event. Select âContents of Specified Variableâ as shown below, then choose the âCurrent HP (%)â variable.
The Parameter field will update to reflect your selection. Click âOK.â

Finally, change âMaximum Valueâ on the right side of the layout to â100.â
Since the variable stores HP as a percentage (0â100), the sliderâs maximum must be set to 100 for the gauge to display correctly. (Why the player HP slider doesnât require this is unclear to me.)

To test the layout, add similar HP-reducing test scripts to the Slimeâs cast event.

Running the game shows both the player HP and enemy HP displayed on-screen. To make it less plain, I also added the playerâs portrait image and the enemyâs name as text panels in the Layout Tool.

This HP bar implementation makes managing multiple enemies on screen simultaneously somewhat tricky, but it can be worked around.
For example, you could pre-create five such variables, and overwrite them in priority order as enemies take hitsâallowing up to five enemies to have their HP displayed at once.
This article presents one way to implement HP bars. Thereâs plenty of room to adapt and extend the approach to suit your specific game design.
Summary
In this article I covered how to display HP bars for both the player and enemy characters on-screen in Bakin.
The Slider Panel is a highly useful feature for displaying any kind of gauge, and the technique covered here can be applied to stamina bars, ultimate gauges, and more.
Bakin has many convenient features like this, but how to implement them isnât always clear from the official documentation, which is why Iâve written this up. I hope it serves as a useful reference for someone.
Iâll continue covering how to build games in Bakin going forwardâcheck back if youâre interested.
Also popular with readers
đ Series: RPG Maker Bakin: Game Development Guide (10/17)