How to handle overlapping respawn events?

In my game the pawn can be killed multiple ways and sometimes the events overlap (eg. car upside down and ending up in a killzone means double kill) this can result in spawning and possessing two pawns and since it quickly happens one after the other you basically leave behind the first pawn without a controller before it can be destroyed.
Since doing it the other way around (spawn destroy old pawn and then possess) results in is pending kill errors quite often, I can’t do it that way, so theres now a room for this other error that repossessing another pawn can happen before the previous pawn is destroyed.
I’d like to avoid this to happen, but I’m not really sure what is the best way to handle this.

What I already have: when ending up in a killzone the other triggers for respawn are asked if the player is already in a killzone - if so, dont do anything (killzones have 1s delay so the player can realize what is happening).
This works for the most part, but not all the time, I’ve still managed to spawn two pawns.
Any ideas?

maybe I should combine each to a custom event thats doing the killing

How about a dispatcher.

First check if the actor is valid and then call the above dispatcher (every actor already has one) - Destroy.

Since Destroyed cannot be called twice as the very first call puts it on the Pending Kill stack, this will execute only once.

Would that work?

yeah, doOnce worked with delay, at least for now, will see it on the long run if I ever run into double spawn again

How about a simple DoOnce and reset it after some Delay?


You can avoid Pending Kill being thrown at you by checking isValid.

Might be enough. And DoOnce can be reset if needed.

yes, is valid is circulating around, but it also results in the same other error - not doing something if its not valid - in this case not destroying the previous pawn

I will check do once, but in this case its a bit complicated since the respawn is coming from 3 possible events - therefore do once is only relevant to one at a time

actually, it wasnt really a problem with destroy - or destroying multiple times, it was about not getting destroy in time, so the do once with delay did the trick, i just had to make one custom event out of the multiple kinds of kills and hook it all up to that one