NewsUnrealEdFilesModsFragBULiandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 19th Nov 2009, 12:53 AM   #1
fronjohn
Registered User
 
fronjohn's Avatar
 
Join Date: Aug. 7th, 2008
Posts: 53
Unhappy Helping a friends Mutator Problem

Hey guys im trying to help a friend with his mutator and ive done deleting the things he wants me to take off, like MHMThighPads,MHMarmor2,MHMMedBoxes.
Its Because theres a mutator he likes but it replaces Thigh pads, but his mutator already replaces that which makes the other mutator unable to respawn the weapon, the mutator im talking about it Unreal Apache v2 is the one that wont respawn his is a MH mutator

Ive tryed the best i can, but it still replaces the thigh pads with MHM ones and wont respawn

Any help guys PLZ!!

Heres a code of the mutator, and some pics of the items he doesn't want from his mutator anymore

Code:
class MHMBase expands Mutator config(Kayhemv1);


var bool Initialized;
var int AmpCount;
var int kakuCount;
var int HealthCount;

var config bool EnableKayhem;
var config int AmpSpawnTime;
var config int TransSpawnTime;
var config int HealthAwardTime;
var config bool bUseRandomWeapon;
var config int HealthRegenPerSec;
var config int MaxHealth;
var config bool bUseRegenAmmo;
var config int AmmoInterval;    // One is really low interval so ammo loads fast Ten is slow twenty is dog slow
var config bool bUseRegenHealth;
var config bool bGiveArmor;
var config int MaxRegenHealth;
var config int HealthRegenPerKill;
var config bool bUseMHMTimer;
var config bool bUseMonsterHUD;
var config int DefaultHealth;
var config bool bUseAntiBoost;
var config bool bGhostCarcass;
var config String bServerInfo;

var string version;

var String MHMNaliFruit;
var String MHMMedBox;
var String MHMHealthPack;
var String MHMUnrealHealth;
var String MHMHealthVial;
var String MHMShieldBelt;
var String MHMUDamage;
var String MHMJumpBoots;


function PostBeginPlay()
{
        local string newhud;
	local class newclass;

	if (Initialized)
		return;

	if(CheckConfig())
	{// err
		return;
	}
	Log("*** ");
	Log("*** Kayhemv1 mutator is locked and loaded ");
	Log("*** ");


	Initialized = True;

	kakuCount = 0;
	HealthCount = 0;

	if(DefaultHealth < 1)
		DefaultHealth = 100;

	if(bUseMHMTimer)
		SetTimer(1, True);
	if(bUseMonsterHUD)
		Level.Game.HUDType = class'MHMHUD';
	Level.Game.RegisterDamageMutator(Self);

	TournamentGameInfo(Level.Game).GameName = (Level.Game.Default.GameName@" @"@bServerInfo);

	// fix mover
	fixmover();

	if ( NextMutator != None )
		NextMutator.PostBeginPlay();

}

