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

UE3 - UT3 Weapon Replacement not working

Discussion in 'Programming' started by DeathoX 8, May 31, 2011.

  1. DeathoX 8

    DeathoX 8 Beta Toaster

    Joined:
    Jan 20, 2008
    Messages:
    247
    Likes Received:
    0
    Hi all, I am trying to create a very basic mutator to replace a weapon with a modified one (just a few default properties changed) but I haven't had any luck in making it work.

    The code compiles fine and I can select it in the mutator list but it doesn't have any effect. I omitted is filling out the .ini file in the config folder, but shouldn't it work anyway?

    Am I missing something?

    Code:
    class NewLink extends UTMutator;
    
    function bool CheckReplacement(Actor Other)
    {
    	local UTWeaponPickupFactory WF;
    
    	if (Other.IsA('UTWeap_LinkGun') && !Other.IsA('UTWeap_LinkGunNew'))
    	{
    		ReplaceWith(Other, "UTWeap_LinkGunNew");
    		
    		return true;
    	}
    	
    	WF = UTWeaponPickupFactory(Other);
    	if (WF != None && WF.WeaponPickupClass == class'UTWeap_LinkGun')
    	{
    		WF.WeaponPickupClass = class'UTWeap_LinkGunNew';
    	}
    	
    	return true;
    }
    
    DefaultProperties
    {
    	GroupNames[0]="WEAPONMOD"
    }
     
    Last edited: May 31, 2011
  2. DeathoX 8

    DeathoX 8 Beta Toaster

    Joined:
    Jan 20, 2008
    Messages:
    247
    Likes Received:
    0
    Found it out, it was missing a WF.InitializePickup() after WF.WeaponPickupClass = class'UTWeap_LinkGunNew';

    Thanks everybody for helping me out!
     

Share This Page