I want to deal damage by clicking - simple but confusing

Hello,

So for the past two hours I’ve been trying to do something simple - deal damage to an enemy by clicking it. Let’s say it has 5 health, and each click does 1 damage.

I’d attach the blueprints I tried but at this point there are so many that I doubt they would be of any help. I tried onclick events, apply damage and other stuff, nothing really seemed to work and I am mind-boggled that nobody has asked about this before and there are no tutorials for something so simple.

I’d love if someone could help with a step by step guide of how to deal damage to an enemy by clicking him. It sounds so simple but somehow I just can’t manage to make it work.

Thanks in advance!

You’ve done it just about perfectly.
Inside the enemy, implement the AnyDamage and OnClick events:
image

Should look like this:

On the ActorOnClicked event, simply call ApplyDamage on self. You can also plug in self to event instigator and damage causer, but that’s not in any way required.

On the AnyDamage event, simply subtract the damage from your (the enemy’s) health. I’ve added a max node so that we don’t go below 0 health.

The two of them combined should look like this:

1 Like

Hey,

Thanks a lot for the reply!
Apparently, I did get it right, I was just making a mistake that I am ashamed to admit… I was not putting in the scene new Blueprints after modifying them. In my defense, I am still learning, but still.

Thanks again, a lot!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.