View Full Version : Quick Default Weapons Coding Question

28th Jun 2004, 04:08 AM
OK, I'm making a mutator for 2k4 that replaces the assault rifle with my modified assault rifle. I am using the DefaultWeapon property to get the new AR in there, my problem is getting the old AR out. Right now the mutator spawns the player with the shield gun, the vanilla AR, and my modded AR. Is There a simple way to just disable a default weapon? BTW, I'm new to coding so please nothing unnessesarily complicated. Thanks.

28th Jun 2004, 09:12 AM
the mutator function GetInventoryClassOverride does exactly what youre looking for... heck, its even got instructions in its comments! :D

/* GetInventoryClassOverride()
return the string passed in, or a replacement class name string.
function string GetInventoryClassOverride(string InventoryClassName)
// here, in mutator subclass, change InventoryClassName if desired. For example:
// if ( InventoryClassName == "Weapons.DorkyDefaultWeapon"
// InventoryClassName = "ModWeapons.SuperDisintegrator"

if ( NextMutator != None )
return NextMutator.GetInventoryClassOverride(InventoryClassName);
return InventoryClassName;

So what you'd do is say something like

return "YourPackage.AssKickingAssaultRifleReplacement";

Im gonna try and use my magic powers to move this to a more proper place. Lets see how that goes.

28th Jun 2004, 03:19 PM
Awesome! Thanks a lot! I will try it out as soon as I get home from work tonight. :D

3rd Jul 2004, 01:12 AM
OK, something odd has been happening... With this code, when players die, they drop default assault rifles instead of the new ones. I stuck else if ( AssaultRiflePickup(Other) != None )
ReplaceWith( Other, "ProWeapons.ProAssaultRiflePickup");
return false;
in my list of replacement code, and now players drop the new assault rifles when they die. The only thing is, the pickups don't disapear after the set time like they're supposed to. It isn't a huge problem but it is something I'd like to correct just cause its not something I planned to happen.

Is there a way to disable the akimbo feature? I was thinking I could just delete all the lines of the AR code that have to do with the akimbo stuff. I'd rather just get more ammo. Only problem is knowing what stuff to delete. I don't want to screw anything up. Thanks in advance for any help that may be given.

3rd Jul 2004, 09:25 AM
Dont delete it, first just put a // in front of those lines, that way, Unreal will ignore it. When you are sure you got the right ones, then you can delete them perment like.

4th Jul 2004, 04:29 PM
Good idea, thanks.