To allow the enemy to cast 'magic' style de-buffs on the player, we need to use a blueprint interface, to help the enemy and player character blueprints communicate with each-other.
Next, in the class settings of both characters, we need to register this interface, so that both blueprints know it is there.
In my boss enemy blueprint, I create the systems that will cause the debuffs to happen. The first one calls it directly, the second spawns a fire object, which attaches itself to the player, then calls the debuff.
In the player character, there are corresponding events which receive the calls via the interface and take appropriate actions.
The provided documentation didn't show how to implement the fire damage, so I decided to use a function timer which calls a function to take health off over time.
Not only is this good for magic attacks, it can also be used in helpful situations, for example a friendly NPC casting a heal spell on the player, which triggers a health restoration in the player blueprint.




No comments:
Post a Comment