function fixmover()
{
// light fix
	local mover M;
	foreach AllActors( class 'Mover', M)
	{
		if(M.bTriggerOnceOnly && M.MoverEncroachType == ME_ReturnWhenEncroach)
		{
			log("Fixed this mover to not crush players in the map:"@M.name);
			M.MoverEncroachType = ME_IgnoreWhenEncroach;
		}
	}
}

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

	if(Other.IsA('NaliFruit') && !Other.IsA('MHMNaliFruit'))
	{
			ReplaceWith(Other,MHMNaliFruit);
				return false;
	}
	if(Other.IsA('MedBox') && !Other.IsA('MHMMedBox'))
	{
			ReplaceWith(Other,MHMMedBox);
			return false;
	}
	if(Other.IsA('SuperHealth') || Other.IsA('HealthPack') && !Other.IsA('MHMHealthPack') && !Other.IsA('BHealthPack') && !Other.IsA('MHMUnrealHealth'))
	{
			ReplaceWith(Other,MHMHealthPack);
			return false;
	}
	if(Other.IsA('Health') && !Other.IsA('MHMHealthPack') && !Other.IsA('MHMUnrealHealth') && !Other.IsA('SuperHealth') && !Other.IsA('MHMNaliFruit'))
	{
			ReplaceWith(Other,MHMUnrealHealth);
			return false;
	}
	if(Other.IsA('HealthVial') && !Other.IsA('MHMHealthVial'))
	{
			ReplaceWith(Other,MHMHealthVial);
				return false;
	}
        if(Other.IsA('Carcass'))
        {
              if(bGhostCarcass)
              {
                        Other.Style = STY_Translucent;
                                return True;
              }
        }
	if(Other.IsA('Flashlight') && !Other.IsA('MHMlight'))
	{
			ReplaceWith(Other,"Kayhemv1.MHMlight");
				return false;
	}

	if(Other.IsA('JumpBoots') && !Other.IsA('MHMJumpBoots'))
	{
			ReplaceWith(Other,"Kayhemv1.MHMJumpboots");
				return false;
	}

	if(Other.IsA('UT_JumpBoots') && !Other.IsA('MHMJumpBoots'))
	{
	    if(InStr ( Level.Title, "Andromeda" ) == -1)  //Stupid hack to let the people play with the everlasting jump boots
                    {
                      ReplaceWith(Other,"Kayhemv1.MHMJumpBoots");
				return false;
                    }
        }

	if(Other.IsA('ShieldBelt') && !Other.IsA('MHMShieldBelt'))
	{
			ReplaceWith(Other,"Kayhemv1.MHMShieldBelt");
				return false;
	}
	
	if(Other.IsA('UT_ShieldBelt') && !Other.IsA('MHMShieldBelt'))
	{
			ReplaceWith(Other,"Kayhemv1.MHMShieldBelt");
				return false;
	}

	/*  Null this call. It's screwing up the amp award
        if(Other.IsA('UDamage') && !Other.IsA('MHMUDamage'))
	{
			ReplaceWith(Other,"Kayhemv1.MHMUDamage");
				return false;
	}
	*/
	if(Other.IsA('ThighPads') && !Other.IsA('MHMThighPads'))
	{
			ReplaceWith(Other,"Kayhemv1.MHMThighPads");
				return false;
	}

	if(Other.IsA('OLrifle'))
	{
			ReplaceWith(Other,"Botpack.SniperRifle");
				return false;
	}
	if(Other.IsA('Rifle'))
	{
			ReplaceWith(Other,"Botpack.SniperRifle");
				return false;
	}
	
        if(Other.IsA('QuadShot'))
	{
			ReplaceWith(Other,"SFC.SFC");
				return false;
	}
	
	if(Other.IsA('SCUBAgear') && !Other.IsA('MHMSCUBA') )
	{
			ReplaceWith(Other,"Kayhemv1.MHMSCUBA");
				return false;
	}

	if(Other.IsA('Armor2') && !Other.IsA('MHMArmor2'))
	{
			ReplaceWith(Other,"Kayhemv1.MHMArmor2");
				return false;
	}
	if(Other.IsA('TournamentHealth') && !Other.IsA('BP_Health') && !Other.IsA('MedBox') && !Other.IsA('HealthPack') && !Other.IsA('HealthVial') && !Other.IsA('MHMHealthPack') && !Other.IsA('MHMHealthVial') && !Other.IsA('MHMMedBox'))
	{
			ReplaceWith(Other,"BPSE.BP_Health"); // BPSE taiou.
				return false;
	}


  bSuperRelevant = 0;
  return true;
}


function GiveAmp(Pawn PlayerPawn)
{

	local UDamage damage;

	if( (PlayerPawn.FindInventoryType(class'UDamage') != None) ||
		(PlayerPawn.Health <= 0) )
		return;

	damage = spawn(class'UDamage',PlayerPawn,,PlayerPawn.Location);

	if( damage != None )
	{
		damage.RespawnTime = 0.0;
		damage.GiveTo(PlayerPawn);
		damage.Activate();
	}

}


