Track Player Attributes
Last modified: 29 December 2024The combat system provides Viewmodels to support your user interface. Let's get started with that topic, by creating some progress bars that will track the player's main attributes: Health, Stamina, and Magic.
Create a new widget, based on
NinjaCombatBaseWidget
.In the Designer tab, add a Vertical Box and three Progress Bars, with Size boundaries.
In the Viewmodels tab, add a
ViewModel_CombatVitals
entry. In the Details panel, set the Creation Type to Create Instance.tip
Feel free to create any design that is appropriate for your game, but make sure to use a Progress Bar for now.
tip
If you cannot see the Viewmodel or View Bindings tab, enable them in the Window menu.
In the View Bindings tab, set the following bindings
Health Bar: HealthBar::Progress Value ← ViewModel_CombatVitals::Health Percent
Stamina Bar: StaminaBar::Progress Value ← ViewModel_CombatVitals::Stamina Percent
Magic Bar: MagicBar::Progress Value ← ViewModel_CombatVitals::Magic Percent
Go to the Graph tab, and implement the
Construct
event, setting the Player Pawn as the Combat Actor.