Originally posted by Dexter13
Thanks, let me know how you get on
Bah-ang. Gots it working. In the end, it's pretty simple. I'll give you the rundown, and if you want code ask - I'll post it, send it, or you can download the latest Freehold build and rip open the Containment class (not up when I'm writing this - should be by Fri).
Essentially what you are doing is the opposite of trapping players into a spectating state, you reset them all to their original state.
The first thing you need to do is figure out when your round is over. For me, it's either when they complete the map objectives or everyone is dead. Essentially I used the same CheckEndGame() function I had before, but whenever I call EndGame() itself, I first check a global int RoundsLeft to see if I should just reset the level instead of ending the match.
If I'm resetting the level, I go to my ResetGameRound function which does the following:
1) Resets my custom game classes/information. This is some serious level tweaking the gametype does and probably isn't necessary for most mods (and, oddly, the part that isn't really working yet
).
2) Goes through the PawnList for the level. For each player it-
-resets their state to either PlayerWaking (PlayerPawns) or Startup for bots.
-strips their current inventory
-returns things like collision, and viewtarget, etc. to normal playing values. If you go to the GameInfo's version of RestartPlayer, you'll find a lot of it ... if you go through the various states of Pawn you can find the rest. This is really the most confusing part, because you are doing something kinda weird for the game - restarting a player that doesnt need restarting...
-reset their replicationinfo to the original values
3) With that, they get their new StartLocation and the round has restarted.
Hope this helps.
rgx