function MutatorTakeDamage (out int ActualDamage,Pawn Victim,Pawn InstigatedBy,out Vector HitLocation,out Vector Momentum,name DamageType)
{
	local Pawn P;

	if(DamageType == 'Impact') // hammer x5 ii !
	{
	   ActualDamage *= 5;
	}

	if(bUseAntiBoost)
	{
		if(Victim != None && InstigatedBy != None)
		{
                   if (InstigatedBy.IsA('PlayerPawn') && Victim.IsA('PlayerPawn'))
	 	    {
			Momentum = Vect(0,0,0);
                        ActualDamage = 0;
		    }
		}
	}
	if ( NextDamageMutator != None )
		NextDamageMutator.MutatorTakeDamage(ActualDamage, Victim, InstigatedBy, HitLocation, Momentum, DamageType);

}
function ModifyPlayer(Pawn Other)
{
	local int randm;
	local inventory inv;


	if(!Other.IsA('TournamentPlayer'))return;
	 TournamentPlayer(Other).PlayerReplicationInfo.Team = 0; // kyouseitekini team 0


	Other.Health = DefaultHealth;
	

        DeathMatchPlus(Level.Game).GiveWeapon(Other,"Kayhemv1.MHTranslocator");

	// random weapon
	// ges,shock,pulse,ripper,mini,flak,rocket,sniper
	if (bUseRandomWeapon && Other.IsA('TournamentPlayer') ) // players only
	{
		randm = Rand(10);
		switch(randm)
		{
			case 0:
				GiveWeapon(Other,class'UT_Biorifle');
				//Other.Health += 100;
			break;
			case 1:
				GiveWeapon(Other,class'Shockrifle');
				//Other.Health += 50;
			break;
			case 2:
				GiveWeapon(Other,class'Pulsegun');
				//Other.Health += 80;
			break;
			case 3:
				GiveWeapon(Other,class'ripper');
				//Other.Health += 110;
			break;
			case 4:
				GiveWeapon(Other,class'minigun2');
				//Other.Health += 90;
			break;
			case 5:
				GiveWeapon(Other,class'SFC.SFC');
				//Other.Health += 30;
			break;
			case 6:
				GiveWeapon(Other,class'UT_EightBall');
				//Other.Health += 20;
			break;
			case 7:
				GiveWeapon(Other,class'SniperRifle');
				//Other.Health += 20;
			break;
			case 8:
				GiveWeapon(Other,class'SniperRifle');
				//Other.Health += 10;
			break;
			case 9:
				GiveWeapon(Other,class'ImpactHammer');
				//Other.Health += 400;
			break;
		}
		if(bGiveArmor)
		{
			inv = Spawn(class'Armor2');
			if( inv != None )
			{
				inv.bHeldItem = true;
				inv.RespawnTime = 0.0;
				inv.GiveTo(Other);
				inv.Charge = Inv.Default.Charge;
			}
		}
		Other.ReceiveLocalizedMessage( class'MHMGetWeaponMessage', randm, Other.PlayerReplicationInfo, Other.PlayerReplicationInfo );
	}

	if ( NextMutator != None )
		NextMutator.ModifyPlayer(Other);
}

function GiveWeapon(Pawn PlayerPawn, class<TournamentWeapon> WeaponClass )
{
	local Weapon NewWeapon;

	if( PlayerPawn.FindInventoryType(WeaponClass) != None )
		return;
	newWeapon = Spawn(WeaponClass);
	if( newWeapon != None )
	{
		newWeapon.RespawnTime = 0.0;
		newWeapon.GiveTo(PlayerPawn);
		newWeapon.bHeldItem = true;
		newWeapon.SetSwitchPriority(PlayerPawn);
		newWeapon.WeaponSet(PlayerPawn);
		newWeapon.AmbientGlow = 0;
		//if ( PlayerPawn.IsA('PlayerPawn') )
		//	newWeapon.SetHand(PlayerPawn(PlayerPawn).Handedness);
		//else
		//	newWeapon.GotoState('Idle');
		//PlayerPawn.Weapon.GotoState('DownWeapon');
		PlayerPawn.PendingWeapon = None;
		//PlayerPawn.Weapon = newWeapon;
		if ( !newWeapon.IsA('ImpactHammer') && !newWeapon.IsA('Translocator') ) {
			newWeapon.GiveAmmo(PlayerPawn);
			newWeapon.AmmoType.AmmoAmount = newWeapon.AmmoType.MaxAmmo/10;
		}
	}
}


