I haven't compiled the following, but this is mostly paraphrased from my super duper pickup switcher mutator, which replaces pickup factories with my subclasses, see what you can make of it.
Code:
local UTWeaponPickupFactory WeaponPickup; //their class
local GnaMWeaponPickupFactory GnaMWeaponPickupInstance; //your class (for the purposes of this post, anyway)
if (Other != None) //found actor Other
{
if ( Other.IsA('UTWeaponPickupFactory') && !Other.IsA('GnaMWeaponPickupFactory') ) //Other is UTWeaponPickupFactory but not one of your replacement subclassed ones
{
if (Other.WeaponPickupClass != None) //gotta make sure it has inventory so we can assign the replacement's inventory.
{
GnaMWeaponPickupInstance = Spawn(class'GnaMWeaponPickupFactory',,, Other.Location, Other.Rotation); //go ahead and spawn your new pickup right where the old Other was.
GnaMWeaponPickupInstance.WeaponPickupClass; = Other.WeaponPickupClass; //set the Weapon Pickup Class...
GnaMWeaponPickupInstance.InventoryType = GnaMWeaponPickupInstance.WeaponPickupClass; //need to set this one too, so that the pickup does not disable itself.
GnaMWeaponPickupInstance.SetBase(Other.Base); //settle in...
if (GnaMWeaponPickupInstance.Base != None)
{
GnaMWeaponPickupInstance.SetHardAttach(TRUE); //glue for movers (VCTF-Rails, etc)
}
GnaMWeaponPickupInstance.OriginalFactory = Other; //a.i. stuff? as seen in UTMutator_WeaponReplacement ammo section , or ReplaceWith()
Other.ReplacementFactory = GnaMWeaponPickupInstance; //second line of that stuff
GnaMWeaponPickupInstance.SetDrawScale(Other.DrawScale); //this is good to do for fancy maps.
GnaMWeaponPickupInstance.InitializePickup(); //and this is so it will start with the inventory and go to correct state.
return false; //remove original "other"
}
}
}
return true; //other others stay other
For your mutator, you could maybe be more elegant and let the ReplaceWith() function do some of this work.
I've assumed that you know what you are doing with the other floats of mention, just remember that you'll need to override the inherited function "GetRespawnTime()" in your weaponpickupfactory subclass because it tries to do this...
Code:
function float GetRespawnTime()
{
return InventoryType.Default.RespawnTime;
}
which, upon pickup sleep state, resets it to 30 for normal weapons (inherited from "Inventory" and 120 (90?) for redeemer, set from its content class defaultproperties.
so you want something like this in your weapon pickup factory;
Code:
function float GetRespawnTime()
{
return GnaMsFloat; // or: return 15.0;
}
Bookmarks