I’m working through setting up a 1-on-1 card fighting system. However, for the moment, I’m simply using the Puzzle Template to damage my enemy whenever I click on one of the blocks. Before trying this, I set it up to do it on my own character, and it works perfectly. The following screenshots illustrate how I did this:
Simple, really, and it works splendidly. Unfortunately, the same cannot be said for when I try to manage enemy damage with the same approach. This is simply because I obviously can’t plug in “cast to player character–>get player character” into the EnemyProcessDamage bind event target, like before. I need to cast to my character, but then comes the issues of the “object” input.
Does anyone know of a way by which I can cast to my enemy character, and not my player character? I’ve tried using an interface, but it seems that’s not the solution to my issue; although, if you do think of a way to properly use interface for this, I’m all for it.
And a second Answer for good Messure. The more “Proper way” of doing it.
Make a Actor (or other Base Class) Variable in your Widget BP and expose it on Spawn. Let your Individual NPC´s/Players Create the Health Widget (everyone gets one no need for a Massive one who Handles everyone) pass “self” to the Widget. Now your Health Widget knows from who to pull Data from (you simply pass it along).
Preferably you would have a common Base Class for your Character, NPC´s etc or a simple Component that holds Health and other Data you might want. Just pass along where you want to get the Data from.