Destroy Actor not working (help)

hi, im getting those pending kill error messages, and framerate is slowing over time as enemies are killed.ie their health reaches zero, and play explosion particle, sound effect, camera shake,

I tried adding destroy actor, and tried destroy component, but its not working, can you guys help. thank you.

Where is the Health Check function called from? From within this blueprint or from without?

hi , it is being called from within this blueprint, i att

ached a screenshot

Sorry, this screenshot is too small, can’t make anything out.

The error you get contains a reference to the function that’s called after the actor is destroyed. Where does it lead you? You have to determine why that function is called after the actor is destroyed.

can you zoom in on the code

What’s happening is that when the actor takes a hit and it’s hp is already 0, and “Destroy Actor” already run, the function will run again, as Destroy Actor just enteres the actor in a Destroy Queue and isn’t done necessarily on the same frame.
But specially when it takes damage from more than one source, and is killed by the first, but still gets hit by the rest.

When you do the damage, check if actor isValid first.

hi thank you, can you please tell me how to connect the isValid node, i am new to scripting.

hi i tested just 1 enemy type. Got this more specific error, and the BP script.
Can you please tell me how to fix it in the script, thank you.

You can wire up anything to the isValid macro.

263792-0.png

But I meant before that you should check if the actor being hit is valid. And if it is in fact still valid, do the damage.

Also, the isValid Macro just does this:

263793-1.png

use the node isValid after set relative scale 3d. in the object put the reference to shipmodel. and from the isValid pin drag out and then use DestroyActor. also im not sure since i didnt read all the chats where the blueprint is placed. because since u dont have anything plugged in DestroyActor it should destroy the actor this blueprint is in. if u wanna destroy the ship model drag the reference of ship model and plug it into the destroy actor’s target.

hi thanks, i did exactly that, but getting the same error. I also tried destroy component, as well as destroy actor. no luck.
Is it related to Get Health, there is only 1 other instance of get health in the AI_Ships script (attached) And the first script (the one we are trying to fix) is the only script where 'ship model’is referenced. Do I even need ship model reference, are there any workarounds, etc thanks