So I’m testing a game out in the FPS shooter template. I was able to make an enemy AI that walks towards when I’m in sight, and a projectile that destroys other objects. I tried apply the same blueprints from the normal objects onto the enemy, but when I shoot the enemy, nothing happens. And when I use other nodes, like cast to firstopersoncharacter or casttocylinderobject, it destroys the enemy, but for whatever reason, I can’t get the projectile to destroy the enemy. It’ll get destroyed by everything else, except the projectile. Could someone please help me figure out what I’m doing wrong?
I have the enemy blueprint for destroying the enemy
I have the projectile blueprint
And Here’s what the game looks like
If there’s anything else you need to see from me, let me know. Thank you.
What if I want to place these nodes in the enemy blueprint, because I wanted to set an enemy health variable that decreases with every shot until destroyed? Plus I was going to make several enemies with different amounts of health, so they’re each going to need their own blueprints?
In your blueprints I don’t really see anything that can destroy the enemy blueprint, why don’t you do this instead,
- from your projectile select the collision object
- then add an on component begin overlap event.
- Once its added cast to the enemy blueprint with other actor as object, then destroy the actor.
Here’s a screen shot to show you how you should set it up.
That’s also possible, Here’s a simple example of how you can set it up in your enemy blueprint, each enemy will have to have unique settings if they all have different amounts of health.
Your health variable should be a float, not a integer. Change it to a float then set the health variable default value to 3, then use the compare float node to check whether its below 0 or not. Connect == and < to destroy actor, it should work then. But I’m sure your project will crash if you try to play sound, spawn particles and destroy the actor at the same time, so before destroy actor you should put a delay node, set it to at least 1 second.
I have it Set up like this. I can destroy the enemy noe, but it only takes one shot, and I have my enemy health set to 3 with instance editable checked