PDA

View Full Version : Weapon replacement mutator 4 U 2 use



pingfreak
02-07-2008, 01:14 AM
Just want to let you all know this is EPIC's code// I'm just adding defaults.


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

~{MFD}~Mordred
02-16-2008, 02:10 AM
Dude THANK YOU!! No one has replied but I will :) Thanks!

gämmö
02-16-2008, 04:09 AM
Thanks, kool info.

~{MFD}~Mordred
02-17-2008, 02:13 PM
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 :D

Thanks Pinkfreak.

Sprint
02-18-2008, 10:22 PM
Is there a way to get the PS3's source? That way you could see how they did the configuration menues.

THE_SPELUNKER
03-25-2008, 11:12 PM
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.

ZippyDSMlee
03-26-2008, 08:59 AM
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

pingfreak
03-26-2008, 10:26 AM
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.

THE_SPELUNKER
03-26-2008, 03:23 PM
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.

pingfreak
03-26-2008, 03:30 PM
Double check your example texts.. and revert back to the origional post.

elmuerte
03-26-2008, 05:32 PM
ever heard of subclassing?

ZippyDSMlee
03-26-2008, 08:55 PM
/////////////////////////////////////////////////////
// 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(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="FirstMutator.UTWeap_Enforcer")
AmmoToReplace(0)=(OldClassName="UTAmmo_Enforcer",NewClassPath="UTAmmo_Enforcer")

// 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="FirstMutator.UTWeap_Stoner")
AmmoToReplace(8)=(OldClassName="UTAmmo_Stinger",NewClassPath="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.

pingfreak
03-27-2008, 01:25 AM
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

}
}
}
}
}

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.

ZippyDSMlee
03-27-2008, 03:40 AM
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

}
}
}
}
}

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?

Wormbo
03-27-2008, 04:20 AM
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.


ever heard of subclassing?
...of of [code] tags? [quote] trashes indenting.

ZippyDSMlee
03-27-2008, 04:41 AM
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

}
}
}
}
}

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

dave neun
03-28-2008, 05:43 PM
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


//
// 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__UTMutato r'
}


hope this helps ya out..

ZippyDSMlee
03-28-2008, 05:54 PM
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


//
// 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__UTMutato r'
}


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.

kharvelan
05-08-2008, 11:59 PM
I'm currently just trying to get a modified rocketlauncher as a test and I'm having a helluva time.

I tried this 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__UTMutato r'
}

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.

ZippyDSMlee
05-09-2008, 12:04 AM
I'm currently just trying to get a modified rocketlauncher as a test and I'm having a helluva time.

I tried this 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__UTMutato r'
}

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.

kharvelan
05-09-2008, 12:32 AM
I actually did try just a weapon replacement as well, here's the code for this:


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.

ZippyDSMlee
05-09-2008, 12:40 AM
I actually did try just a weapon replacement as well, here's the code for this:


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 (http://forums.epicgames.com/showpost.php?p=25267958&postcount=1)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.

kharvelan
05-09-2008, 12:45 AM
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.

ZippyDSMlee
05-09-2008, 12:51 AM
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.

kharvelan
05-12-2008, 02:51 AM
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:


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:


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:


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!

CVROY
05-17-2008, 12:32 PM
Just want to let you all know this is EPIC's code// I'm just adding defaults.


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

CVROY
05-23-2008, 07:28 AM
.... guess not :)

TheBlakDrag0n
08-31-2008, 10:12 PM
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_ShockRifle",NewClassPath="UTGameContent.UTDeployableSlowVolume")
AmmoToReplace(6)=(OldClassName="UTAmmo_ShockRifle",NewClassPath="UTGameContent.UTDeployableSlowVolume")

pingfreak
09-01-2008, 05:47 PM
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

fru
04-05-2009, 12:58 AM
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.

SteveThePirate
04-06-2009, 03:02 AM
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?

Xyx
04-06-2009, 04:59 AM
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.