function ScoreKill(Pawn Killer, Pawn Other)
{

//	BroadcastMessage("Killer"@Killer@" Other"@ Other);

	if(Killer == None)return; // sui
	if(!Killer.bIsHuman)return; // bot iran
	if(Killer.PlayerReplicationInfo.bIsABot) return; // bot irane-
	if(Killer.IsA('ScreptedPawn'))return;
	if(Killer.IsA('ScreptedPawn') && Other.IsA('ScreptedPawn'))return;
	if ( (Killer == None) && (Other == None) )return; // ?
	//BroadcastMessage("Killer"@Killer@" Other"@ Other);

	if ( Killer.bIsPlayer && Other.bIsPlayer )return; // tk

	if ( Other.Spree > 1 && Other.bIsPlayer)
		EndSpree(Killer, Other);
	if(Other.bIsPlayer)Other.Spree = 0;

		if ( (Killer != None) && Killer.bIsPlayer && (Killer != Other) )
		{
			//if(Killer.Health <= MaxHealth)Killer.Health += Rand(HealthRegenPerKill)+HealthRegenPerKillMin;
			if(Killer.Health <= MaxHealth)
                           {
                              Killer.Health += HealthRegenPerKill;
                           }
			if(Killer.Health > MaxHealth)          //New check for max health
                           {
                             Killer.Health = MaxHealth;
                           }
			Killer.Spree+=1;
			if ( Killer.Spree > 14 )
				NotifySpree(Killer, Killer.Spree);

			if ( (TournamentPlayer(Killer).Level.TimeSeconds - TournamentPlayer(Killer).LastKillTime < 3))
			{
				TournamentPlayer(Killer).MultiLevel++;
				if(TournamentPlayer(Killer).MultiLevel >= 41)TournamentPlayer(Killer).MultiLevel = 40;
				TournamentPlayer(Killer).ReceiveLocalizedMessage( class'MHMMultiKillMessage', TournamentPlayer(Killer).MultiLevel );
				CheckBroadCast(Killer,TournamentPlayer(Killer).MultiLevel);
			}
			else
				TournamentPlayer(Killer).MultiLevel = 0;

			TournamentPlayer(Killer).LastKillTime = TournamentPlayer(Killer).Level.TimeSeconds;
		}


	//Super.ScoreKill(Killer, Other);
}

function CheckBroadCast(Pawn Killer,int num)
{
	if(Killer.bIsPlayer && !Killer.PlayerReplicationInfo.bIsABot)
	BroadCastMessage(Killer.PlayerReplicationInfo.PlayerName@GetText(num));
}

function string GetText(int Switch)
{
	switch (Switch)
	{
		case 1:
			return " has Double Kill!";
			break;
		case 2:
			return " has Multi Kill!";
			break;
		case 3:
			return " has Mega Kill!";
			break;
		case 4:
			return " has ULTRA KILL!!";
			break;
		case 5:
			return " has M O N S T E R  K I L L !!!";
			break;
		case 6:
			return " has L U D I C R O U S  K I L L !!!!";
			break;
		case 7:
		case 8:
		case 9:
		case 10:
		case 11:
		case 12:
		case 13:
		case 14:
		case 15:
		case 16:
		case 17:
		case 18:
		case 19:
		case 20:
		case 21:
		case 22:
		case 23:
		case 24:
		case 25:
		case 26:
		case 27:
		case 28:
		case 29:
		case 30:
		case 31:
		case 32:
		case 33:
		case 34:
		case 35:
		case 36:
		case 37:
		case 38:
		case 39:
		        return " has H  O  L  Y   S  H  I  T !!!!!!!";
			break;
		case 40:
			return " is Y  A  R  I  S  U  G  I !!!!!!!!!!!";
			break;
	}
	return "";
}
function NotifySpree(Pawn Other, int num)
{
	local Pawn P;

	if ( num == 15 )
		num = 0;
	else if ( num == 35 )
		num = 1;
	else if ( num == 60 )
		num = 2;
	else if ( num == 90 )
		num = 3;
	else if ( num == 125 )
		num = 4;
	else if ( num == 250 )
		num = 5;
	else
		return;

	for ( P=Level.PawnList; P!=None; P=P.NextPawn )
		if ( P.IsA('TournamentPlayer') )
			P.ReceiveLocalizedMessage( class'MHMKillingSpreeMessage', Num, Other.PlayerReplicationInfo );
}


