The Hitpoints and XP systems have also received minor revamps in v3.0 edition of Tower Defense Starter Kit. Both components now derive from StatContainer, bringing them in line with the rest of the stat driven systems in the toolkit.
BPC_Hitpoints is added dynamically during Agent Profile initialization for both towers and battle units, with the health stats pulled from the relevant data table row and passed in at spawn.
From there it initializes its stats through the same pipeline as every other StatContainer based component in the toolkit, with Stat.Health.Max driving the starting health value.
Damage is now handled by binding to the owner actor's OnTakeAnyDamage event, freeing up the parent class from having to carry any damage logic directly.
When health reaches zero, the component fires the OnHPDepleted event dispatcher. Since the Agent Profile listens to this event, its termination protocols are triggered in response.
The XP system is handled by BPC_XPSystem, which is only added if bCanLevelUp is enabled in the data table for that tower or unit.
It tracks current XP and level, and increments XP each time the agent completes an output cycle, whether that is a tower core firing or a battle unit landing an attack. On level up it applies a set of stat modifiers to every relevant StatContainer based component on the owner, covering the tower core, hitpoints, and any attack modules in one pass.
Both systems are reflected in the UI through Widget_3DStatsBar, a custom widget component on the agent's parent class. It finds the Hitpoints and XP components on its owner at startup, binds to their events, and updates the health bar and level display independently without any other component needing to know it exists.
That wraps up the Hitpoints and XP systems for v3.0 of Tower Defense Starter Kit.
The next post will cover the Stats Display system and how agent stats are communicated to the player through the UI.




Comments
Post a Comment