• 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 [Tutorial] Creating a Basic Mutator

How would someone go about taking a stock weapon in the game and have the player's spawn with it?
Here you go, the code I use for my weapons.
Code:
//=============================================================================
// AS50 Mutator - Automatically spawn with it
// Made by FluX
// [URL]http://www.fluxiserver.co.uk[/URL]
//=============================================================================
class MutAS50 extends Mutator;
function ModifyPlayer(Pawn Player)
{
     Super.ModifyPlayer(Player);
     Player.GiveWeapon("FX-AS50.AS50SniperRifle");
}
defaultproperties
{
     bAddToServerPackages=True
     GroupName="KF-AS50Mut"
     FriendlyName="AS50 Mutator Version"
     Description="Spawn with the AS50. Made by FluX"
}
 
Upvote 0
Another way is to add something like this to the PerkName.uc file:
(In the ServerPerks source there is SRVet*PerkName*.uc files... rename them to create your own custom versions and recompile)
*This example is from a custom build that uses level 30 as the max.

Code:
// Give Extra Items as Default
static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
    if (KFPRI.ClientVeteranSkillLevel >= 0 )
        KFHumanPawn(P).CreateInventoryVeterancy("KFLvCM.MachinePistol", GetCostScaling(KFPRI, class'MachinePistolPickup'));

    if (KFPRI.ClientVeteranSkillLevel >= 30)
    {
        KFHumanPawn(P).CreateInventoryVeterancy("KFLvCM.Protecta", GetCostScaling(KFPRI, class'ProtectaPickup'));
        P.ShieldStrength = 100;
    }
    else if (KFPRI.ClientVeteranSkillLevel >= 20)
    {
        KFHumanPawn(P).CreateInventoryVeterancy("KFLvCM.OverchargedAA12", GetCostScaling(KFPRI, class'OverchargedAA12Pickup'));
        P.ShieldStrength = 100;
    }
    else if (KFPRI.ClientVeteranSkillLevel >= 10)
    {
        KFHumanPawn(P).CreateInventoryVeterancy("KFLvCM.AFS12a", GetCostScaling(KFPRI, class'AFS12Pickup'));
        P.ShieldStrength = 100;
    }
    else if (KFPRI.ClientVeteranSkillLevel >= 5)
        KFHumanPawn(P).CreateInventoryVeterancy("KFLvCM.BoomStick", GetCostScaling(KFPRI, class'BoomStickPickup'));
}
 
Upvote 0
Hi, guys. From a handful of tutorials I have seen so far, you need UCC.exe. My installation did not come with it. Any pointers where I can procure it? Thanks,

EDIT: Also, did anyone have a chance to look at documentation for basic objects used in KF? Stuff like their member variables, accessors for such, etc.
 
Last edited:
Upvote 0
Hi, guys. From a handful of tutorials I have seen so far, you need UCC.exe. My installation did not come with it. Any pointers where I can procure it? Thanks,
Install the KF SDK in the steam TOOLS section.

EDIT: Also, did anyone have a chance to look at documentation for basic objects used in KF? Stuff like their member variables, accessors for such, etc.
There isn't anything for KF, sadly. It's quite easy to look through some extended files to see how things work. It's how I learnt.
 
Upvote 0
You can use a dedicated server to build mutators as well.

How and will it work for Linux servers also :confused:

Is there something wrong with ucc.exe? I installed Steam SDK and tried to run make command but it says there is no such command.

ucc.png


I also copied files to .killingfloor/System/ folder and then ucc.exe help command worked, but no still no go for make command.

ucc2.png


Does it need more windows killing floor game files? If so could someone upload them somewhere?
 
Last edited:
Upvote 0
Maybe this is happening because you are using wine???
Use the Linux Dedicated Server... App ID 215360.

Internet says that ucc.exe compiling via wine has worked before. But i think it needs some windows kf game file with it. After i tried to run it in my Linux KF folder game would not start anymore. So it messed something in there and not just killingfloor.ini. I deleted whole System folder to get game starting again.

How is the compiling done with that server? I use this Linux kfserver script.

http://danielgibbs.co.uk/lgsm/kfserver/

Maybe i can do it with this one instead and not have to dl 2GB of unnecessary files?
 
Upvote 0
Actually, it's simply a matter of not adding a particular line of code:

Code:
bAddToServerPackages=true

And also don't manually add it to server packages either!



Yes, since the server decides the attributes of the specimens you can alter these attributes just on the server and the changes will be replicated to clients. However, you have to do more than just alter defaultproperties. You see, the problem is that both the server and the client have their own copy of these attributes, and changes to the default values are not replicated, meaning if you change the default GroundSpeed variable on the server, the client will still think it's the original. You'll instead want to change the variables of each specimen as they spawn, which you can do by implementing the CheckReplacement function:

Code:
function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
    if (ZombieClot(Other) != None)
    {
        ZombieClot(Other).GroundSpeed = 10;
    }
   
    return Super.CheckReplacement(Other, bSuperRelevant);
}

However, there's another problem. Certain variable defaults are used during gameplay, which will reset sometimes (for instance uncrouching resets GroundSpeed to the default). I'd suggest that for such variables you simply set the default properties on both the server and the client.
Hi, do you have an example of how one can do this? I am struggling with this as well. I am just trying to change groundspeed for the player
 
Upvote 0