function EndSpree(Pawn Killer, Pawn Other)
{
	local Pawn P;
// koko kurunoka wakaran(lo
//	BroadcastMessage("Endspree Killer"@Killer@" Other"@ Other);
	if ( !Other.bIsPlayer || Killer.PlayerReplicationInfo.bIsABot)
		return;
	for ( P=Level.PawnList; P!=None; P=P.NextPawn )
	if ( P.IsA('TournamentPlayer') )
	{
		if(Other.IsA('ScriptedPawn'))
			P.ReceiveLocalizedMessage( class'MHMKillingSpreeMessage', Other.Spree, Killer.PlayerReplicationInfo,  Killer.PlayerReplicationInfo );
		else // pk end
			P.ReceiveLocalizedMessage( class'MHMKillingSpreeMessage', Other.Spree, Killer.PlayerReplicationInfo, Other.PlayerReplicationInfo );

	}
}

function Timer()
{

	// regenerate ammo (except redeemer) & health in one fell swoop
	local Pawn P;
	local Inventory Inv;

	if (AmpCount < AmpSpawnTime)AmpCount++;

	else if (AmpCount == AmpSpawnTime) 
        {

		BroadcastLocalizedMessage( class'UTJMHAmpMessage',,, None, None );

		// give all current players damage amps
		for ( P=Level.PawnList; P!=None; P=P.NextPawn )
			if ( P.IsA('Bot')  || P.IsA('TournamentPlayer'))
				GiveAmp(P);

		AmpCount = 0;
	}

	for ( P=Level.PawnList; P!=None; P=P.NextPawn )
		if ( P.IsA('Bot')  || P.IsA('TournamentPlayer')) 
                {

			if (P.Health > 0)
                        {

				// ammo
				if(bUseRegenAmmo)
				{
				for( Inv=P.Inventory; Inv!=None; Inv=Inv.Inventory )
					if ( (Ammo(Inv)!=None) && (P.bFire==0) && (P.bAltFire==0) )
						if (Ammo(Inv).AmmoAmount < Ammo(Inv).MaxAmmo * 10) {
							Ammo(Inv).AmmoAmount += (Ammo(Inv).Default.AmmoAmount/ AmmoInterval);
							if (Ammo(Inv).AmmoAmount > Ammo(Inv).MaxAmmo * 10)
								Ammo(Inv).AmmoAmount = Ammo(Inv).MaxAmmo * 10;
						}
				}

				if(bUseRegenHealth)
				{
				// health
				if ( P.Health < MaxRegenHealth && !P.Region.Zone.bWaterZone)       // waterzone stoppage of health regen
					//P.Health = FMin(MaxRegenHealth, P.Health + Rand(HealthRegenPerSec)+HealthRegenPerSecMin);
					P.Health = FMin(MaxRegenHealth, P.Health + HealthRegenPerSec);
				}

			}

               }

 //random Trans & health

    P = GetRandomPlayer();
    if(P != None)
    {
        if (kakuCount < TransSpawnTime)kakuCount ++;
  	if (HealthCount < HealthAwardTime)HealthCount ++;

        if(TransSpawnTime-kakuCount < 5 &&  TransSpawnTime-kakuCount > 0)
        {
         BroadcastLocalizedMessage(class'MHMRandomTransMsg',TransSpawnTime-kakuCount,P.PlayerReplicationInfo  );
        }

	if(HealthAwardTime-HealthCount < 5 && HealthAwardTime-HealthCount > 0)
	{
   	 BroadcastLocalizedMessage(class'MHMRandomHealthMsg',HealthAwardTime-HealthCount,P.PlayerReplicationInfo  );
   	}


        if (kakuCount >= TransSpawnTime)
        {
   	     kakuCount = 0;
             P = GetRandomPlayer();
             if(P.bIsPlayer)
             {
               BroadcastLocalizedMessage(class'MHMRandomTransMsg',kakuCount,P.PlayerReplicationInfo  );
               GiveTranslocator(P);
             }
        }

        if (HealthCount >= HealthAwardTime)
        {
	     HealthCount = 0;
             P = GetRandomPlayer();
             if(P.bIsPlayer)
             {
               BroadcastLocalizedMessage(class'MHMRandomHealthMsg',HealthCount,P.PlayerReplicationInfo  );
               GiveHealth(P);
             }
	}

    }

}

