• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

KF Restarting without reloading the map

heller96

FNG / Fresh Meat
May 10, 2019
2
0
Hello everyone! So I've been looking through base game classes the last few days for several hours to create an addon for the AdminControlsV2 mutator. I have successfully created it and it does most of what I wanted it to do. However I've come to a point where I don't know where to look anymore, so I decided to ask here if anyone could help me. All my knowledge about coding I got from the source engine (cs1.6) and looking into .uc files of mutators and base game files (that is not a lot).

Anyway, I would like the addon to do the following things:

if I enter "mutate restart x" (x being the number of wave) after a wipe, it would reset the game to the same map, go to trader time and set the next wave to the one specified in the command, but I want all this without having to go through another loading screen (=not revoting the map again)

What I managed to do is, (mainly by taking some of the acv2 classes and using them as a template,) that upon entering the command, it will do the following:

- it kills off all zeds that are currently alive
- it "aborts" the current wave (=sets remaining zeds to 0 - effectively skips to next trader phase)
- sets that trader phase to 45 seconds

What I couldn't figure out is how to, or rather where to, find the function that lets me reset the map and clear the "wiped" status from the end of the game. My best guess would be using the Reset() function - I have experimented with it a bit, but sadly I couldn't make it work.

Here's the code that I have put together:

Code:
class ActRestart extends admincontrolv2.AdminCommand
    abstract;

static function Perform(string CommandString, AdminRecord Sender)
{
    local int Num;
    local string Answer;
    local KFGameType KFGT;
    
    Num = GetIntParam(CommandString);
    KFGT = KFGameType(Sender.Level.Game);

    KFGT.KillZeds();
    KFGT.NumMonsters = 0;
    KFGT.TotalMaxMonsters = 0;
    KFGT.WaveNum = Num - 1;
    KFGT.WaveCountDown = 45;

    Answer = "Admin restarted the map. Next is wave " $ string(Num) $ ".";
    CommandMessage(Sender,Answer);
}

defaultproperties
{
    HelpString(0)="restart - "Resets the game and sets the next wave to the specified value""
    CommandName(0)="restart"
}

I would be very thankful if someone could point me in the right direction.