Originally posted by Tom Looman
View Post

Glad I could contribute by noticing this

Do you mind if I keep asking questions ? There's some stuff I still don't understand how it's linked (and I feel bad overlooking stuff, since it usually leads to taboos and other "it works, don't touch it" issues).
How is the Respawn handled ?
I don't know if this was changed in section 3 or 4 (I'm trying to understand how things works in section 2 for now, yet.)
I see a Die() function in the character. (I don't see a reason for it to return a bool value, but I guess this is something that was planned for some future feature, right?)
It sets the killer, and call OnDeath() function, that:
- Apply the last tick of damage
- Apply momentum based on last shot (that for some reason I couldn't figure out yet, makes the character get launched to the air, vertically o.O)
- Destroys the items contained in the inventory
- Removes control from the player, by un-possessing the pawn ( DetachFromControllerPendingDestroy() )
- Stop/Reset animations
- Handle collisions (I have a question about this below)
- Setup the Ragdoll by a custom function
Okay. This is how the player dies. How does it respawn?
I see a AHavenPlayerController::UnFreeze() function in there, but I don't see it being called anywhere.
By inspecting PlayerController.h, I see this:
Code:
/** Timer used by RoundEnded and Inactive states to accept player input again */ virtual void UnFreeze();
I tried to dive a bit into the code, but... I think I got lost

I currently have no idea what causes the player to respawn, and I also have no idea what to do if I wanted to modify this behavior, e.g.:
- Delay the respawn by 5 seconds;
- Make players respawn in waves;
- Make a queue so a "new dead player" will only respawn after everyone in queue respawned - an item of this queue would be processed every 10 secs.
One thing that I noticed while I was writing the previous question is that you first disable the capsule collision then later you enable the actor collision inside OnDeath() function. Why this?
Initially I thought it was to avoid players from having fun shooting flying ragdolls, but collisions get re-enabled right after. I don't get it.
Thank you again for your time and patience answering all these (odd?) doubts!

Comment