function GiveTranslocator(Pawn PlayerPawn)
{

	local Warheadlauncher  rede;
	rede= spawn(class'Warheadlauncher');

	if( rede!= None )
	{
        rede.RespawnTime = 0.0;
        rede.GiveTo(PlayerPawn);
        rede.SetSwitchPriority(PlayerPawn);

//      rede.Instigator = PlayerPawn;
//      rede.BecomeItem();
		PlayerPawn.AddInventory(rede);
//      rede.BringUp();
        rede.PickupAmmoCount = 1;
		rede.GiveAmmo(PlayerPawn);

	}

}


function GiveHealth(Pawn PlayerPawn)
{

	PlayerPawn.Health+=500;
}

function Pawn GetRandomPlayer() {
  local Pawn N;
  local PlayerPawn Dest;
  local Pawn Candidate[32];
  local int num;

  for (N=Level.PawnList; N!=None; N=N.NextPawn) {
    Dest=PlayerPawn(N);
    if (Dest!=None && Dest.bIsPlayer && !Dest.PlayerReplicationInfo.bIsSpectator) {
      if (num<32) Candidate[num] = Dest;
      else if (Rand(num) < 32) Candidate[Rand(32)] = Dest;
      num++;
    }
  }

  if(num==0) return None;
  return Candidate[Rand(Min(32,num))];
}

function bool CheckConfig()
{
	if(!EnableKayhem)return true;
	Log("---  Config  ---");
	Log("---  AmpSpawnTime ="@AmpSpawnTime);
	Log("---  TransSpawnTime ="@TransSpawnTime);
	Log("---  HealthAwardTime ="@HealthAwardTime);
	if(bUseRandomWeapon)
		Log("---  UseRandomWeapon");
	Log("---  HealthRegenPerSec ="@HealthRegenPerSec);
	Log("---  MaxHealth ="@MaxHealth);
	if(bUseRegenAmmo)
		Log("---  UseRegenAmmo");
	if(bUseRegenHealth)
		Log("---  UseRegenHealth");
	if(bGiveArmor)
		Log("---  UseGiveArmor");
	Log("---  MaxRegenHealth ="@MaxRegenHealth);
	Log("---  HealthRegenPerKill ="@HealthRegenPerKill);

	if(bUseMHMTimer)
		Log("---  UseMHMTimer(UseRandomTrans..etc)");

	if(bUseAntiBoost)
		Log("---  AntiBoost is on");
	else
		Log("---  AntiBoost is off");

	return false;
}
Super Health(MHM)
http://fronjohn.webs.com/Shot0061X.bmp
Health Pack(MHM)
http://fronjohn.webs.com/Shot0062X.bmp
Amour2(MHM)
http://fronjohn.webs.com/Shot0063X.bmp
Thigh Pads(MHM)
http://fronjohn.webs.com/Shot0064X.bmp

The ones with (MHM) are the ones that need to be changed to the old UT default ones.

