Hello,
I’m trying to make my own shooter game which is based on the C++ TPS template while trying to get as much info as I can from the shooter game demo.
What I have so far is my custom character class, the default player controller (I haven’t created my own) and the default game mode. Additionally I have a simple UI made with UMG by following the official tutorials.
I’ve tried to find some tutorials about this but almost all of them are done for blueprints and I couldn’t find any info regarding c++. Here’s what I have so far:
If my health reaches 0 in TakeDamage() I call my own function Die() that takes my Controller, calls the game mode where I call
MyGameMode::RespawnPlayer(MyController)
. I’ve also tried to Destroy my actor and then spawn a new one inside the game mode and posses it but that causes my engine to crash.
Another problem that I have is that when I use RespawnPlayer() is that my parameters aren’t reset to they default values. So can somebody please tell me the correct way to handle player death and respawning?