noob with problem compiling weapon mutator

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

Jeffez

New Member
Aug 24, 2005
6
0
0
I'm new to Uscript and i've been trying to make a weapon mutator. I've followed some different tutorials, but i keep getting the same compile error.

The compiler doesn't like the expression in this if statement in CheckReplacement
Code:
if (XWeaponsBase(Other) != None)
I found out from the compiler errors page that it might be because 'Other' is Non-existing, but i cant see how. Is there something wrong with the 'XWeaponsBase' class name?

Can anyone help me out here?
 

rich_zap

New Member
Jul 18, 2004
133
0
0
Dissapearing into the fog !
Code:
function bool CheckReplacement (Actor Other,out byte bSuperRelevant)

The line you specified should be within the checkreplacement function like this, as long as you have actor Other inside the first variable it should work fine. I think we would need to see the rest of the mutator to be able to help further.
 

Jeffez

New Member
Aug 24, 2005
6
0
0
hey thanks for quick the reply:)
Ok heres the rest of the code of the mutator.

Code:
class MutUberLinkGun extends Mutator;

function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{

   local int i;                // for UT2004 Onslaught weapon lockers
   local WeaponLocker L;       // for UT2004 Onslaught weapon lockers

   bSuperRelevant = 0;

   if (XWeaponsBase(Other) != None) 
   {
      if (XWeaponsBase(Other).WeaponType == Class'XWeapons.LinkGun') 
         XWeaponsBase(Other).WeaponType = Class'XWeapons.UberLinkGun'; 
      else 
         return true;  
   }  
   else if (WeaponPickup(Other) != None) 
   { 
   if (String(Other.Class) ~= "XWeapons.LinkGun") 
         ReplaceWith(Other, "XWeapons.UberLinkGun");
      else 
         return true; 
   }
   else if ( WeaponLocker(Other) != None )
   {
      L = WeaponLocker(Other);
      for (i = 0; i < L.Weapons.Length; i++)
         if ( string( L.Weapons[i].WeaponClass ) ~= "XWeapons.LinkGun" )
            L.Weapons[i].WeaponClass = Class'XWeapons.UberLinkGun';

      return true;
   }
   else 
      return true;

   return false;
}

defaultproperties 
{ 
   FriendlyName="UberLinkGunMutator" 
   Description="This makes the link guns fire rockets." 
}