Why my enemies don't take damages?

Hi and happy new year everyone !

I have a little problem with my BasicEnemy… I want to damage them when i pressed “A” but it doesn’t work and i don’t understand why !
First, for my hero’s health, i used an interface called “iDamageable” and its perfect, i tried for my BasicEnemy to do the same thing but… Nothing.
So, i decided to set my system for them with “Event AnyDamage” and “Apply Damage” but… NOTHING. AGAIN.

When the game begins, my inputs are disabled but when an enemy overlap the area around my hero, they’re enable and it works (i tried with Print String). So, why i can’t deal any damage to my enemies (BasicEnemy) ?

72459-eventgraphhero.png

Thanks my friends ! :slight_smile:

(I’m going to get mad without your help)

Hello,

  • Is your Event Any Damage ever firing?
  • Have you tried giving the Apply Damage node a Damage Class?

Also, instead of using the apply damage node, you could also just decrement the health variable by 5 on each key press, and then perform all of those checks that you have after your Event Any Damage node.

the problem is definately because on Apply Damage node you have to set the Damage Type Class to something. theres a default one already made for you, im pretty sure its called damage.

Have you ticked the box “Can Receive Damage” (or something like that) in the class defaults of your enemy?

Also you should create your own damage type, even if you don’t change any of the default values.

Hi !

What do you mean by “Is your Event Any Damage ever firing ?”. I have a “CasttoBasicEnemy” attached to an “Apply Damage” node, It’s supposed to work, isn’t it ?

And it’s doesn’t change anything to set a damage class. :frowning:

I think that my problem is with the object reference of “CasttoBasicEnemy” because even when i connect “Set Current Health” “Target, Current Enemy Health” “float - float”, etc. it’s doesn’t work. So, what object i must use to select my BasicEnemies ? :frowning:

It’s doesn’t change anything, even i try to fix health without “Apply Damage”, and just “Set Enemy Health” with “float - float” it doesn’t work. The truth is out there !

Yep, it’s ticked ^^
I’m going to create a damage class ^^

In my Hero’s Event Graph :

In my BasicEnemy’s Event Graph :

Same result… Not working u.u

i think your problem is how youre trying to to reference your enemy. In the first one, im guessing Get Owner did not work for the cast. For your updated one, how exactly are you storing the reference to your enemy in the Hero Blueprint? if you put that A event in the enemys blueprint and set the damaged actor to self that should do it. The way i always set this up is have an event actor overlap or event hit in the projectile or weapon blueprint, and take the hit or other actor pin and plug that into the damaged actor.

Yep, i don’t know how to reference him because with a new variable “BasicEnemy:Reference” it failed. :slight_smile:

For my first update, i reference him with a new variable “Object type” “BasicEnemy:reference”.
I can’t put my A event in the enemy blueprint because his “AIControllerClass” is “EnemyAI”, an other blueprint, and not “PlayerController”.

Let’s explain how it must work for me… Enemies move to my hero to damage him (it works, when they hit him, his health decrease and they die). To damage them, they must be overlapping an area around my hero, at this moment inputs are enable (it works) and i must kill them with A, Z, D. My problem is that i can’t set their life when i’m pressing inputs :(. I failed when i tried to create a connection between my inputs on my “Hero” (because he is the “Player Controller”) and my BasicEnemy.

heres what you need to do, set up booleans that get set to true after the button press events. if that overlapping area around your player is in a seperate blueprint, you will put this next part in there. if not, put it in your player blueprint. Make an Event Begin overlap, cast to enemy blueprint, then have a branch set up for each of the booleans for the key press events. then pluge the result of each true part for the branches into the apply damage node. The blue pin from the cast to enemy will go into the damaged actor pin. inside the enemy blueprint, after the end of the any damage event, do a cast to your player blueprint, use a get player character node for the blue pin of the cast, and set the booleans back to false. that should do it

Thanks for your help but… I really don’t understand what are you saying, which booleans ?

My input in my Hero blueprint (with player controller)

My Apply Damage in my HeroArea (the first part works great, it changes color when enemies overlap her)

And this is my BasicEnemy blueprint who is still not working :cry:

Instead of using the apply damage combined with the any damage event, have you tried just calculating the health on key press?

So for example, when the Hero presses A, get a reference to the enemy, get enemy health, and then subtract 5 from enemy health, and set the result of that as the new value of enemy health. This will mean that on each key press, the enemy’s health will drop by 5.

Is that something that you could try?

It doesn’t work… It’s weird. How am i supposed to reference my BasicEnemy in my Hero’s Graph ? It seems that “get owner” doesn’t work :open_mouth:

Dude you dont have to. And get owner would definately not refer to your enemy inside of your heros blueprint. Do an event begin overlap or event hit, and take the hit or other pin and plug that into the cast to enemy. If you want to refer to your enemy directly you need to set all this up in your level blueprint