Dealing Damage to Another Character

How do I deal damage to another Character in my game from the player. what id like to happen is input action deals damage to whatever other character I’m mousing over. Right now I have the Input Action “1” deals damage to a “AiCharacter” (the name of the enemy) variable, and I want to set the Variable to whatever I mouse over and I cant seem to figure out what to do there.

Please post some Blueprint screenshots and/or C++ code. Which variable are you trying to set, is it a damage variable on your player character that you are attempting to pass as damage to your AI character?

Yea that thats exactly it. Im not very good with BPs yet and the terminology is loose in my mind. I have a player controller where I have all of my inputs, then i have a AI controller named AITest that controls the AICharacter named AICharacter.what i want is to press 1 then deal damage to the AI Character that my mouse was over when I pressed 1. Im just not sure how to go about doing it. im use to using casting to communicate between blueprints but im at a lose for this one im not sure how to reference the AiCharacter into the object variable i created. originally i tried using the Apply damage function and that also required me to some how reference the AICharacter.
I did try to post pictures but for some reason it wouldn’t let me. this picture is kinda what i got so far for this particular problem. if you need me to show you anything else let me know.

Create an Apply Damage node, then drag from the As AICharacter pin to the Damaged Actor input on the Apply Damage node. Delete the SET node at the rightmost end of your graph and drag the execution pin to ApplyDamage. Set Damage Causer on Apply Damage to self. Hopefully that will work.

Here is more information on damage in UE4:

The following is a related question on damage and blueprints that links to another:

I appreciate your help, if you dont mind helping me out a little more, i must have messed something up.

So this is what i have set up in the controller now since i can better determine whats happening just but pressing a number instead of mousing over. and the print string doesnt print so somethings messed up there.

and thats what i have set up in the AI character side of things to take damage

Ok I played around with it some more and heres where I got.

So this part seems to go all the way through, the print string works so i successfully applied damage when i press 1

However when i check it on the AI side of things the damage doesnt seem to go through.

you likely want to do a line trace by object, thats a raycast from one point to another, it returns if it hit something and what it hit, so you would cast a ray from the player position like 200 meters, and if it hit something, and what you hit is a icontroller, then you apply damage to it, i dont know if forward fector for your actor is exactly what you want but it could be enough to let you start, if it does not work then enable debug draw lines, they will show you what happend, and if you copy the picture multiply the forward vector with a big value like 10k, cause otherwise you are only looking for something with up to 1 unreal unit distance, which is 10 cm as far a i remember

Problem resolved I had to specify what AICharacter I was attacking in the Level Blueprints.

Awesome that will work really well in the future i want to get a lot of different abilities. So this will work well for a ranged ability or maybe an ability that hits everything in a line in front of the player. For now i just wanted to be able to deal damage when I press 1, and i finally got that to work, and i was going to close the thread but if I have you here do you mind helping me make it so that it damages what ever actor im mousing over? Currently I press 1 and it deals damage to what ever target i have moused over currently.

The mouse over stuff is in the level blueprints.

Even more of a problem solved i figured out that doing it in the Level BPs was not the right thing to do and instead figured it out with a break hit result in the character controller that did damage based on the actor my mouse was over

Sorry I didn’t help out earlier, a ton of things suddenly came up. Good to hear that you finally figured out your problem.