• 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/

Code [HELP] - Custom Difficulty Code doesn't work

StarArk99

Active member
Aug 25, 2012
33
0
I coded this and I changed certain game settings within Game Type derived from KFGametype, but it doesn't seem to compile:

Code:
// ===================================
// DIFFICULTY VALUES
// ===================================
        // Set difficulty based values
// =====================
// ARK'S CUSTOM DIFF.
// =====================
        if ( GameDifficulty >= 8.0 ) // Extinction
        {
        	TimeBetweenWaves = TimeBetweenWavesExtinction;
        	StartingCash = StartingCashExtinction;
        	MinRespawnCash = MinRespawnCashExtinction;
        }
        else if ( GameDifficulty >= 7.0 ) // Hell on Earth
        {
            TimeBetweenWaves = TimeBetweenWavesHell;
            StartingCash = StartingCashHell;
            MinRespawnCash = MinRespawnCashHell;
        }
        else if ( GameDifficulty >= 5.0 ) // Suicidal
        {
            TimeBetweenWaves = TimeBetweenWavesSuicidal;
            StartingCash = StartingCashSuicidal;
            MinRespawnCash = MinRespawnCashSuicidal;
        }
        else if ( GameDifficulty >= 4.0 ) // Hard
        {
            TimeBetweenWaves = TimeBetweenWavesHard;
            StartingCash = StartingCashHard;
            MinRespawnCash = MinRespawnCashHard;
        }
        else if ( GameDifficulty >= 2.0 ) // Normal
        {
            TimeBetweenWaves = TimeBetweenWavesNormal;
            StartingCash = StartingCashNormal;
            MinRespawnCash = MinRespawnCashNormal;
        }
        else //if ( GameDifficulty == 1.0 ) // Beginner
        {
            TimeBetweenWaves = TimeBetweenWavesBeginner;
            StartingCash = StartingCashBeginner;
            MinRespawnCash = MinRespawnCashBeginner;
        }

        InitialWave = 0;

        PrepareSpecialSquads();
    }
    else
    {
        bCustomGameLength = true;
        UpdateGameLength();
    }

    LoadUpMonsterList();
}

function NotifyGameEvent(int EventNumIn)
{
    if( KFGameLength != GL_Custom )
    {
        if(MonsterCollection != class'KFMonstersCollection' )
        {//we already have an event

            if(EventNumIn == 3 && MonsterCollection != class'KFMonstersXmas')
            {
                log("Was we should be in halloween mode but we aren't!");
            }
            if(EventNumIn == 2 && MonsterCollection != class'KFMonstersHalloween')
            {
                log("Was we should be in halloween mode but we aren't!");
            }
            if(EventNumIn == 0 && MonsterCollection != class'KFMonstersCollection')
            {
                log("Was we shouldn't have an event but we do!");
            }
            return;
        }
    }
    else
    {
        //if we've already decided on doing an event, return
        if(EventNum != EventNumIn && EventNum != 0)
        {
            return;
        }
    }

    if(EventNumIn == 2 )
    {
        MonsterCollection = class'KFMonstersHalloween';
    }
    else if(EventNumIn == 3 )
    {
        MonsterCollection = class'KFMonstersXmas';
    }
    //EventNum = EventNumIn;
    PrepareSpecialSquads();
    LoadUpMonsterList();
}

Here is an interesting bit of coding where I didn't know what to do, so I just went with the flow:

Code:
function GetServerInfo( out ServerResponseLine ServerState )
{
    super.GetServerInfo(ServerState);

    if ( GameDifficulty == 1.0 )
    {
        ServerState.Flags = ServerState.Flags | 32;
    }
    else if ( GameDifficulty == 2.0 )
    {
        ServerState.Flags = ServerState.Flags | 64;
    }
    else if ( GameDifficulty == 4.0 )
    {
        ServerState.Flags = ServerState.Flags | 128;
    }
    else if ( GameDifficulty == 5.0 )
    {
        ServerState.Flags = ServerState.Flags | 256;
    }
    else if ( GameDifficulty == 7.0 )
    {
        ServerState.Flags = ServerState.Flags | 512;
    }
    else if ( GameDifficulty == 8.0 )
    {
    	ServerState.Flags = ServerState.Flags | 1024;
    }
}


The problem with compiling was the Specimen Spawn List,, so I went in and took it out because I couldn't fix the error, and when I went to go play the game, nothing would spawn.

My question is, How would I go about creating a new difficulty that will show in game?