AI Respawn Location when destroyed

I really need help here with something that yet seems so simple…

On EventBeginPlay, I’m spawning AI from Level Blueprint using a BP_TargetPoint and it works perfectly.

AI runs Behavior Tree precisely as intended in the AI Character Blueprint and I am able to damage and kill/destroy AI Character as it should.

However, upon destroyed actor and delay, I should be able to spawn AI from Class and reference it to the same location/sprite… and I’m lost at sea here :frowning:

Am I referencing to location correctly?

Could the BehaviorTree be the problem? Because I am able to respawn the AI on destroy if I set a fixed location on the XYZ axis without referencing it to a Target Point and using custom roam/chase events in that same Blueprint. But no BT makes it look crappy and unnatural and I would have to set locations for every character on every level which is INSANE. There has to be a better way…

N.B.: I did the UE4 “Bind/Assign Event to OnDestroy” Tutorial and it’s just not working either…

Thanks in advance for your inputs or suggestions.

Cheers,

I’m still new to ue so sorry if i’m wrong. You have a destroy actor node and after that the spawn. I don’t think the execution reaches the spawn since you’re calling destroy, right?

It does make sense.
But then again… the actor is destroyed so I’m recalling a brand new actor from the same location.
Its the only way I figured how to make it loop. And Im able to, only if I manually set location and reference it to nothing. Just some random location from thin air. Hence why I’m wondering if my location reference is the problem or i’m just doing it completely wrong.

Where else can I can I call that function?

I would say that you’re both correct. Calling the Spawn Actor after the Destroy Actor is your first issue. As far as your Target Point, try using Print String to check that the Target Points location is not (0,0,0). If it is, there’s something wrong with your variable.

The location seems to be fine. The variable is a reference to TargetPoint actor.

It looks like I’m stuck between two non-working solutions.

Now I can make the NPC respawn on the Target Point if I place the NPC directly into the level, right-click on the character and add an OnDestroyed event into the Level Blueprint.

However, it only respawns once for some reason and you really want to spawn actors rather than place them…

Im so confused…

From my experience, I try to avoid using the Level Blueprint whenever possible unless it’s for cosmetic reasons for the level. This is because there is no proper way to communicate with it from other blueprints. I also try to avoid directly spawning pawns from another pawn, especially when the spawner is on the verge of being destroyed.

I personally do most of my spawning from the game mode, mainly because it can be accessed from any blueprint using Get Game Mode and casting to it. I’ll try to post some screenshots later if you’re still having issues.

Thanks man. I’ll give that a shot and see what I can come up with.

Thanks for your time.