How can I cast from a widget to a non-NPC character?

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.

Make a delegate somewhere easy to reach by everyone like GameMode in my Example. Add Parameters as you like.

In your NPC´s, Characters or whatever at any time dispatch that event like that:

And in your Widget Bind to the Event from GameMode (Dont forget to assign your Gamemode properly)

Note: You have to bind to a Event just once BeginPlay or EventConstruct is enough. Don´t do it on Tick =)

And ofcourse “Who” you can Cast to whatever you need or use Interface Calls like “Get Health” you can implement in the Individual Blueprints.

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.

Good Luck and take a smart approach =)

This is more than enough information, Nachtmahr, thank you! This solves even more issues for me than just this.