Please Help , or at least try to help
P.S: my grammer sucks but its the best i can do

Last edited by Wormbo; 19th Nov 2009 at 08:56 AM. Reason: don't post BMPs, you're making my internet connection cry!
fronjohn is offline   Reply With Quote
Old 19th Nov 2009, 08:59 AM   #2
Wormbo
Wormlike
 
Wormbo's Avatar
 
Join Date: Jun. 4th, 2001
Location: Quedlinburg, Germany
Posts: 4,307
Quote:
Originally Posted by fronjohn View Post
Ive tryed the best i can, but it still replaces the thigh pads with MHM ones and wont respawn
Of course it does. The replacement code ("IsA('ThighPads') ...") is still there. Same goes for the other items you want to remove.
__________________
Wormbo's UT/UT2004/UT3 mods | PlanetJailbreak | Unreal Wiki | Liandri Archives

<elmuerte> you shouldn't do all-nighters, it's a waste of time and effort
<TNSe> nono
<TNSe> its always funny to find code a week later you dont even remember writing
<Pfhoenix> what's worse is when you have a Star Wars moment
<Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!"
Wormbo is offline   Reply With Quote
Old 19th Nov 2009, 04:49 PM   #3
fronjohn
Registered User
 
fronjohn's Avatar
 
Join Date: Aug. 7th, 2008
Posts: 53
so i should remove the item names with IsA and compile it?
fronjohn is offline   Reply With Quote
Old 19th Nov 2009, 06:13 PM   #4
Azura
Now with 85.26% less nonsense
 
Azura's Avatar
 
Join Date: Jul. 8th, 2002
Posts: 9,511
You need to modify/remove blocks that are replacing the default items in CheckReplacement, like this one:

Code:
	if(Other.IsA('ThighPads') && !Other.IsA('MHMThighPads'))
	{
			ReplaceWith(Other,"Kayhemv1.MHMThighPads");
				return false;
	}
It might also be interesting to have a look at what AlwaysKeep does depending on what you want to achieve.

P.S: Ideally, each mutator should be designed so it can coexist with others.
__________________

(Hosted at imageshag so sig might not display) - Neonite rocks

Last edited by Azura; 19th Nov 2009 at 06:15 PM.
Azura is offline   Reply With Quote
Old 19th Nov 2009, 08:57 PM   #5
War_Master
Registered User
 
Join Date: May. 27th, 2005
Posts: 559
When you use Other.IsA it will replace all the subclasses of the class mentioned which in this case it will replace the ThighPads and its subclasses with your class.

I always prevent that whenever I make a replacement mutator so that it is compatible with other mods. Instead of replacing the class and its subclasses just replace that class only by using Other.Class==Class'ThighPads'. This problem happens with weapon mods a lot and is much better to just replace the specific class and prevent replacing subclasses of that class from other mods.

example:

Code:
	if(Other.Class==Class'ThighPads')
	{
			ReplaceWith(Other,"Kayhemv1.MHMThighPads");
				return false;
	}
This way you don't need "&& !Other.IsA('MHMThighPads')" because the subclasses are not being replaced...

Last edited by War_Master; 19th Nov 2009 at 08:58 PM.
War_Master is offline   Reply With Quote
Old 19th Nov 2009, 09:38 PM   #6
Azura
Now with 85.26% less nonsense
 
Azura's Avatar
 
Join Date: Jul. 8th, 2002
Posts: 9,511
Good stuff War_Master. You should post that somewhere on the unrealwiki. From memory, I'd say IsA() also returns true for subclasses which would produce a runaway iteration error or some other failsafe ut1 has.
__________________

(Hosted at imageshag so sig might not display) - Neonite rocks

Last edited by Azura; 19th Nov 2009 at 09:46 PM.
Azura is offline   Reply With Quote
Old 20th Nov 2009, 09:45 PM   #7
fronjohn
Registered User
 
fronjohn's Avatar
 
