How do I write a mutator?

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

Lieutenant Skittles

FNG / Fresh Meat
Aug 4, 2014
291
1
0
For example one that decreases the health of the bosses. Can someone walk me through step-by-step by any chance? I've tried to wrap my head around it but I can't.
 

[TW] Zane

FNG / Fresh Meat
Apr 23, 2015
14
0
0
Here is the code the the Max players mutator:


Code:
class KFMutator_MaxPlayers extends KFMutator
    Config(MaxPlayers);

var globalconfig int MaxPlayers;
var globalconfig int MaxPlayersAllowed;

function InitMutator(string Options, out string ErrorMessage)
{
    MyKFGI = KFGameInfo( WorldInfo.Game );
    if(MyKFGI != none)
    {
        MyKFGI.MaxPlayers = MaxPlayers;
        MyKFGI.MaxPlayersAllowed = MaxPlayersAllowed;
        `log("SUCCESS!  Max players set to:" @MaxPlayers @"Max allowed players set to:" @MaxPlayersAllowed);
    }    
}

Basically what you are going to want to do is extend off of KFMutator. From there you can edit game parameters to modify your gameplay experience.

Here is a Wiki on how to make a mod:

https://tripwireinteractive.atlassian.net/wiki/display/KF2SW/KF2+Code+Modding+How-to