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

KFMutatorSummary code recommendation

ForrestMarkX

Member
Jun 10, 2019
18
14
30
Texas
I noticed that players are required to manually add a KFMutatorSummary to there KFGame.ini for a mutator to appear in the GUI. I created some code that will do this automatically for them when running the mutator once.

I recommend adding this code into KFMutator so that all mutators will automatically do this so that any modded UI or future TWI main menu will see the mutator.

Code:
function PreBeginPlay()
{
    local KFMutatorSummary          MutatorSummary;
    local array<string>             Names;
    local int                       i;
    local bool                      bFoundConfig;
    
    Super.PreBeginPlay();
    
    GetPerObjectConfigSections(class'KFMutatorSummary', Names);
    for (i = 0; i < Names.Length; i++)
    {
        if( InStr(Names[i], string(Class.Name)) != INDEX_NONE )
        {
            bFoundConfig = true;
            break;
        }
    }
    
    if( !bFoundConfig )
    {
        MutatorSummary = New(None, string(Class.Name)) class'KFMutatorSummary';
        MutatorSummary.ClassName = PathName(Class);
        MutatorSummary.SaveConfig();
    }
}
 
  • Like
Reactions: duk6046