1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Mutators

Discussion in 'Ask a Coder' started by Psycho_Leech, Sep 22, 2001.

  1. Psycho_Leech

    Psycho_Leech Hug meh

    Joined:
    Sep 17, 2001
    Messages:
    779
    Likes Received:
    0
    How do I create a mutator that can be added to the mutator list in order to replace certain weapons and add other stuff, or would I be better off just relying on people to use W.O.R.M or summon shoverifle.shoverifle?
    :redeemer:
     
  2. FunnyG

    FunnyG New Member

    Joined:
    Sep 5, 2001
    Messages:
    15
    Likes Received:
    0
    This is the code I'm using for the gun I'm making:

    //=============================================================================
    // Bean Gun Mutator :- replaces BioRifle with BeanGun.
    //=============================================================================

    class BeanMutator extends Mutator;

    function bool AlwaysKeep(Actor Other)
    {
    if(Other.IsA('BeanGun') || Other.IsA('BeanAmmo'))
    return true;
    return Super.AlwaysKeep(Other);
    }

    function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
    {

    if ( Other.IsA('ut_biorifle') )
    {
    ReplaceWith(Other, "BeanGun.BeanGun");
    return false;
    }

    if ( Other.IsA('BioAmmo'))
    {
    ReplaceWith(Other,"BeanGun.BeanAmmo");
    return false;
    }

    return true;
    }

    defaultproperties
    {
    }

    Th 'AlwaysKeep' function makes sure the gun isn't replaced by another weapons mutator, the 'CheckReplacement' function replaces the biorifle and it's ammo with my gun and it's ammo. Just change 'ut_biorifle' and 'BioAmmo' to the gun and ammo you want to replace.
     
  3. FunnyG

    FunnyG New Member

    Joined:
    Sep 5, 2001
    Messages:
    15
    Likes Received:
    0
    You'll need to make an int file as well, use notepad to add;

    [public]

    Object=(Name=BeanGun.BeanMutator,Class=Class,MetaClass=Engine.Mutator,Description="BeanGun, replaces biorifle & ammo with Niall's Bean Gun and it's ammo.")

    Change 'BeanGun.BeanMutator' to 'name_of_your_package.name_of_the_mutator', and save the file as thename of your package.int .
     
  4. Psycho_Leech

    Psycho_Leech Hug meh

    Joined:
    Sep 17, 2001
    Messages:
    779
    Likes Received:
    0
    I think I understand

    Thanks, I haven't tried it yet, but how do I add a weapon to a player's inventory to start with?

    :morety:
     
  5. Kangus

    Kangus Zombie on your pwn!

    Joined:
    Jan 29, 2001
    Messages:
    978
    Likes Received:
    0
    add this code (mostly taken from DeathMatchPlus) to your mutator, modifying as necessary:

    function ModifyPlayer(Pawn Other)
    {
    GiveWeapon(other, "Botpack.Enforcer");

    if ( NextMutator != None )
    NextMutator.ModifyPlayer(Other);
    }

    function GiveWeapon(Pawn PlayerPawn, string aClassName )
    {
    local class<Weapon> WeaponClass;
    local Weapon NewWeapon;

    WeaponClass = class<Weapon>(DynamicLoadObject(aClassName, class'Class'));

    if( PlayerPawn.FindInventoryType(WeaponClass) != None )
    return;
    newWeapon = Spawn(WeaponClass);
    if( newWeapon != None )
    {
    newWeapon.RespawnTime = 0.0;
    newWeapon.GiveTo(PlayerPawn);
    newWeapon.bHeldItem = true;
    newWeapon.GiveAmmo(PlayerPawn);
    newWeapon.SetSwitchPriority(PlayerPawn);
    newWeapon.WeaponSet(PlayerPawn);
    newWeapon.AmbientGlow = 0;
    if ( PlayerPawn.IsA('PlayerPawn') )
    newWeapon.SetHand(PlayerPawn(PlayerPawn).Handedness);
    else
    newWeapon.GotoState('Idle');
    PlayerPawn.Weapon.GotoState('DownWeapon');
    PlayerPawn.PendingWeapon = None;
    PlayerPawn.Weapon = newWeapon;
    }
    }
     
  6. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,915
    Likes Received:
    36
    You could optionally use:

    defaultproperties
    {
    DefaultWeapon=class'YourPackage.YourWeaponClass'
    }

    This uses less code but replaces the Impact Hammer.
    (Shouldn't be a problem during testing.)
     
  7. Papapishu

    Papapishu 我是康

    Joined:
    Jun 18, 2001
    Messages:
    2,043
    Likes Received:
    0
    Ofcourse a mutator like the beangun (hillarious btw :p :p ) replaces all weapons like (in this case) the biorifle so when you pick it up you get it instead of the biorifle...
     

Share This Page