How to get reference to ai character in player BP

I am trying to setup a damage system where when a model’s collision box collides with the character capsule it does damage and takes away from health, i did this with the character being able to damage the ai and it worked perfectly. now i am trying to use the same method but for the ai to damage the player.

The problem is i cannot seem to get a reference to the AI like it did with the player. is there any way to get it? or is there another way?

this is the AI damage to player set up. the highlighted node is the one i want to change out for an AI reference of the same type

this is the player to AI damage that works perfectly fine

also each of these setups are in the opposites BP system so (player damage AI-in->AI’s BP)(AI damage player-in->Player BP)in case it helps

thanks to advance to whoever help’s me figure this out

I think you overly complicated this system with multiple casts…you have a character with a sword but you made the sword a separate actor? Same thing with the AI and its sword…you should just have them on their respective actors. Then when the AI overlaps the player (with the sword, which is now apart of the AI blueprint) you cast to “player character” and if successful player loses damage. You can do the same thing for the AI.

a few pictures that may help. to answer the title question, in this case your not really getting a reference to the enemy but rather your taking a reference that you dont know what it is and seeing if it is an enemy by using a cast to compare it to a certain class. so in the picture below youll see that i took the overlapping actor and looked to see if it was an enemy then if was true i apply damage. now the component for the begin overlap in your case would be the weapon since that is what would be applying the damage logically.

you will also need to come up with a way to limit when and how often the overlap will occur so that you dont get multiple hits with one swing and so that you can only apply damage when you are attacking.