Results 1 to 32 of 32
  1. #1
    MSgt. Shooter Person
    Join Date
    Sep 2006
    Posts
    415

    Thumbs up Weapon replacement mutator 4 U 2 use

    Just want to let you all know this is EPIC's code// I'm just adding defaults.

    Code:
    /////////////////////////////////////////////////////
    // Mutator: Copy and Paste from EPIC
    // Assembled By: *PingFre@K*
    /////////////////////////////////////////////////////
    
    class ExampleYourMutatorName extends UTMutator
       config(ExampleYourMutatorName);
    
    struct ReplacementInfo
    {
    	/** class name of the weapon we want to get rid of */
    	var name OldClassName;
    	/** fully qualified path of the class to replace it with */
    	var string NewClassPath;
    };
    
    var config array<ReplacementInfo> WeaponsToReplace;
    var config array<ReplacementInfo> AmmoToReplace;
    
    function PostBeginPlay()
    {
    	local UTGame Game;
    	local int i, Index;
    
    	Super.PostBeginPlay();
    
    	// replace default weapons
    	Game = UTGame(WorldInfo.Game);
    	if (Game != None)
    	{
    		for (i = 0; i < Game.DefaultInventory.length; i++)
    		{
    			if (Game.DefaultInventory[i] != None)
    			{
    				Index = WeaponsToReplace.Find('OldClassName', Game.DefaultInventory[i].Name);
    				if (Index != INDEX_NONE)
    				{
    					if (WeaponsToReplace[Index].NewClassPath == "")
    					{
    						// replace with nothing
    						Game.DefaultInventory.Remove(i, 1);
    						i--;
    					}
    					Game.DefaultInventory[i] = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    				}
    			}
    		}
    
    		if (Game.TranslocatorClass != None)
    		{
    			Index = WeaponsToReplace.Find('OldClassName', Game.TranslocatorClass.Name);
    			if (Index != INDEX_NONE)
    			{
    				if (WeaponsToReplace[Index].NewClassPath == "")
    				{
    					// replace with nothing
    					Game.TranslocatorClass = None;
    				}
    				else
    				{
    					Game.TranslocatorClass = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    				}
    			}
    		}
    	}
    }
    
    function bool CheckReplacement(Actor Other)
    {
    	local UTWeaponPickupFactory WeaponPickup;
    	local UTWeaponLocker Locker;
    	local UTAmmoPickupFactory AmmoPickup, NewAmmo;
    	local int i, Index;
    	local class<UTAmmoPickupFactory> NewAmmoClass;
    
    	WeaponPickup = UTWeaponPickupFactory(Other);
    	if (WeaponPickup != None)
    	{
    		if (WeaponPickup.WeaponPickupClass != None)
    		{
    			Index = WeaponsToReplace.Find('OldClassName', WeaponPickup.WeaponPickupClass.Name);
    			if (Index != INDEX_NONE)
    			{
    				if (WeaponsToReplace[Index].NewClassPath == "")
    				{
    					// replace with nothing
    					return false;
    				}
    				WeaponPickup.WeaponPickupClass = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    				WeaponPickup.InitializePickup();
    			}
    		}
    	}
    	else
    	{
    		Locker = UTWeaponLocker(Other);
    		if (Locker != None)
    		{
    			for (i = 0; i < Locker.Weapons.length; i++)
    			{
    				if (Locker.Weapons[i].WeaponClass != None)
    				{
    					Index = WeaponsToReplace.Find('OldClassName', Locker.Weapons[i].WeaponClass.Name);
    					if (Index != INDEX_NONE)
    					{
    						if (WeaponsToReplace[Index].NewClassPath == "")
    						{
    							// replace with nothing
    							Locker.ReplaceWeapon(i, None);
    						}
    						else
    						{
    							Locker.ReplaceWeapon(i, class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class')));
    						}
    					}
    				}
    			}
    		}
    		else
    		{
    			AmmoPickup = UTAmmoPickupFactory(Other);
    			if (AmmoPickup != None)
    			{
    				Index = AmmoToReplace.Find('OldClassName', AmmoPickup.Class.Name);
    				if (Index != INDEX_NONE)
    				{
    					if (AmmoToReplace[Index].NewClassPath == "")
    					{
    						// replace with nothing
    						return false;
    					}
    					NewAmmoClass = class<UTAmmoPickupFactory>(DynamicLoadObject(AmmoToReplace[Index].NewClassPath, class'Class'));
    					if (NewAmmoClass == None)
    					{
    						// replace with nothing
    						return false;
    					}
    					else if (NewAmmoClass.default.bStatic || NewAmmoClass.default.bNoDelete)
    					{
    						// transform the current ammo into the desired class
    						AmmoPickup.TransformAmmoType(NewAmmoClass);
    						return true;
    					}
    					else
    					{
    						// spawn the new ammo, link it to the old, then disable the old one
    						NewAmmo = AmmoPickup.Spawn(NewAmmoClass);
    						NewAmmo.OriginalFactory = AmmoPickup;
    						AmmoPickup.ReplacementFactory = NewAmmo;
    						return false;
    					}
    				}
    			}
    		}
    	}
    
    	return true;
    }
    
    
    defaultproperties
    {
    // Fill in the blanks
       WeaponsToReplace(0)=(OldClassName="UTWeap_Enforcer",NewClassPath="ExamplePackageName.ExampleWeaponClassName")
       AmmoToReplace(0)=(OldClassName="UTAmmo_Enforcer",NewClassPath="ExamplePackageName.ExampleAmmoClassName")
    
       WeaponsToReplace(1)=(OldClassName="UTWeap_BioRifle_Content",NewClassPath="")
       AmmoToReplace(1)=(OldClassName="UTAmmo_BioRifle_Content",NewClassPath="")
    
       WeaponsToReplace(2)=(OldClassName="UTWeap_FlakCannon",NewClassPath="")
       AmmoToReplace(2)=(OldClassName="UTAmmo_FlakCannon",NewClassPath="")
    
       WeaponsToReplace(3)=(OldClassName="UTWeap_LinkGun",NewClassPath="")
       AmmoToReplace(3)=(OldClassName="UTAmmo_LinkGun",NewClassPath="")
    
       WeaponsToReplace(4)=(OldClassName="UTWeap_Redeemer_Content",NewClassPath="")
    
       WeaponsToReplace(5)=(OldClassName="UTWeap_RocketLauncher",NewClassPath="")
       AmmoToReplace(5)=(OldClassName="UTAmmo_RocketLauncher",NewClassPath="")
    
       WeaponsToReplace(6)=(OldClassName="UTWeap_ShockRifle",NewClassPath="")
       AmmoToReplace(6)=(OldClassName="UTAmmo_ShockRifle",NewClassPath="")
    
       WeaponsToReplace(7)=(OldClassName="UTWeap_SniperRifle",NewClassPath="")
       AmmoToReplace(7)=(OldClassName="UTAmmo_SniperRifle",NewClassPath="")
    
       WeaponsToReplace(8)=(OldClassName="UTWeap_Stinger",NewClassPath="")
       AmmoToReplace(8)=(OldClassName="UTAmmo_Stinger",NewClassPath="")
    
       GroupNames(0)=""
       Name=""
    }
    After struggling to wright a weapon replacemnt mutator.. And seeing things done over these forums to incorrectly wright one.. I thought I should share this bit of 'should of known' knowledge for weapon replacement.
    You can use this code in your mutator to have your weapon or weapon Pack replacements. Don't know if something like this gets stickied or not but it's definitely good info.
    ~ If it was easy everyone would be doing it. ~
    Akimbo Expansion Pack Elite Machines XX HitSounds Show Damage
    DM-Backyard99 DM-Lan_Party

    James O Bishop

  2. #2
    MSgt. Shooter Person
    Join Date
    Oct 2007
    Posts
    83

    Default

    Dude THANK YOU!! No one has replied but I will Thanks!
    ~{MFD}~Mordred - Clan Administrator & Founder
    http://www.mfdclan.com for UT99, UT2k4 and UT3 Servers plus Ranked BF2 Server
    Check out our Command Line Generator for UT3 at http://commandgen.mfdclan.com

  3. #3
    MSgt. Shooter Person
    Join Date
    Aug 2006
    Location
    I'm already dead.
    Posts
    138

    Default

    Thanks, kool info.
    Making a Ut3 movie? Then you need; http://rypelcam.net - kAoS.Ut3.Server»IP«: 27.50.70.8:7777 - Drop in say hello; http://kaoshq.com

  4. #4
    MSgt. Shooter Person
    Join Date
    Oct 2007
    Posts
    83

    Default

    i have got to report, this works like a charm. No error (which I was getting when I was trying to do mine...) in the server window... now if we could get compression, we'd be all set

    Thanks Pinkfreak.
    ~{MFD}~Mordred - Clan Administrator & Founder
    http://www.mfdclan.com for UT99, UT2k4 and UT3 Servers plus Ranked BF2 Server
    Check out our Command Line Generator for UT3 at http://commandgen.mfdclan.com

  5. #5
    MSgt. Shooter Person
    Join Date
    Jan 2008
    Posts
    372
    Gamer IDs

    Gamertag: SalisburySteak

    Default

    Is there a way to get the PS3's source? That way you could see how they did the configuration menues.
    If anybody needs a PS3 map/mod tester, PM me.

    Quote Originally Posted by faultymoose
    And then we could all turn into magical elves and throw rainbow sparkles at each other.

  6. #6
    MSgt. Shooter Person
    Join Date
    Feb 2008
    Posts
    272

    Default

    Thanks for this. I would think replacing 1 class name with 1 other class name multiple times could be simpler...

    Altering the Default Properties is easier anyway.
    Avid supporter of RuneStorms "Ballistic Weapons" mod.
    (\_/)
    (O.o)
    (> <)o This is Bunny. Copy Bunny into your signature to help him on his way to world domination

  7. #7

    Default

    function PostBeginPlay()
    {
    local UTGame Game;
    local int i, Index;

    Super.PostBeginPlay();

    // replace default weapons
    Game = UTGame(WorldInfo.Game);
    if (Game != None)
    {
    for (i = 0; i < Game.DefaultInventory.length; i++)
    {
    if (Game.DefaultInventory[i] != None)
    {
    Index = WeaponsToReplace.Find('OldClassName', Game.DefaultInventory[i].Name);
    if (Index != INDEX_NONE)
    {
    if (WeaponsToReplace[Index].NewClassPath == "")
    {
    // replace with nothing
    Game.DefaultInventory.Remove(i, 1);
    i--;
    }
    Game.DefaultInventory[i] = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    }
    }
    }


    if (Game.TranslocatorClass != None)
    {
    Index = WeaponsToReplace.Find('OldClassName', Game.TranslocatorClass.Name);
    if (Index != INDEX_NONE)
    {
    if (WeaponsToReplace[Index].NewClassPath == "")
    {
    // replace with nothing
    Game.TranslocatorClass = None;
    }
    else
    {
    Game.TranslocatorClass = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    }
    }
    }
    }
    }
    The blue I am not sure what is, but red is the translocator, so i can just blank that(//), don't need the ammo codes yet so I can blank them and the vars to them.

    WeaponsToReplace(0)=(OldClassName="UTWeap_Enforcer",NewClassPath="ExamplePackageName.ExampleWeaponClassName")
    AmmoToReplace(0)=(OldClassName="UTAmmo_Enforcer",NewClassPath="ExamplePackageName.ExampleAmmoClassName")
    Now these I fill in with whatever I am replacing the item stated in blue right?(if new ammo I need to add it to the ammo code too)

    Sorry if I am drooling a bit I is a code nawer after all :P
    I is fuzzy braiwned mew =0-o=
    ------------------------------------------------------
    Still an idiot after all these years.
    -----------------------
    http://zippydsmlee.wordpress.com/

  8. #8
    MSgt. Shooter Person
    Join Date
    Sep 2006
    Posts
    415

    Default

    The blue area of your quote, removes the default inventory and gives the option to replace with the new class path. The red area on top is for the trans yes.. you could add another default to replace the trans using that area. Your bottom quote is correct. leave the blue and change the red.
    ~ If it was easy everyone would be doing it. ~
    Akimbo Expansion Pack Elite Machines XX HitSounds Show Damage
    DM-Backyard99 DM-Lan_Party

    James O Bishop

  9. #9
    MSgt. Shooter Person
    Join Date
    Feb 2008
    Posts
    272

    Default

    when I tried to compile this the compiler said "f you, you don't get mod!" or something to that effect...

    The compiler wasn't happy, so for now I'm just using the default Weapon Replacer to bring my custom weapons in.
    Avid supporter of RuneStorms "Ballistic Weapons" mod.
    (\_/)
    (O.o)
    (> <)o This is Bunny. Copy Bunny into your signature to help him on his way to world domination

  10. #10
    MSgt. Shooter Person
    Join Date
    Sep 2006
    Posts
    415

    Default

    Double check your example texts.. and revert back to the origional post.
    ~ If it was easy everyone would be doing it. ~
    Akimbo Expansion Pack Elite Machines XX HitSounds Show Damage
    DM-Backyard99 DM-Lan_Party

    James O Bishop

  11. #11
    Redeemer
    Join Date
    May 2000
    Location
    between the monitor and chair
    Posts
    1,523

    Default

    ever heard of subclassing?
    Michiel 'El Muerte' Hendriks
    Magicball Network - Little Big Adventure community
    the Unreal Admin page - Unreal server administration
    UnrealWiki - UnrealScript and UnrealEd wiki.
    UnCodeX - powerful UnrealScript tool for programmers

  12. #12

    Default

    /////////////////////////////////////////////////////
    // Mutator: Copy and Paste from EPIC
    // Assembled By: *PingFre@K*
    /////////////////////////////////////////////////////

    class FirstMutator extends UTMutator
    config(FirstMutator);

    struct ReplacementInfo
    {
    /** class name of the weapon we want to get rid of */
    var name OldClassName;
    /** fully qualified path of the class to replace it with */
    var string NewClassPath;
    };

    var config array<ReplacementInfo> WeaponsToReplace;
    //var config array<ReplacementInfo> AmmoToReplace;

    function PostBeginPlay()
    {
    local UTGame Game;
    local int i, Index;

    Super.PostBeginPlay();

    // replace default weapons
    Game = UTGame(WorldInfo.Game);
    if (Game != None)
    {
    for (i = 0; i < Game.DefaultInventory.length; i++)
    {
    if (Game.DefaultInventory[i] != None)
    {
    Index = WeaponsToReplace.Find('OldClassName', Game.DefaultInventory[i].Name);
    if (Index != INDEX_NONE)
    {
    if (WeaponsToReplace[Index].NewClassPath == "")
    {
    // replace with nothing
    Game.DefaultInventory.Remove(i, 1);
    i--;
    }
    Game.DefaultInventory[i] = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    }
    }
    }

    if (Game.TranslocatorClass != None)
    {
    Index = WeaponsToReplace.Find('OldClassName', Game.TranslocatorClass.Name);
    if (Index != INDEX_NONE)
    {
    if (WeaponsToReplace[Index].NewClassPath == "")
    {
    // replace with nothing
    Game.TranslocatorClass = None;
    }
    else
    {
    Game.TranslocatorClass = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    }
    }
    }
    }
    }

    function bool CheckReplacement(Actor Other)
    {
    local UTWeaponPickupFactory WeaponPickup;
    local UTWeaponLocker Locker;
    // local UTAmmoPickupFactory AmmoPickup, NewAmmo;
    local int i, Index;
    // local class<UTAmmoPickupFactory> NewAmmoClass;

    WeaponPickup = UTWeaponPickupFactory(Other);
    if (WeaponPickup != None)
    {
    if (WeaponPickup.WeaponPickupClass != None)
    {
    Index = WeaponsToReplace.Find('OldClassName', WeaponPickup.WeaponPickupClass.Name);
    if (Index != INDEX_NONE)
    {
    if (WeaponsToReplace[Index].NewClassPath == "")
    {
    // replace with nothing
    return false;
    }
    WeaponPickup.WeaponPickupClass = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    WeaponPickup.InitializePickup();
    }
    }
    }
    else
    {
    Locker = UTWeaponLocker(Other);
    if (Locker != None)
    {
    for (i = 0; i < Locker.Weapons.length; i++)
    {
    if (Locker.Weapons[i].WeaponClass != None)
    {
    Index = WeaponsToReplace.Find('OldClassName', Locker.Weapons[i].WeaponClass.Name);
    if (Index != INDEX_NONE)
    {
    if (WeaponsToReplace[Index].NewClassPath == "")
    {
    // replace with nothing
    Locker.ReplaceWeapon(i, None);
    }
    else
    {
    Locker.ReplaceWeapon(i, class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class')));
    }
    }
    }
    }
    }
    // else
    // {
    // AmmoPickup = UTAmmoPickupFactory(Other);
    // if (AmmoPickup != None)
    // {
    // Index = AmmoToReplace.Find('OldClassName', AmmoPickup.Class.Name);
    // if (Index != INDEX_NONE)
    // {
    // if (AmmoToReplace[Index].NewClassPath == "")
    // {
    // // replace with nothing
    // return false;
    // }
    // NewAmmoClass = class<UTAmmoPickupFactory>(DynamicLoadObject(AmmoT oReplace[Index].NewClassPath, class'Class'));
    // if (NewAmmoClass == None)
    // {
    // // replace with nothing
    // return false;
    // }
    // else if (NewAmmoClass.default.bStatic || NewAmmoClass.default.bNoDelete)
    // {
    // // transform the current ammo into the desired class
    // AmmoPickup.TransformAmmoType(NewAmmoClass);
    // return true;
    // }
    // else
    // {
    // // spawn the new ammo, link it to the old, then disable the old one
    // NewAmmo = AmmoPickup.Spawn(NewAmmoClass);
    // NewAmmo.OriginalFactory = AmmoPickup;
    // AmmoPickup.ReplacementFactory = NewAmmo;
    // return false;
    // }
    // }
    // }
    // }
    // }

    // return true;
    //}


    defaultproperties
    {
    // Fill in the blanks
    WeaponsToReplace(0)=(OldClassName="UTWeap_Enforcer ",NewClassPath="FirstMutator.UTWeap_Enforcer")
    AmmoToReplace(0)=(OldClassName="UTAmmo_Enforcer",N ewClassPath="UTAmmo_Enforcer")

    // WeaponsToReplace(1)=(OldClassName="UTWeap_BioRifle _Content",NewClassPath="")
    // AmmoToReplace(1)=(OldClassName="UTAmmo_BioRifle_Co ntent",NewClassPath="")

    //WeaponsToReplace(2)=(OldClassName="UTWeap_FlakCann on",NewClassPath="")
    // AmmoToReplace(2)=(OldClassName="UTAmmo_FlakCannon" ,NewClassPath="")

    // WeaponsToReplace(3)=(OldClassName="UTWeap_LinkGun" ,NewClassPath="")
    // AmmoToReplace(3)=(OldClassName="UTAmmo_LinkGun",Ne wClassPath="")

    // WeaponsToReplace(4)=(OldClassName="UTWeap_Redeemer _Content",NewClassPath="")

    // WeaponsToReplace(5)=(OldClassName="UTWeap_RocketLa uncher",NewClassPath="")
    // AmmoToReplace(5)=(OldClassName="UTAmmo_RocketLaunc her",NewClassPath="")

    // WeaponsToReplace(6)=(OldClassName="UTWeap_ShockRif le",NewClassPath="")
    // AmmoToReplace(6)=(OldClassName="UTAmmo_ShockRifle" ,NewClassPath="")

    // WeaponsToReplace(7)=(OldClassName="UTWeap_SniperRi fle",NewClassPath="")
    // AmmoToReplace(7)=(OldClassName="UTAmmo_SniperRifle ",NewClassPath="")

    WeaponsToReplace(8)=(OldClassName="UTWeap_Stinger" ,NewClassPath="FirstMutator.UTWeap_Stoner")
    AmmoToReplace(8)=(OldClassName="UTAmmo_Stinger",Ne wClassPath="UTAmmo_Stinger")

    GroupNames(0)="Zippylabs"
    Name="ZippyLabs"







    DefaultProperties
    {
    }
    Warning/Error Summary
    ---------------------
    C:\Program Files\Unreal Tournament 3\Development\Src\FirstMutator\Classes\FirstMutato r.uc(162) : Error, Unexpected end of file at end of Class

    Failure - 1 error(s), 0 warning(s)
    ----------------------------

    I missed something, unsure what it is I missed.
    I is fuzzy braiwned mew =0-o=
    ------------------------------------------------------
    Still an idiot after all these years.
    -----------------------
    http://zippydsmlee.wordpress.com/

  13. #13
    MSgt. Shooter Person
    Join Date
    Sep 2006
    Posts
    415

    Default

    I see several problems above, That's not going to be your only error... just use the origional post script and fill in your weapon class for each weapon instance in the default properties. or put back the original class name of the weapon you don't want to replace.
    Errors are for instance.. to many
    Code:
    }
    }
    }
    }
    }
    There is an open
    {
    Insert code
    and a close
    }

    also.. instead of using // in front of every line just use /* then */ at the end

    Don't forget you'll need a } on a previous line before default properties

    go read some code elsewhere.
    ~ If it was easy everyone would be doing it. ~
    Akimbo Expansion Pack Elite Machines XX HitSounds Show Damage
    DM-Backyard99 DM-Lan_Party

    James O Bishop

  14. #14

    Default

    Quote Originally Posted by pingfreak View Post
    I see several problems above, That's not going to be your only error... just use the origional post script and fill in your weapon class for each weapon instance in the default properties. or put back the original class name of the weapon you don't want to replace.
    Errors are for instance.. to many
    Code:
    }
    }
    }
    }
    }
    There is an open
    {
    Insert code
    and a close
    }

    also.. instead of using // in front of every line just use /* then */ at the end

    Don't forget you'll need a } on a previous line before default properties

    go read some code elsewhere.
    ah thank you, I'll get a mop and bucket an clean up ze drool. ^^

    I can still use // now and then as a way to disable code or is it better to use /* */ ? and is there a proper name for them?
    I is fuzzy braiwned mew =0-o=
    ------------------------------------------------------
    Still an idiot after all these years.
    -----------------------
    http://zippydsmlee.wordpress.com/

  15. #15

    Default

    Use /* */. They nest so you don't have the problems like in e.g. Java or PHP where the first */ will end the comment and leave behind a mess.

    Names: // is EOL comment, end-of-line comment or just line comment, /* */ is multi-line comment or block comment, /** */ is called a doc comment and behaves exactly like block comments in terms of nesting.

    Quote Originally Posted by elmuerte View Post
    ever heard of subclassing?
    ...of of [code] tags? [quote] trashes indenting.
    Last edited by Wormbo; 03-27-2008 at 04:23 AM.
    Wormbo's UT/UT2004/UT3 mods | PlanetJailbreak | Unreal Wiki | Liandri Archives

    <@Mych|Lockdown> ...and the award for the most creative spelling of "Jailbreak" goes to ... "Gandis Jealbrake Server"
    Note that your questions via PMs will be ignored if they actually belong in the forum.

  16. #16

    Default

    Quote Originally Posted by pingfreak View Post
    I see several problems above, That's not going to be your only error... just use the origional post script and fill in your weapon class for each weapon instance in the default properties. or put back the original class name of the weapon you don't want to replace.
    Errors are for instance.. to many
    Code:
    }
    }
    }
    }
    }
    There is an open
    {
    Insert code
    and a close
    }

    also.. instead of using // in front of every line just use /* then */ at the end

    Don't forget you'll need a } on a previous line before default properties

    go read some code elsewhere.
    oy only noobs use hamhocks to type out code, mmm hammm *nom nom nom nom*

    Anyway I followed the suggestion not to block/disable but merely fill in the blanks do not ad lib if you iz noob, it workz now//unlike my moldy mind.

    Wormbo
    Ah, thanks for the info oh great code master...now if I could get get your explosive bullet code working in 04, sadly I keep drowning in me own spittle over it 0-o

    Get out the galoushes and batten down the hatches, we'er in fer some rough drool.....


    oy....the voices....they pop up when I no wantz themz >>
    Last edited by ZippyDSMlee; 03-27-2008 at 04:44 AM.
    I is fuzzy braiwned mew =0-o=
    ------------------------------------------------------
    Still an idiot after all these years.
    -----------------------
    http://zippydsmlee.wordpress.com/

  17. #17
    MSgt. Shooter Person
    Join Date
    Mar 2008
    Location
    The Insane Assylum, a quiet peacful place to chnage your mind..
    Posts
    345
    Gamer IDs

    Gamertag: ...

    Default

    if your trying to add a single weapon and not have to subclass everything maybe try this, it is from my shock Rifle, it will only replace one weapon, but you can pretty much just replace the classes appropriately

    Code:
    //
    //    Mutator code written by [pbg]BlockHead aka Dave Neun
    //     2008 www.poweredbygas.net
    //
    //
    
    
    class pbg_CR50Px extends UTMutator
    config(Game);
    
    struct ReplacementInfo
    {
    	var name OldClassName;
    	var string NewClassPath;
    };
    
    var config array<ReplacementInfo> WeaponsToReplace;
    var config array<ReplacementInfo> AmmoToReplace;
    
    function InitMutator(string Options, out string ErrorMessage)
    {
    if (UTGame(WorldInfo.Game) != None)
    
    Super.InitMutator(Options, ErrorMessage);
    }
    
    function bool CheckReplacement(Actor Other)
    {
    	local UTWeaponPickupFactory WeaponPickup;
    	local UTWeaponLocker Locker;
    	local UTAmmoPickupFactory AmmoPickup, NewAmmo;
    	local class<UTAmmoPickupFactory> NewAmmoClass;
    	local int i;
    
            WeaponPickup = UTWeaponPickupFactory(Other);
            Locker = UTWeaponLocker(Other);
            AmmoPickup = UTAmmoPickupFactory(Other);
    
            if (WeaponPickup.WeaponPickupClass != None)
            {
               if(String(WeaponPickup.WeaponPickupClass) == "UTWeap_ShockRifle")
               {
               WeaponPickup.WeaponPickupClass = class<UTWeapon>(DynamicLoadObject("CR50PxBeta.UTWeap_CR50Px", class'Class'));
               WeaponPickup.InitializePickup();
               return true;
               }
    
            }
            if ( Locker != None )
            {
                for (i = 0; i < Locker.Weapons.length; i++)
                {
                  if(String(Locker.Weapons[i].WeaponClass) == "UTWeap_ShockRifle")
                  {
    		Locker.ReplaceWeapon(i, class<UTWeapon>(DynamicLoadObject("CR50PxBeta.UTWeap_CR50Px", class'Class')));
    		return true;
    	      }
                }
            }
            else if (AmmoPickup != None)
    	{
    
              if (string(Other.Class) ~=  "UTAmmo_ShockRifle")
              { 
                NewAmmoClass = class<UTAmmoPickupFactory>(DynamicLoadObject("CR50PxBeta.UTAmmo_CR50Px", class'Class'));
    	    if (NewAmmoClass.default.bStatic || NewAmmoClass.default.bNoDelete)
                 {
    		AmmoPickup.TransformAmmoType(NewAmmoClass);
    		return true;
    	     }
    	     else
    	     {
    		NewAmmo = AmmoPickup.Spawn(NewAmmoClass);
    		NewAmmo.OriginalFactory = AmmoPickup;
    		AmmoPickup.ReplacementFactory = NewAmmo;
    		return false;
    	     
                   }
              }
         }
         return true;
    }
    
    defaultproperties
    {
       Name="Default__pbg_CR50Px"
       ObjectArchetype=UTMutator'UTGame.Default__UTMutator'
    }

    hope this helps ya out..
    Last edited by dave neun; 03-28-2008 at 05:50 PM.
    "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
    ---The Hitchhiker's Guide to the Galaxy

    This Image Was Automatically Resized by using the Screenshot Tag.  Click to view the full version

  18. #18

    Default

    Quote Originally Posted by dave neun View Post
    if your trying to add a single weapon and not have to subclass everything maybe try this, it is from my shock Rifle, it will only replace one weapon, but you can pretty much just replace the classes appropriately

    Code:
    //
    //    Mutator code written by [pbg]BlockHead aka Dave Neun
    //     2008 www.poweredbygas.net
    //
    //
    
    
    class pbg_CR50Px extends UTMutator
    config(Game);
    
    struct ReplacementInfo
    {
    	var name OldClassName;
    	var string NewClassPath;
    };
    
    var config array<ReplacementInfo> WeaponsToReplace;
    var config array<ReplacementInfo> AmmoToReplace;
    
    function InitMutator(string Options, out string ErrorMessage)
    {
    if (UTGame(WorldInfo.Game) != None)
    
    Super.InitMutator(Options, ErrorMessage);
    }
    
    function bool CheckReplacement(Actor Other)
    {
    	local UTWeaponPickupFactory WeaponPickup;
    	local UTWeaponLocker Locker;
    	local UTAmmoPickupFactory AmmoPickup, NewAmmo;
    	local class<UTAmmoPickupFactory> NewAmmoClass;
    	local int i;
    
            WeaponPickup = UTWeaponPickupFactory(Other);
            Locker = UTWeaponLocker(Other);
            AmmoPickup = UTAmmoPickupFactory(Other);
    
            if (WeaponPickup.WeaponPickupClass != None)
            {
               if(String(WeaponPickup.WeaponPickupClass) == "UTWeap_ShockRifle")
               {
               WeaponPickup.WeaponPickupClass = class<UTWeapon>(DynamicLoadObject("CR50PxBeta.UTWeap_CR50Px", class'Class'));
               WeaponPickup.InitializePickup();
               return true;
               }
    
            }
            if ( Locker != None )
            {
                for (i = 0; i < Locker.Weapons.length; i++)
                {
                  if(String(Locker.Weapons[i].WeaponClass) == "UTWeap_ShockRifle")
                  {
    		Locker.ReplaceWeapon(i, class<UTWeapon>(DynamicLoadObject("CR50PxBeta.UTWeap_CR50Px", class'Class')));
    		return true;
    	      }
                }
            }
            else if (AmmoPickup != None)
    	{
    
              if (string(Other.Class) ~=  "UTAmmo_ShockRifle")
              { 
                NewAmmoClass = class<UTAmmoPickupFactory>(DynamicLoadObject("CR50PxBeta.UTAmmo_CR50Px", class'Class'));
    	    if (NewAmmoClass.default.bStatic || NewAmmoClass.default.bNoDelete)
                 {
    		AmmoPickup.TransformAmmoType(NewAmmoClass);
    		return true;
    	     }
    	     else
    	     {
    		NewAmmo = AmmoPickup.Spawn(NewAmmoClass);
    		NewAmmo.OriginalFactory = AmmoPickup;
    		AmmoPickup.ReplacementFactory = NewAmmo;
    		return false;
    	     
                   }
              }
         }
         return true;
    }
    
    defaultproperties
    {
       Name="Default__pbg_CR50Px"
       ObjectArchetype=UTMutator'UTGame.Default__UTMutator'
    }

    hope this helps ya out..
    I got it to replace the weapons I am replacing, the other weapons merely point to them selfs and load fine.
    I is fuzzy braiwned mew =0-o=
    ------------------------------------------------------
    Still an idiot after all these years.
    -----------------------
    http://zippydsmlee.wordpress.com/

  19. #19

    Default

    I'm currently just trying to get a modified rocketlauncher as a test and I'm having a helluva time.

    I tried this code:

    Code:
    class Ridiculous extends UTMutator
    config(Game);
    
    struct ReplacementInfo
    {
    	var name OldClassName;
    	var string NewClassPath;
    };
    
    var config array<ReplacementInfo> WeaponsToReplace;
    var config array<ReplacementInfo> AmmoToReplace;
    
    function InitMutator(string Options, out string ErrorMessage)
    {
    if (UTGame(WorldInfo.Game) != None)
    
    Super.InitMutator(Options, ErrorMessage);
    }
    
    function bool CheckReplacement(Actor Other)
    {
    	local UTWeaponPickupFactory WeaponPickup;
    	local UTWeaponLocker Locker;
    	local UTAmmoPickupFactory AmmoPickup, NewAmmo;
    	local class<UTAmmoPickupFactory> NewAmmoClass;
    	local int i;
    
            WeaponPickup = UTWeaponPickupFactory(Other);
            Locker = UTWeaponLocker(Other);
            AmmoPickup = UTAmmoPickupFactory(Other);
    
            if (WeaponPickup.WeaponPickupClass != None)
            {
               if(String(WeaponPickup.WeaponPickupClass) == "UTWeap_Rocketlauncher")
               {
               WeaponPickup.WeaponPickupClass = class<UTWeapon>(DynamicLoadObject("Ridiculous.UTWeap_Rocketboom", class'Class'));
               WeaponPickup.InitializePickup();
               return true;
               }
    
            }
            if ( Locker != None )
            {
                for (i = 0; i < Locker.Weapons.length; i++)
                {
                  if(String(Locker.Weapons[i].WeaponClass) == "UTWeap_Rocketlauncher")
                  {
    		Locker.ReplaceWeapon(i, class<UTWeapon>(DynamicLoadObject("Ridiculous.UTWeap_Rocketboom", class'Class')));
    		return true;
    	      }
                }
            }
            else if (AmmoPickup != None)
    	{
    
              if (string(Other.Class) ~=  "UTAmmo_Rocketlauncher")
              { 
                NewAmmoClass = class<UTAmmoPickupFactory>(DynamicLoadObject("Ridiculous.UTAmmo_Rocketboom", class'Class'));
    	    if (NewAmmoClass.default.bStatic || NewAmmoClass.default.bNoDelete)
                 {
    		AmmoPickup.TransformAmmoType(NewAmmoClass);
    		return true;
    	     }
    	     else
    	     {
    		NewAmmo = AmmoPickup.Spawn(NewAmmoClass);
    		NewAmmo.OriginalFactory = AmmoPickup;
    		AmmoPickup.ReplacementFactory = NewAmmo;
    		return false;
    	     
                   }
              }
         }
         return true;
    }
    
    defaultproperties
    {
       Name="Default__Ridiculous"
       ObjectArchetype=UTMutator'UTGame.Default__UTMutator'
    }
    It will compile fine. It just never replaces the weapon pickups or ammo.

    I'm not sure if there is something I'm missing or what.

  20. #20

    Default

    Quote Originally Posted by kharvelan View Post
    I'm currently just trying to get a modified rocketlauncher as a test and I'm having a helluva time.

    I tried this code:

    Code:
    class Ridiculous extends UTMutator
    config(Game);
    
    struct ReplacementInfo
    {
    	var name OldClassName;
    	var string NewClassPath;
    };
    
    var config array<ReplacementInfo> WeaponsToReplace;
    var config array<ReplacementInfo> AmmoToReplace;
    
    function InitMutator(string Options, out string ErrorMessage)
    {
    if (UTGame(WorldInfo.Game) != None)
    
    Super.InitMutator(Options, ErrorMessage);
    }
    
    function bool CheckReplacement(Actor Other)
    {
    	local UTWeaponPickupFactory WeaponPickup;
    	local UTWeaponLocker Locker;
    	local UTAmmoPickupFactory AmmoPickup, NewAmmo;
    	local class<UTAmmoPickupFactory> NewAmmoClass;
    	local int i;
    
            WeaponPickup = UTWeaponPickupFactory(Other);
            Locker = UTWeaponLocker(Other);
            AmmoPickup = UTAmmoPickupFactory(Other);
    
            if (WeaponPickup.WeaponPickupClass != None)
            {
               if(String(WeaponPickup.WeaponPickupClass) == "UTWeap_Rocketlauncher")
               {
               WeaponPickup.WeaponPickupClass = class<UTWeapon>(DynamicLoadObject("Ridiculous.UTWeap_Rocketboom", class'Class'));
               WeaponPickup.InitializePickup();
               return true;
               }
    
            }
            if ( Locker != None )
            {
                for (i = 0; i < Locker.Weapons.length; i++)
                {
                  if(String(Locker.Weapons[i].WeaponClass) == "UTWeap_Rocketlauncher")
                  {
    		Locker.ReplaceWeapon(i, class<UTWeapon>(DynamicLoadObject("Ridiculous.UTWeap_Rocketboom", class'Class')));
    		return true;
    	      }
                }
            }
            else if (AmmoPickup != None)
    	{
    
              if (string(Other.Class) ~=  "UTAmmo_Rocketlauncher")
              { 
                NewAmmoClass = class<UTAmmoPickupFactory>(DynamicLoadObject("Ridiculous.UTAmmo_Rocketboom", class'Class'));
    	    if (NewAmmoClass.default.bStatic || NewAmmoClass.default.bNoDelete)
                 {
    		AmmoPickup.TransformAmmoType(NewAmmoClass);
    		return true;
    	     }
    	     else
    	     {
    		NewAmmo = AmmoPickup.Spawn(NewAmmoClass);
    		NewAmmo.OriginalFactory = AmmoPickup;
    		AmmoPickup.ReplacementFactory = NewAmmo;
    		return false;
    	     
                   }
              }
         }
         return true;
    }
    
    defaultproperties
    {
       Name="Default__Ridiculous"
       ObjectArchetype=UTMutator'UTGame.Default__UTMutator'
    }
    It will compile fine. It just never replaces the weapon pickups or ammo.

    I'm not sure if there is something I'm missing or what.
    As I have been told many a many a many a time do not adlib the code just fill in the blanks if you are not using a new weapon then replace the weapon with itself.
    I is fuzzy braiwned mew =0-o=
    ------------------------------------------------------
    Still an idiot after all these years.
    -----------------------
    http://zippydsmlee.wordpress.com/

  21. #21

    Default

    I actually did try just a weapon replacement as well, here's the code for this:

    Code:
    Class Rocketboom extends UTMutator;
    
    function InitMutator(string Options, out string ErrorMessage)
    {
    if (UTGame(WorldInfo.Game) != None)
    {
    UTGame(WorldInfo.Game).DefaultInventory[0] = class'Rocketboom.UTWeap_Enforceboom';
    }
    
    Super.InitMutator(Options, ErrorMessage);
    }
    
    function bool CheckReplacement(Actor Other)
    {
    
    if (Other.IsA('UTWeap_RocketLauncher') && !Other.IsA('UTWeap_Rocketboom'))
    {
    ReplaceWith(Other, "UTWeap_Rocketboom");
    }
    
    if (Other.IsA('UTWeap_Enforcer') && !Other.IsA('UTWeap_Enforceboom'))
    {
    ReplaceWith(Other, "UTWeap_Enforceboom");
    }
    
    return true;
    }
    I can get the modified enforcer into the game, but the rocketlauncher will not show using this code.

    I'm assuming I must need to replace all weapon pickups in the game for each different item, but I was trying to avoid that using the previous code.

  22. #22

    Default

    Quote Originally Posted by kharvelan View Post
    I actually did try just a weapon replacement as well, here's the code for this:

    Code:
    Class Rocketboom extends UTMutator;
    
    function InitMutator(string Options, out string ErrorMessage)
    {
    if (UTGame(WorldInfo.Game) != None)
    {
    UTGame(WorldInfo.Game).DefaultInventory[0] = class'Rocketboom.UTWeap_Enforceboom';
    }
    
    Super.InitMutator(Options, ErrorMessage);
    }
    
    function bool CheckReplacement(Actor Other)
    {
    
    if (Other.IsA('UTWeap_RocketLauncher') && !Other.IsA('UTWeap_Rocketboom'))
    {
    ReplaceWith(Other, "UTWeap_Rocketboom");
    }
    
    if (Other.IsA('UTWeap_Enforcer') && !Other.IsA('UTWeap_Enforceboom'))
    {
    ReplaceWith(Other, "UTWeap_Enforceboom");
    }
    
    return true;
    }
    I can get the modified enforcer into the game, but the rocketlauncher will not show using this code.

    I'm assuming I must need to replace all weapon pickups in the game for each different item, but I was trying to avoid that using the previous code.
    Um no you use the code in its entirety and add in whats replaced and replace the weapons that are not replaced with them selfs, you can not adlib on this code unless you know what you are doing.

    trust me I spent a few days trying to make the code smaller and use just what I need..... use the whole code and replace the weapons you want with yours but you will have to fill in the rest with them selfs since the code is meant to be used as an all weapon change code.
    I is fuzzy braiwned mew =0-o=
    ------------------------------------------------------
    Still an idiot after all these years.
    -----------------------
    http://zippydsmlee.wordpress.com/

  23. #23

    Default

    thanks for the info, I can mess with using the whole thing, but it seemed like a waste of time, since I'm replacing all the weapons eventually, I'll just get them all into the game, then move them over at one time.

    I guess that's the best way, it's just kind of crappy you can't just do one at a time for testing purposes.

  24. #24

    Default

    Quote Originally Posted by kharvelan View Post
    thanks for the info, I can mess with using the whole thing, but it seemed like a waste of time, since I'm replacing all the weapons eventually, I'll just get them all into the game, then move them over at one time.

    I guess that's the best way, it's just kind of crappy you can't just do one at a time for testing purposes.
    No no I understand what you are saying but think of it like this you can change the code as you mess with new weapons so in the end its good to know the complete weapon change code, I am a rapid code nawer, my understanding of code is more pain than laughable ask around :P

    but a few things get hammered through ^^

    I don;t know how to do ti but I am sure someone if they care to will explain how to do a proper weapon code that can be added to lil by lil but that needs to be asked in a new thread.

    for here the full code works well and dose not need to be drooled on much by noods,I know it zaped me a few times, using the full code wil take a few minutes to fill in but can be updated for new weapons quickly so tis worth using the whole thing.
    I is fuzzy braiwned mew =0-o=
    ------------------------------------------------------
    Still an idiot after all these years.
    -----------------------
    http://zippydsmlee.wordpress.com/

  25. #25

    Default

    This helped a ton, but I thought I might assist others in their goals.

    My mutator is called Ridiculous, and I'm going to post what I did to get all my weapons to show up.

    Below is the code, I used for the main ridiculous.ini and also the enforcer, and it's ammo.

    My source folder is named ridiculous as well as my mutator UC.

    Here is the source for Ridiculous.uc, UTWeap_Enforceboom.uc and UTAmmo_Enforceboom.uc:

    Here is the code for Ridiculous:

    Code:
    class Ridiculous extends UTMutator
    
    config(Ridiculous);
    
    struct ReplacementInfo
    {
    	/** class name of the weapon we want to get rid of */
    	var name OldClassName;
    	/** fully qualified path of the class to replace it with */
    	var string NewClassPath;
    };
    
    var config array<ReplacementInfo> WeaponsToReplace;
    var config array<ReplacementInfo> AmmoToReplace;
    
    function PostBeginPlay()
    {
    	local UTGame Game;
    	local int i, Index;
    
    	Super.PostBeginPlay();
    
    	// replace default weapons
    	Game = UTGame(WorldInfo.Game);
    	if (Game != None)
    	{
    		for (i = 0; i < Game.DefaultInventory.length; i++)
    		{
    			if (Game.DefaultInventory[i] != None)
    			{
    				Index = WeaponsToReplace.Find('OldClassName', Game.DefaultInventory[i].Name);
    				if (Index != INDEX_NONE)
    				{
    					if (WeaponsToReplace[Index].NewClassPath == "")
    					{
    						// replace with nothing
    						Game.DefaultInventory.Remove(i, 1);
    						i--;
    					}
    					Game.DefaultInventory[i] = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    				}
    			}
    		}
    
    		if (Game.TranslocatorClass != None)
    		{
    			Index = WeaponsToReplace.Find('OldClassName', Game.TranslocatorClass.Name);
    			if (Index != INDEX_NONE)
    			{
    				if (WeaponsToReplace[Index].NewClassPath == "")
    				{
    					// replace with nothing
    					Game.TranslocatorClass = None;
    				}
    				else
    				{
    					Game.TranslocatorClass = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    				}
    			}
    		}
    	}
    }
    
    function bool CheckReplacement(Actor Other)
    {
    	local UTWeaponPickupFactory WeaponPickup;
    	local UTWeaponLocker Locker;
    	local UTAmmoPickupFactory AmmoPickup, NewAmmo;
    	local int i, Index;
    	local class<UTAmmoPickupFactory> NewAmmoClass;
    
    	WeaponPickup = UTWeaponPickupFactory(Other);
    	if (WeaponPickup != None)
    	{
    		if (WeaponPickup.WeaponPickupClass != None)
    		{
    			Index = WeaponsToReplace.Find('OldClassName', WeaponPickup.WeaponPickupClass.Name);
    			if (Index != INDEX_NONE)
    			{
    				if (WeaponsToReplace[Index].NewClassPath == "")
    				{
    					// replace with nothing
    					return false;
    				}
    				WeaponPickup.WeaponPickupClass = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    				WeaponPickup.InitializePickup();
    			}
    		}
    	}
    	else
    	{
    		Locker = UTWeaponLocker(Other);
    		if (Locker != None)
    		{
    			for (i = 0; i < Locker.Weapons.length; i++)
    			{
    				if (Locker.Weapons[i].WeaponClass != None)
    				{
    					Index = WeaponsToReplace.Find('OldClassName', Locker.Weapons[i].WeaponClass.Name);
    					if (Index != INDEX_NONE)
    					{
    						if (WeaponsToReplace[Index].NewClassPath == "")
    						{
    							// replace with nothing
    							Locker.ReplaceWeapon(i, None);
    						}
    						else
    						{
    							Locker.ReplaceWeapon(i, class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class')));
    						}
    					}
    				}
    			}
    		}
    		else
    		{
    			AmmoPickup = UTAmmoPickupFactory(Other);
    			if (AmmoPickup != None)
    			{
    				Index = AmmoToReplace.Find('OldClassName', AmmoPickup.Class.Name);
    				if (Index != INDEX_NONE)
    				{
    					if (AmmoToReplace[Index].NewClassPath == "")
    					{
    						// replace with nothing
    						return false;
    					}
    					NewAmmoClass = class<UTAmmoPickupFactory>(DynamicLoadObject(AmmoToReplace[Index].NewClassPath, class'Class'));
    					if (NewAmmoClass == None)
    					{
    						// replace with nothing
    						return false;
    					}
    					else if (NewAmmoClass.default.bStatic || NewAmmoClass.default.bNoDelete)
    					{
    						// transform the current ammo into the desired class
    						AmmoPickup.TransformAmmoType(NewAmmoClass);
    						return true;
    					}
    					else
    					{
    						// spawn the new ammo, link it to the old, then disable the old one
    						NewAmmo = AmmoPickup.Spawn(NewAmmoClass);
    						NewAmmo.OriginalFactory = AmmoPickup;
    						AmmoPickup.ReplacementFactory = NewAmmo;
    						return false;
    					}
    				}
    			}
    		}
    	}
    
    	return true;
    }
    
    
    defaultproperties
    {
    // Fill in the blanks
       WeaponsToReplace(0)=(OldClassName="UTWeap_Enforcer",NewClassPath="Ridiculous.UTWeap_Enforceboom")
       AmmoToReplace(0)=(OldClassName="UTAmmo_Enforcer",NewClassPath="Ridiculous.UTAmmo_Enforceboom")
    
       WeaponsToReplace(1)=(OldClassName="UTWeap_BioRifle_Content",NewClassPath="Ridiculous.UTWeap_Bioboom")
       AmmoToReplace(1)=(OldClassName="UTAmmo_BioRifle_Content",NewClassPath="Ridiculous.Bio_content_ridic")
    
       WeaponsToReplace(2)=(OldClassName="UTWeap_FlakCannon",NewClassPath="Ridiculous.UTWeap_Flakboom")
       AmmoToReplace(2)=(OldClassName="UTAmmo_FlakCannon",NewClassPath="Ridiculous.UTAmmo_Flakboom")
    
       WeaponsToReplace(3)=(OldClassName="UTWeap_LinkGun",NewClassPath="Ridiculous.UTWeap_Linkboom")
       AmmoToReplace(3)=(OldClassName="UTAmmo_LinkGun",NewClassPath="Ridiculous.UTAmmo_Linkboom")
    
       WeaponsToReplace(4)=(OldClassName="UTWeap_Redeemer_Content",NewClassPath="Ridiculous.UTWeap_Redeemer_Boom")
    
       WeaponsToReplace(5)=(OldClassName="UTWeap_RocketLauncher",NewClassPath="Ridiculous.UTWeap_Rocketboom")
       AmmoToReplace(5)=(OldClassName="UTAmmo_RocketLauncher",NewClassPath="Ridiculous.UTAmmo_Rocketboom")
    
       WeaponsToReplace(6)=(OldClassName="UTWeap_ShockRifle",NewClassPath="Ridiculous.UTWeap_Shockboom")
       AmmoToReplace(6)=(OldClassName="UTAmmo_ShockRifle",NewClassPath="Ridiculous.UTAmmo_Shockboom")
    
       WeaponsToReplace(7)=(OldClassName="UTWeap_SniperRifle",NewClassPath="Ridiculous.UTWeap_Sniperboom")
       AmmoToReplace(7)=(OldClassName="UTAmmo_SniperRifle",NewClassPath="Ridiculous.UTAmmo_Sniperboom")
    
       WeaponsToReplace(8)=(OldClassName="UTWeap_Stinger",NewClassPath="Ridiculous.UTWeap_Stingboom")
       AmmoToReplace(8)=(OldClassName="UTAmmo_Stinger",NewClassPath="Ridiculous.UTAmmo_Stingboom")
    
       GroupNames(0)="WEAPONMOD"
       Name=""
    }
    Make sure you set GroupNames to WEAPONMOD.
    This prevents your weapon modification from loading with other weapon mods and prevents game crashes!

    Here is the code for the weapon modification itself:

    Code:
    class UTWeap_Enforceboom extends UTWeap_Enforcer;
    
    DefaultProperties
    {
    BurstMax=24
    BurstCoolDownTime=0.120000
    aimerror=100.000000
    AmmoCount=99
    LockerAmmoCount=99
    MaxAmmoCount=99
    FireInterval(0)=0.120000
    FireInterval(1)=0.040000
    PickupMessage="Now that's a pistol!"
    ItemName="Even a small gun is better than nothing. . ."
    
    }
    The above code just changes the default properties of the weapon.
    Note the PickupMessage field, this changes what you see when you pick up the weapon on the field.
    Note the ItemName field, this changes what you see when you select the weapon.

    Here is the code for the ammo:

    Code:
    class UTAmmo_enforceboom extends UTAmmo_Enforcer;
    
    
    defaultproperties
    {
       AmmoAmount=99
       PickupMessage="Bullets . . . the great equalizer"
    }
    The above edits the properties of the ammo pickup itself.
    The PickupMessage edits what people see when they get more ammo.

    Hope this helps anyone else looking to make weapon mutators!

  26. #26
    Redeemer
    Join Date
    Mar 2003
    Posts
    1,650

    Default

    Quote Originally Posted by pingfreak View Post
    Just want to let you all know this is EPIC's code// I'm just adding defaults.

    Code:
    /////////////////////////////////////////////////////
    // Mutator: Copy and Paste from EPIC
    // Assembled By: *PingFre@K*
    /////////////////////////////////////////////////////
    
    class ExampleYourMutatorName extends UTMutator
       config(ExampleYourMutatorName);
    
    struct ReplacementInfo
    {
    	/** class name of the weapon we want to get rid of */
    	var name OldClassName;
    	/** fully qualified path of the class to replace it with */
    	var string NewClassPath;
    };
    
    var config array<ReplacementInfo> WeaponsToReplace;
    var config array<ReplacementInfo> AmmoToReplace;
    
    function PostBeginPlay()
    {
    	local UTGame Game;
    	local int i, Index;
    
    	Super.PostBeginPlay();
    
    	// replace default weapons
    	Game = UTGame(WorldInfo.Game);
    	if (Game != None)
    	{
    		for (i = 0; i < Game.DefaultInventory.length; i++)
    		{
    			if (Game.DefaultInventory[i] != None)
    			{
    				Index = WeaponsToReplace.Find('OldClassName', Game.DefaultInventory[i].Name);
    				if (Index != INDEX_NONE)
    				{
    					if (WeaponsToReplace[Index].NewClassPath == "")
    					{
    						// replace with nothing
    						Game.DefaultInventory.Remove(i, 1);
    						i--;
    					}
    					Game.DefaultInventory[i] = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    				}
    			}
    		}
    
    		if (Game.TranslocatorClass != None)
    		{
    			Index = WeaponsToReplace.Find('OldClassName', Game.TranslocatorClass.Name);
    			if (Index != INDEX_NONE)
    			{
    				if (WeaponsToReplace[Index].NewClassPath == "")
    				{
    					// replace with nothing
    					Game.TranslocatorClass = None;
    				}
    				else
    				{
    					Game.TranslocatorClass = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    				}
    			}
    		}
    	}
    }
    
    function bool CheckReplacement(Actor Other)
    {
    	local UTWeaponPickupFactory WeaponPickup;
    	local UTWeaponLocker Locker;
    	local UTAmmoPickupFactory AmmoPickup, NewAmmo;
    	local int i, Index;
    	local class<UTAmmoPickupFactory> NewAmmoClass;
    
    	WeaponPickup = UTWeaponPickupFactory(Other);
    	if (WeaponPickup != None)
    	{
    		if (WeaponPickup.WeaponPickupClass != None)
    		{
    			Index = WeaponsToReplace.Find('OldClassName', WeaponPickup.WeaponPickupClass.Name);
    			if (Index != INDEX_NONE)
    			{
    				if (WeaponsToReplace[Index].NewClassPath == "")
    				{
    					// replace with nothing
    					return false;
    				}
    				WeaponPickup.WeaponPickupClass = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    				WeaponPickup.InitializePickup();
    			}
    		}
    	}
    	else
    	{
    		Locker = UTWeaponLocker(Other);
    		if (Locker != None)
    		{
    			for (i = 0; i < Locker.Weapons.length; i++)
    			{
    				if (Locker.Weapons[i].WeaponClass != None)
    				{
    					Index = WeaponsToReplace.Find('OldClassName', Locker.Weapons[i].WeaponClass.Name);
    					if (Index != INDEX_NONE)
    					{
    						if (WeaponsToReplace[Index].NewClassPath == "")
    						{
    							// replace with nothing
    							Locker.ReplaceWeapon(i, None);
    						}
    						else
    						{
    							Locker.ReplaceWeapon(i, class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class')));
    						}
    					}
    				}
    			}
    		}
    		else
    		{
    			AmmoPickup = UTAmmoPickupFactory(Other);
    			if (AmmoPickup != None)
    			{
    				Index = AmmoToReplace.Find('OldClassName', AmmoPickup.Class.Name);
    				if (Index != INDEX_NONE)
    				{
    					if (AmmoToReplace[Index].NewClassPath == "")
    					{
    						// replace with nothing
    						return false;
    					}
    					NewAmmoClass = class<UTAmmoPickupFactory>(DynamicLoadObject(AmmoToReplace[Index].NewClassPath, class'Class'));
    					if (NewAmmoClass == None)
    					{
    						// replace with nothing
    						return false;
    					}
    					else if (NewAmmoClass.default.bStatic || NewAmmoClass.default.bNoDelete)
    					{
    						// transform the current ammo into the desired class
    						AmmoPickup.TransformAmmoType(NewAmmoClass);
    						return true;
    					}
    					else
    					{
    						// spawn the new ammo, link it to the old, then disable the old one
    						NewAmmo = AmmoPickup.Spawn(NewAmmoClass);
    						NewAmmo.OriginalFactory = AmmoPickup;
    						AmmoPickup.ReplacementFactory = NewAmmo;
    						return false;
    					}
    				}
    			}
    		}
    	}
    
    	return true;
    }
    
    
    defaultproperties
    {
    // Fill in the blanks
       WeaponsToReplace(0)=(OldClassName="UTWeap_Enforcer",NewClassPath="ExamplePackageName.ExampleWeaponClassName")
       AmmoToReplace(0)=(OldClassName="UTAmmo_Enforcer",NewClassPath="ExamplePackageName.ExampleAmmoClassName")
    
       WeaponsToReplace(1)=(OldClassName="UTWeap_BioRifle_Content",NewClassPath="")
       AmmoToReplace(1)=(OldClassName="UTAmmo_BioRifle_Content",NewClassPath="")
    
       WeaponsToReplace(2)=(OldClassName="UTWeap_FlakCannon",NewClassPath="")
       AmmoToReplace(2)=(OldClassName="UTAmmo_FlakCannon",NewClassPath="")
    
       WeaponsToReplace(3)=(OldClassName="UTWeap_LinkGun",NewClassPath="")
       AmmoToReplace(3)=(OldClassName="UTAmmo_LinkGun",NewClassPath="")
    
       WeaponsToReplace(4)=(OldClassName="UTWeap_Redeemer_Content",NewClassPath="")
    
       WeaponsToReplace(5)=(OldClassName="UTWeap_RocketLauncher",NewClassPath="")
       AmmoToReplace(5)=(OldClassName="UTAmmo_RocketLauncher",NewClassPath="")
    
       WeaponsToReplace(6)=(OldClassName="UTWeap_ShockRifle",NewClassPath="")
       AmmoToReplace(6)=(OldClassName="UTAmmo_ShockRifle",NewClassPath="")
    
       WeaponsToReplace(7)=(OldClassName="UTWeap_SniperRifle",NewClassPath="")
       AmmoToReplace(7)=(OldClassName="UTAmmo_SniperRifle",NewClassPath="")
    
       WeaponsToReplace(8)=(OldClassName="UTWeap_Stinger",NewClassPath="")
       AmmoToReplace(8)=(OldClassName="UTAmmo_Stinger",NewClassPath="")
    
       GroupNames(0)=""
       Name=""
    }
    After struggling to wright a weapon replacemnt mutator.. And seeing things done over these forums to incorrectly wright one.. I thought I should share this bit of 'should of known' knowledge for weapon replacement.
    You can use this code in your mutator to have your weapon or weapon Pack replacements. Don't know if something like this gets stickied or not but it's definitely good info.

    A favor to ask... can you make a vehicle replacer version?

  27. #27
    Redeemer
    Join Date
    Mar 2003
    Posts
    1,650

    Default

    .... guess not

  28. #28
    Skaarj
    Join Date
    Aug 2008
    Location
    Indiana
    Posts
    1

    Default

    I have searched the internet and many forums for a mutator that will allow me to Swap a given weapon for the Deployable SlowField. So far I cannot find anything of the sort and using the code you provided, I have as of yet been unable to make my own. I have just started learning how to do things in UT3 and I would appreciate it if someone would be willing to look into this if they have the time.

    Below I added what I assumed to be the SlowField but when I run the Mut, nothing happens and the Shock Rifle is still there. When in UEd you can choose the SlowField in a Weapons Locker (Which is what gave me this idea) but the only thing I can think of is that the path below (grabbed from the locker weapon properties) is incorrect or incomplete.

    BTW, if anyone knows where I can get GOOD instruction in UT3 script, I'd appreciate a message or something. Thanks!


    WeaponsToReplace(6)=(OldClassName="UTWeap_ShockRif le",NewClassPath="UTGameContent.UTDeployableSlowVo lume")
    AmmoToReplace(6)=(OldClassName="UTAmmo_ShockRifle" ,NewClassPath="UTGameContent.UTDeployableSlowVolum e")

  29. #29
    MSgt. Shooter Person
    Join Date
    Sep 2006
    Posts
    415

    Default

    TheBlakDragon - I can see why what you are trying won't work... Deployable Volumes won't spawn through the same pickupbase a weapon such as the shockRifle will. ... Try to add a deployable slow volume in any map in the editor and you will see what i'm talking about...

    Back to the subject - Has anyone besides me tried using this replacement in gui form in your own mod? I will direct you here..

    http://forums.epicgames.com/showthread.php?t=614269
    ~ If it was easy everyone would be doing it. ~
    Akimbo Expansion Pack Elite Machines XX HitSounds Show Damage
    DM-Backyard99 DM-Lan_Party

    James O Bishop

  30. #30
    MSgt. Shooter Person
    Join Date
    Mar 2009
    Posts
    61

    Default

    My weapons and pickup bases become invisible after a map change. It's fine on first server boot but from then on, they are invisible, yet I can still pick them up.

    If I reconnect to the server, the weapons will show again. So it only seems to happen if I'm present on the server when a map change is performed.

    Am I missing something? Can't find any related errors in server logs.

  31. #31
    MSgt. Shooter Person
    Join Date
    Jan 2009
    Posts
    153

    Default

    Code:
     if (Game != None)
    	{
    		for (i = 0; i < Game.DefaultInventory.length; i++)
    		{
    			if (Game.DefaultInventory[i] != None)
    			{
    				Index = WeaponsToReplace.Find('OldClassName', Game.DefaultInventory[i].Name);
    				if (Index != INDEX_NONE)
    				{
    					if (WeaponsToReplace[Index].NewClassPath == "")
    					{
    						// replace with nothing
    						Game.DefaultInventory.Remove(i, 1);
    						i--;
    					}
    					Game.DefaultInventory[i] = class<UTWeapon>(DynamicLoadObject(WeaponsToReplace[Index].NewClassPath, class'Class'));
    				}
    			}
    		}
    I dont understand why you need the for statement, I am reading through it but I dont understand what you are doing with it. Could you explain it please?

  32. #32

    Default

    The for-loop checks all the weapons in the player's starting inventory, which is usually the Impact Hammer and Enforcer, plus Translocator in CTF.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.