Let me explain my problem, because I am at my workplace and I cannot provide blueprints right now . I am trying to create a checkpoint and respawn system myself, while I am pretty new to this. Initially I created it with interfaces and it worked perfectly, but my whole respawn logic lived in the character BP. Now my dear chat GPT, told me that I should use event dispatchers and move the logic to the game mode, while checkpoint only validates my last position (if I passed over it). There are several issues though. 1. I used Set actor transform and it scales my character after I die ( I spawn on the checkpoint location though which is a good sign). 2. if I die on my first trap, I do not die practically and I can keep on moving, no respawn no nothing.
My question is, does any tutorial with the correct or industry way itâs done, to follow and learn? Like I said I can do it in a simple way but not âcorrectâ.
PS. When I am home I will try to upload the blueprints too.
Consider doing your respawn logic within your Game Mode.
The Game Mode has some already built-in logic for that.
For instance the Restart Player function which will trigger respawning a player based on the given controller, walking through the entire chain of finding a spawn point and spawning the default pawn class at said spawn point.
To change that behavior, you can override the Choose Player Start method inside the Game Mode.
In which you could implement some logic for checking, e.g., for a âCheckPoint Componentâ on your controller that might have some saved checkpoint actor to respawn at (a fireplace for instance).
If you donât feel like creating checkpoint actors, you can still go with raw location vectors / rotators to respawn your player at a specific transform (make sure to always set the scale to 1â, 1, 1,â, otherwise you will have your weird scaling issue again.
For this you can use the Restart Player at Transform method from the Game Mode.
Usually you would call this method inside your âDeathâ event on the character / controller.
Thank you very much for your time and effort, i really appreciate it!!!
I saw a video where he used Spawn Actor from class or something like that, and the code was almost identical with mine, with the only difference being he destroyed the actor and possesed him again in the end.
There is no proper way. Always more than one way to skin a cat. The reason itâs scaling your character is because youâre supposed to use set actor location. As for the dying thing, it depends on how youâre handling your input, you can use branches on the input events to block the input, and double check your respawn logic, it sounds like your character isnât dying