In my weapons mod I need to change the weapons in the weapon rack. However, some weapons don't change in all weapons rack (like the rocket launcher replacement), or none of them at all (like the minigun replacement), while others do just fine. I tried different things, double-double-checked the names were right, verified for access nones, none present. Anyone know what could I be doing wrong? Here is the code for replacing them:
I also have the regular weapon replacement code here, which works #1 by the way. Note that before I put the regular weapon replacement code after the weapon rack replacement code, and everything was changing ok. However I was getting an insane amount of access nones, so after figuring out what was wrong I put it before it.
Code:
local int i;
local WeaponLocker L;
if ( xWeaponBase(Other) != None )
{
if ( xWeaponBase(Other).WeaponType == class'XWeapons.AssaultRifle' )
xWeaponBase(Other).WeaponType = class'SWX.RPAR';
else if ( xWeaponBase(Other).WeaponType == class'XWeapons.BioRifle' )
xWeaponBase(Other).WeaponType = class'SWX.MG';
else if ( xWeaponBase(Other).WeaponType == class'XWeapons.LinkGun' )
xWeaponBase(Other).WeaponType = class'SWX.BWGX';
else if ( xWeaponBase(Other).WeaponType == class'XWeapons.RocketLauncher' )
xWeaponBase(Other).WeaponType = class'SWX.SRLX';
else if ( xWeaponBase(Other).WeaponType == class'XWeapons.FlakCannon' )
xWeaponBase(Other).WeaponType = class'SWX.SFCX';
else if ( xWeaponBase(Other).WeaponType == class'XWeapons.Minigun' )
xWeaponBase(Other).WeaponType = class'SWX.SWGG';
else if ( xWeaponBase(Other).WeaponType == class'XWeapons.SniperRifle'
|| xWeaponBase(Other).WeaponType == class'UTClassic.ClassicSniperRifle')
xWeaponBase(Other).WeaponType = class'SWX.RPSR';
else
return true;
}
else if (WeaponLocker(Other) != none )
{
L = WeaponLocker(Other);
for (i = 0; i < L.Weapons.Length; i++)
{
if ( L.Weapons[i].WeaponClass == class'xWeapons.AssaultRifle' )
L.Weapons[i].WeaponClass = class'SWX.RPAR';
else if ( L.Weapons[i].WeaponClass == class'xWeapons.Minigun' )
L.Weapons[i].WeaponClass = class'SWX.SWGG';
else if ( L.Weapons[i].WeaponClass == class'xWeapons.BioRifle' )
L.Weapons[i].WeaponClass = class'SWX.MG';
else if ( L.Weapons[i].WeaponClass == class'xWeapons.LinkGun' )
L.Weapons[i].WeaponClass = class'SWX.BWGX';
else if ( L.Weapons[i].WeaponClass == class'xWeapons.RocketLauncher' )
L.Weapons[i].WeaponClass = class'SWX.SRLX';
else if ( L.Weapons[i].WeaponClass == class'xWeapons.FlakCannon' )
L.Weapons[i].WeaponClass = class'SWX.SFCX';
else if ( L.Weapons[i].WeaponClass == class'xWeapons.SniperRifle'
|| L.Weapons[i].WeaponClass == class'ClassicSniperRifle' )
L.Weapons[i].WeaponClass = class'SWX.RPSR';
else
return true;
}
}
I also have the regular weapon replacement code here, which works #1 by the way. Note that before I put the regular weapon replacement code after the weapon rack replacement code, and everything was changing ok. However I was getting an insane amount of access nones, so after figuring out what was wrong I put it before it.
Last edited: