• 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 Weapon Mutator problem

Well after a few hours of watching tutorial videos (3dbuzz etc). I thought I could change the behavior of a gun a bit and make it a mutator. Changing the gun was pretty easy (even if I don't know if it really works because I can't summon the gun and the mutator doesn't work ...)

I read this:http://wiki.beyondunreal.com/Legacy:Weapon_Mutator_Tutorial and it pretty much explains what I want to do, except for the actual mutator part. The middle part doesn't work as far as I understand it this part tells to overwrite the old weapon properties with the new properties but the class names seem to be wrong which is no real surprise since UT2004 is not KF and vice versa.
So I need to know the proper class names and what not, which is a bit too much for three hours of coding experience.

The rest of the code compiles fine (if I take the middle part out too) which doesn't mean that the mutator works as intended ...

Code:
class MutMinigunHE extends Mutator
    config(user);
 
//=============================================================================
function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
    local int i;
    local WeaponLocker L;
 
    bSuperRelevant = 0;
 
    if ( xWeaponBase(Other) != None )
    {
        if ( string( xWeaponBase(Other).WeaponType ) ~= "XWeapons.Minigun" )
        {
            xWeaponBase(Other).WeaponType = class'MinigunHE';
            return false;
        }
    }
    else if ( WeaponPickup(Other) != None )
    {
        if ( string(Other.Class) ~= "XWeapons.MinigunPickup" )
        {
            ReplaceWith( Other, "MinigunHEPickup" );
            return false;
        }
    }
    else if ( WeaponLocker(Other) != None )
    {
        L = WeaponLocker(Other);
 
        for (i = 0; i < L.Weapons.Length; i++)
        {
            if ( string( L.Weapons[i].WeaponClass ) ~= "XWeapons.Minigun" )
                L.Weapons[i].WeaponClass = class'MinigunHE';
        }
    }
 
    return true;
}
 
//=============================================================================
defaultproperties
{
     GroupName="Minigun HE"
     FriendlyName="Minigun HE"
     Description="Change Minigun alt-fire rounds to High Explosive rounds."
}


I think this could help a lot people and changing the guns is a cool way too modify the game :D