How to spawn an actor on AIs death in paper 2d, 4.12

Im trying to spawn a actor (CigsBox) from inside the AI character blueprint. Everything looks correct, but the actor never spawns.

The problem is that you destroying your AI before it gets the chance to spawn the actor, instead you can set your actor to hidden, disable it’s collision, delay, spawn you actor, then use the destroy function

its still not working? is there something wrong with the transformer?

still no good :frowning:

try putting a delay before the destroy actor

Maybe you are spawning an actor at the wrong location. Let’s isolate your code, just try to make your actor spawn another actor, no destroy function or any other function. Does it work?

Ok, but the other functions were working before? it’s just the spawn then that is not working. Are you sure of the spawn location? Can you set it to a static value, like a place that you know on screen?

no, if i disable all other functions so the on any damage event only spawns the actor, it still does not spawn.

The spawn transformer is set to “Arrow1” which is a component of the actor that is right above the actor, to insure that the actor isnt breaking if its hitting the actor i put the arrow a good amount above the actor (for trouble shooting only)

110348-actorimage.jpg

it does not spawn with right click

instead of using on event anydamage, can you connect it to event right mouse click? I just want to see if the issue is from the spawn or the event is not being called properly

This is so weird. Add a print string function after the spawn, and from the return value of the spawn function, get the actor location and print it. What do you get?

it says 0,0,0, for location, but this time i got an error message

110351-location.jpg

it means that you are destroying you actor from your crackheadBP, there is a destroy actor somewhere that you have missed

The problem is that your box is overlapping with your actor the minute it spawns. so maybe spawn it a little further away from the player?

This is strange, it should not destroy unless it overlaps with the player. Did you connect the destroy actor after the cast?

the character BP is derived from a parent BP
here is the graph for the parent and the ai character
ive deleted all destroy actors in both and deleted the on any damage in the parent, still gives me the same error

ive found the error, it was inside the CigsBox BP, by cutting out the destroy actor in cigsbox, the actor now spawns, but then that makes a new problem, i want the cigs box to be destroyed after the player picks it up, how can i do this with out then rebreaking my spawn actor function again?