Join Date: Aug. 7th, 2008
Posts: 53
um thanks but its still replaced i even copied your example War Master, compiled but still replaced, the mutator also includes the Items in like a pack with the mutator ,should i take em of the package? if u guys can tell me how to remove an actor off from its package as well
fronjohn is offline   Reply With Quote
Old 21st Nov 2009, 01:13 AM   #8
Azura
Now with 85.26% less nonsense
 
Azura's Avatar
 
Join Date: Jul. 8th, 2002
Posts: 9,511
The code hasn't been changed at all and still replaces items. It would be best if you understood what the code is doing since it's likely we're going to be doing the task for you otherwise. Here's a link to the UnrealWiki.

http://wiki.beyondunreal.com/
__________________

(Hosted at imageshag so sig might not display) - Neonite rocks

Last edited by Azura; 21st Nov 2009 at 01:16 AM.
Azura is offline   Reply With Quote
Old 21st Nov 2009, 07:40 AM   #9
War_Master
Registered User
 
Join Date: May. 27th, 2005
Posts: 559
Here's the script of the UnrealApachev2 replacement mutator.

Code:
class UnrealApacheMutator extends Mutator;

var() config bool ReplaceRedeemer;
var() config bool ReplaceThighPads;
var() config bool ReplaceBodyArmor;
var() config bool ReplaceAntiGravBoots;

var bool retval;

function bool alwaysKeep(Actor Suspect) {
	if (Suspect.IsA('UnrealApacheSpawn')) {
		return true;
	}

	return super.alwaysKeep(Suspect);
}

function bool checkReplacement(Actor Suspect, out byte bSuperRelevant) {

	retval = true;

	if (Suspect.isA('WarHeadLauncher') && !Suspect.isA('UnrealApacheSpawn') && replaceRedeemer ) {
		replaceWith(Suspect, "UnrealApacheV2.UnrealApacheSpawn");
		retval = false;
	}
	if (Suspect.isA('ThighPads') && !Suspect.isA('UnrealApacheSpawn') && replaceThighPads ) {
		replaceWith(Suspect, "UnrealApacheV2.UnrealApacheSpawn");
		retval = false;
	}
	if (Suspect.isA('Armor2') && !Suspect.isA('UnrealApacheSpawn') && replaceBodyArmor ) {
		replaceWith(Suspect, "UnrealApacheV2.UnrealApacheSpawn");
		retval = false;
	}
	if (Suspect.isA('UT_JumpBoots') && !Suspect.isA('UnrealApacheSpawn') && replaceAntiGravBoots ) {
		replaceWith(Suspect, "UnrealApacheV2.UnrealApacheSpawn");
		retval = false;
	}

	return retval;
}
The mutator uses the IsA function which will replace all subclasses of the thighpads. In this case, your friend's MHMthighpads might be a subclass of UT's ThighPads and will get replaced by that mutator as well. If you read the UnrealApacheMutator script closely you will see that those items replacement are optional in its ini file. All you have to do is set replaceThighPads to false so that it doesnt replace the ThighPads, other mods like your friend's will be able to replace it fine this way.

Last edited by War_Master; 21st Nov 2009 at 07:42 AM.
War_Master is offline   Reply With Quote
Old 2nd Jan 2010, 09:52 PM   #10
gopostal
Registered User
 
Join Date: Jan. 19th, 2006
Posts: 67
That's a very interesting fix to the code WarMaster. Well done! I'm the original author of that code (the Kayhem addition to the UTJ base stuff), and I apologize for the mixing of the naming in it. I had adjusted an existing mod for a server (MHM) and changed it to work with what the new server owner wanted in Kayhem.
I indeed did struggle with how to fix that replacement because I could forsee Other.IsA causing problems just like what happened with the Apache. Thanks for the fix, I'll add that to the update. I just upped a v2 of Kayhem for the admin and all the class names are corrected. Damn, I wish I'd have read this two days ago.

BTW John, if you want the source stuff PM me. It will be a lot easier than decompiling.

Last edited by gopostal; 2nd Jan 2010 at 09:57 PM.
gopostal is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:23 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Copyright ©1998 - 2009, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by ITXen