How to get bullet to apply damage

I created a turret that fires a bullet but its not damaging my player, the turret is working and firing correctly but the bullet doesnt effect the players health.
Here is the bullets code

Then here is the code that I used for another item that both damages and teleports the character which works perfectly so I don’t know why the bullet wont work.

Print the name of what you’re hitting. What are you hitting?

I would first strongly suggest testing the thing being hit to see if it is of the proper type
Out of the Other Actor do a cast to like your [PlayerCharacter], and then if that cast is successful (with an isValid() the one with the branch I find is cleaner and less buggy)
then do your ApplyDamage()

you are probably hitting the wall or the ground, or some other collider.

I added the print string and when it fires and hits my player it prints the text

What is the Display Name of the thing that you are hitting?

image

Or you can check the class.

Its my player character, is that what you mean?

Like this?

What is the actual text you see on the screen?

Sorry I’m not the best at this, what text are you talking about? There’s nothing but if I hook up the print string that text comes up when hit.

This should show text in the upper left corner when the bullets connect. What does it say? Does it print at all?

Oh okay, its the turret instead of me. How would I stop that?

  • either offset the location of where the bullet spawns - in front of the muzzle/barrel
  • or look into collision filtering, you can adjust with a lot granularity what is allowed to collide with what

thank you

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