I’m trying to apply damage to an AI actor via a line trace weapon. I’ve already implemented the system for Projectile weapons and it works great, but for some reason, the same basic system with line trace doesn’t do anything. Everything else is working, when I shoot the AI, it plays the blood splatter particle, plays the impact sound but no damage. Also, when I test the Hit actor it’s returning the correct result. This is my code:
I can also see that the damage amount to be applied is correct.
When you share a code like this, since the functions/variables you used cannot be checked out, its hard to say imo. However I bet the problem is with the Is Hitbox function or maybe in the Damage map variable. If you would share how you handle stuff in those two, I’ll do my best to help!
To add, here is how I do it in my project, and it works properly:
Sorry yeah, I’m using it along with the Smart AI marketplace plugin so there’s a lot more to show. I figured what’s there is enough to get the gist because everything else is working. The health system for the AI and the line trace system for my weapon. The only thing that I found odd is that in the projectile, for the instigator, I used Get Instigator and Get Controller nodes, but on the line trace I got an error that Get Instigator returned nothing. Which is weird because both the projectile weapon and the line trace weapon are child blueprints inside my character bp. That’s the only thing that stood out as odd to me. But hard wiring to the player controller should work just the same, so I dunno if it’s related.
From what I can tell, you code is quite similar… the major difference is you’re applying point damage. Is there a benefit to using that node vs Apply Damage?
OMG! Apparently using Get Owner as the Damage causer didn’t work. As soon as I switched it to be a hard get to the player character it worked.
So that makes no sense. If both the weapons are child blueprints, why wouldn’t Get Instigator and Get Owner work?
Yeah not really a benefit but I love being able to get all the details from the point damage version.
(Edit: redacted, I’m just sleepless) The owner is the actor to which your component is added to. Usually I use Get Owner for networking purposes to find out which component belongs to which actor (for e.g, item drops). If your weapon is not a component of the player, Get Owner will return the weapon itself.
But the weapon is a component of the player because it’s a child blueprint. That’s why I was confused. Why doe the damage system care who the instigator is anyway? lol. It should apply damage regardless of where it’s coming from. Thanks for your help though