Build a Map HUD
Build a Map HUD (Map screen)
Goal
Render a simple Heads‑Up Display (HUD) on the Map screen using platform data (player stats, map name, gold). This tutorial only touches UI code inside the menus workspace; the plugin wiring is already handled for you.
What you’ll build
A
MapHUDReact component that observes platform data viaRPGBridge.GetPlatformData()and displays:Current map name
Party gold
Current actor’s HP/MP (actor 0)

Prerequisites
React UI is set up (
menus/built at least once)Plugin enabled and overlay visible in your project
Create the component Create (or reuse)
menus/src/views/tutorial/MapHUD.tsx:
Notes
Uses Tailwind utility classes for layout/visuals. The only inline style is the dynamic bar width, which is computed at runtime.
The component uses
observerso it re-renders when MobX-decorated platform data changes.The engine remains the source of truth (gold, hp/mp, map name). When MZ updates these values, your HUD updates automatically.
Add the HUD to the Map screen Open
menus/src/views/MapScreen.tsxand render the HUD inside the Map screen layout. Example (pseudo-structure):
If your screen uses a main container with relative positioning, the absolute positioning in MapHUD will anchor relative to it; otherwise, it will anchor to the overlay root (which is pinned to the viewport by the plugin). Adjust styles as desired.
Build and run
Package and run your game as usual. Enter a map: you should see the HUD with the current map name, gold, and actor 0’s HP/MP bars. As values change (combat, items, map transfers), the HUD updates automatically.
Extensions
Show more party members by iterating
gameParty.members()Add EXP bars or level/TP
Swap to icons/sprites from
platform.gameInfo.getIconPath()/getPortraitPath()
See also
Last updated