Actor Comparison not working

Making a simple shooter that lowers the AI’s health when the bullet hits them, but the blueprint isn’t registering the actor as the one I have set in the blueprint

Side note, I also plan to copy and paste more of the AI Character into the map and have them spawn in, will this require any changes?

I talked this over with another programmer I’m working with and we’ve come up with the following:

The first thing I’d like to point out is that you’re destroying what I assume is your projectile actor as soon as it hits. Thus the remaining exec chain after it won’t run. I’d recommend moving destroy to the end of the projectile bp, even though that may introduce edge cases later where a projectile may hit twice. This can be cleaned up on the pawn by switching from ‘event hit’ to ‘event anydamage’ as shown in the image below. Another thing to mention is that you shouldn’t check if hp is 0, but rather if it is <= 0. This will ensure that if your HP goes negative it will also destroy the actor instead of him staying alive, but with negative HP.

As far as your == check on AI_Character1, you should be checking if the object hit’s class is == your AI_Character1 instead. This is also shown in the image below.

The last thing I’d like to mention is that your cast will naturally fail if the object isn’t AI_Character1 so it may be that your == check in general is just unnecessary fluff should you continue to do it that way.

http://i.imgur.com/2lJPn6Z.png

No problem :slight_smile: It’s fun to browse around and see where we can help!

Thank you soooo much! I took the bottom half and put it in the AI_Character with the class as the projectile and left the projectile to delete on hit, that way it deletes when it hits any object and it works! Very grateful right now!