clientside hitsound for MH2

Discussions about Coding and Scripting
Letylove49
Adept
Posts: 395
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

clientside hitsound for MH2

Post by Letylove49 »

hi i got this error when i want to compile : Log: Compiling MH2Base
Error: D:\UT coding\UnrealTournament\MH2GoldCTGv2c\Classes\MH2Base.uc(661) : Error, 'Function' is not allowed here
Critical: appError called:
Critical: Failed due to errors.
Exit: Executing UObject::StaticShutdownAfterError Why i have this error ?

i put the original fonction and what i have done :

Code: Select all

 if(bHitsounds)
   {
  
      if(Victim != None && InstigatedBy != None)
      {
         if ( InstigatedBy.IsA('PlayerPawn') && (Victim != InstigatedBy) )
         {
            if( Victim.IsA('PlayerPawn') || Victim.IsA('Bot') )  // When player shoot other player
            {
	       PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_None, teamHitVolume, false);
	       PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_Interface, teamHitVolume, false);
	       PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_Interact, teamHitVolume, false);
            }
            if( Victim.IsA('ScriptedPawn') )  // When player shoots a monster
            {   	// Cows and rabbits are friends
	       if(Victim.IsA('Cow')|| Victim.IsA('BabyCow')|| Victim.IsA('NaliRabbit'))
               {
                  PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_None, teamHitVolume, false);
	          PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_Interface, teamHitVolume, false);
	          PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_Interact, teamHitVolume, false);
	       }
               else // ScriptedPawn is an enemy
	       {

	       }
            }
         }
      }
   }
   
   // play hitsount client side only    18.04.2025
   simulated function  ClientPlaySound(sound Asound,optional bool binterrupt, optionnal bool BVolumeControl)
   
   {
                 PlayerPawn(InstigatedBy).ClientPlaySound(Sound'HitsoundEnemy', SLOT_None, ClientHitVolume, false);
	         PlayerPawn(InstigatedBy).ClientPlaySound(Sound'HitsoundEnemy', SLOT_Interface, ClientHitVolume, false);
	        PlayerPawn(InstigatedBy).clientPlaySound(Sound'HitsoundEnemy', SLOT_Interact, ClientHitVolume, false);
	        
	        }
Image

Letylove49 aka Alicia
User avatar
yurkapotam
Average
Posts: 37
Joined: Wed Jul 19, 2023 4:21 pm

Re: clientside hitsound for MH2

Post by yurkapotam »

post the full source code of the file
:barf:
Letylove49
Adept
Posts: 395
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: clientside hitsound for MH2

Post by Letylove49 »

ok the class MH2Base:

Code: Select all

class MH2Base expands Mutator config(MH2GoldCTGv2c);

#exec AUDIO IMPORT FILE="Sounds\HitsoundEnemy.wav" NAME="HitsoundEnemy" GROUP="QFeedback"
#exec AUDIO IMPORT FILE="Sounds\QFeedbackArmourWav.wav" NAME="QFeedbackArmourWav" GROUP="QFeedback"
#exec AUDIO IMPORT FILE="Sounds\HitsoundTeam.wav" NAME="HitsoundTeam" GROUP="QFeedback"
#exec obj load file=..\System\SBInvulnerabilityv3.u  Package=SBInvulnerabilityv3
#exec obj load file=..\System\CoopTranslocator12.u Packages=CoopTranslocator12

//Setup
var bool Initialized;
var int AmpCount;
var int kakuCount;
var int invulnerabilityCount;
var int HealthCount;
var bool bFirstBlood;
var config String bServerInfo;
var float LastMonsterAttackTime;
var bool bHaveQueenDests;
var config bool AdjustFactories;
var config int bCapacity;
var config bool ChangeCovertToFalse;


//Awards
var config int AmpSpawnTime;
var config int DeemerSpawnTime;
var config int HealthAwardTime;
var config int invulnerabilityRespawnTime;
var config int invulnerabilityCharges;
var config bool bGiveArmor;

//Weapons and Ammo
var config bool bUseRandomWeapon;
var config bool bUseRegenAmmo;
var config int AmmoInterval;
var Config int  Ammoregenfactor ;
var Config bool GiveSniper;
var config bool GiveHealingGun;
var config bool GiveAllWeapons;
var config bool Use2k4Deemer;
var config bool UseAltSniper;
var config bool UseMH2Enforcer;
var config bool UseMH2BioRifle;
var config bool UseMH2ShockRifle;
var config bool UseMH2SuperShockrifle;
var config bool useMH2Ripper;
var config bool UseMH2PulseGun;
var config bool UseMH2Minigun2;
var config bool UseMH2FlakCannon;
var config bool UseMH2Eightball;




// 24.11.2023

var config bool UseSuperShockRifle;
var config bool GiveMHTranslocator;
var config bool GiveCoopTranslocator;
//19.05.2023
var config bool UseHammer;


//Health regen
var config int DefaultHealth;
var config int HealthRegenPerSec;
var config int MaxHealth;
var config bool bUseRegenHealth;
var config int MaxRegenHealth;
var config int HealthRegenPerKill;


//Admin options and various settings
var config bool bUseAntiBoost;
var config bool bGhostCarcass;
var config bool bHitsounds;
var config bool bAltScoring;
var config bool bCheckMonsterAttack;
var config bool stopPlayerCollision;
var config bool ReplaceInvis;
var config float HitVolume;
var config float teamHitVolume;
var config bool bVolumeControl;
var config bool bInterrupt;
var config float ClientHitvolume;
var config bool VisibleMonsterEnds;
var config float retainScoreOnDeathPercent;
var config bool bDropWeaponsOnDeath;
var config bool UseMHTranslocator;
var config bool bUseInvulnerability;
var config bool UseLimeLight;
var config bool UseServerStats;
var config bool UseMH2JumpBoots;
var config int MaxDamage;




var config float FriendlyFireSelfDamageRatio;

// 19.05.2023
var config bool bBrodcastMultikill;


//Mutate commands
var config string CommandOpen;
var config string CommandClose;
var config string HealGunSummon;

var String MH2NaliFruit;
var String MH2MedBox;
var String MH2HealthPack;
var String MH2UnrealHealth;
var String MH2HealthVial;
var String MH2ShieldBelt;
var String MH2UDamage;
var String MH2JumpBoots;


//Double Jump
var config bool DoubleJump;
var config int maxJumps;
var config int jumpType;
var config float jumpHeight;

//Spawn protection
var() globalconfig bool bUseSpawnProt;
var() globalconfig int SpawnProtDuration;

//Mover fix
var config bool bFixCrushingMover;

function PreBeginPlay()
{
   local NavigationPoint NP;

      if ( Initialized )
         return;

   Super.PreBeginPlay();

   if(UseServerStats)
      Level.Game.BaseMutator.AddMutator(Level.Spawn(class'Stats'));

   NP = Level.NavigationPointList;

   while (!bHaveQueenDests && NP != None) // Check to see if the queen needs a fix
   {
      if (QueenDest(NP) != None)
         bHaveQueenDests = True;

      NP = NP.nextNavigationPoint;
   }

   if ( NextMutator != None )
      NextMutator.PreBeginPlay();
}



function PostBeginPlay()
{
   local string newhud;
   local class newclass;
   local NavigationPoint NP;
   local MonsterEnd ME;
   local ScriptedPawn S;
   local MonsterWaypoint MW;

   if (Initialized)
      return;

   Log("*** MH2GoldCTGv2 Gametype and Mutator is loaded ");

   Initialized = True;
   kakuCount = 0;
   HealthCount = 0;

   if(DefaultHealth < 1)
      DefaultHealth = 100;

   SetTimer(1, True);

   if(Level.Game.HUDType !=none)
      Level.Game.HUDType = class'MH2HUD';

   if(Level.Game.ScoreBoardType !=none)
   {
      if(UseServerStats)
         Level.Game.ScoreBoardType=Class'MH2ScoreBoard1';
      else
         Level.Game.ScoreBoardType=Class'MH2ScoreBoard';
   }

   Level.Game.RegisterDamageMutator(Spawn(class'SpawnProt'));
   Level.Game.RegisterDamageMutator(Self);
   // $Note: Needed to register MH2Base as message mutator.
   Level.Game.RegisterMessageMutator(Self);

   TournamentGameInfo(Level.Game).GameName = bServerInfo;

   fixmover();

   if(VisibleMonsterEnds) fixmymonsterend();

   if(AdjustFactories) CheckFactories();

   foreach AllActors(class'MonsterWaypoint', MW)
      MW.Destroy();

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

function CheckFactories()
{
   local CreatureFactory C;
   local ThingFactory T;

   foreach AllActors( class 'CreatureFactory', C)
   {
      if(C !=none)
      {
         if(C.Capacity < 0)
            C.Capacity=bCapacity;
         else if (C.Capacity > bCapacity)
            C.Capacity=bCapacity;
         if(ChangeCovertToFalse)
            if(C.bCovert==True)
               C.bCovert=False;
      }
   }
   foreach AllActors( class 'ThingFactory', T)
   {
      if(T !=none)
      {
         if(T.Capacity < 0)
            T.Capacity=bCapacity;
         else if (T.Capacity > bCapacity)
            T.Capacity=bCapacity;
         if(ChangeCovertToFalse)
            if(T.bCovert==True)
               T.bCovert=False;
      }
   }
}

function fixmover()
{
   local mover M;
   foreach AllActors( class 'Mover', M)
   {
      if(bFixCrushingMover)
      {
         if(M.bTriggerOnceOnly && M.MoverEncroachType == ME_ReturnWhenEncroach)
	    M.MoverEncroachType = ME_IgnoreWhenEncroach;
      }
      if(M.bUseTriggered == True)
	 M.bUseTriggered = False;
   }
}

function fixmymonsterend()
{
   local MonsterEnd T;

   foreach AllActors( class 'MonsterEnd', T)
   {
      if(T.bHidden == True)
         T.bHidden = False;
   }
}

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
   if (Other.isA('Weapon') && Other.Instigator != None && Other.Instigator.IsA('ScriptedPawn'))
   {
      return true;
   }
   if(Other.IsA('Pickup'))
   {
      Pickup(Other).bAutoActivate=True;
   }
   if(Other.Class==Class'NaliFruit')
   {
      ReplaceWith(Other,MH2NaliFruit);
      return false;
   }
   if(Other.Class==Class'Bandages')
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2Bandages");
      return false;
   }
   if(Other.Class==Class'Health')
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2U1Health");
      return false;
   }
   if(Other.Class==Class'SuperHealth')
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2SuperHealth");
      return false;
   }
   if(Other.Class==Class'MedBox')
   {
      ReplaceWith(Other,MH2MedBox);
      return false;
   }
   if(Other.Class==Class'HealthPack')
   {
      ReplaceWith(Other,MH2HealthPack);
      return false;
   }
   if(Other.Class==Class'HealthVial')
   {
      ReplaceWith(Other,MH2HealthVial);
      return false;
   }
   if(Other.Class==Class'ShieldBelt')
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2U1ShieldBelt");
      return false;
   }
   if(Other.Class==Class'PowerShield')
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2U1ShieldBelt");
      return false;
   }
   if(Other.Class==Class'UT_ShieldBelt')
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2ShieldBelt");
      return false;
   }
   if(Other.Class==Class'ThighPads')
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2ThighPads");
      return false;
   }
   if(Other.Class==Class'Armor2')
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2Armor2");
      return false;
   }
   if(UseLimeLight)
   {
      if(Other.IsA('Flashlight') && !Other.IsA('LimeLight'))
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.LimeLight");
	 return false;
      }
   }
   if(UseMH2JumpBoots)
   {
      if(Other.IsA('JumpBoots') && !Other.IsA('MH2JumpBoots'))
      {
      	 ReplaceWith(Other,"MH2GoldCTGv2c.MH2JumpBoots");
         return false;
      }
   }
   if(Other.IsA('UT_JumpBoots') && !Other.IsA('MH2JumpBoots'))
   {
      if(InStr ( Level.Title, "Andromeda" ) == -1)  //Stupid hack to let the people play with the everlasting jump boots
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2JumpBoots");
         return false;
      }
   }
   if(ReplaceInvis)
   {
      if(Other.Class==Class'Invisibility')
      {
         ReplaceWith(Other,MH2MedBox);
         return false;
      }
   }
   if(Other.Class==Class'SCUBAgear')
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2Scuba");
      return false;
   }
   if(Other.IsA('Carcass'))
   {
      if(bGhostCarcass)
      {
         Other.Style = STY_Translucent;
            Other.SetCollision(False);
         return True;
      }
   }
   if (Other.Class==Class'BiterFishSchool')
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2BiterFishSchool");
      return False;
   }
   if(Other.Class==Class'QuadShot') //Quad has buggy graphics
   {
      ReplaceWith(Other,"MH2GoldCTGv2c.MH2FlakCannon");
      return false;
   }
   if(Use2k4Deemer)
   {
      if(Other.Class==Class'WarHeadLauncher')
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2WarheadLauncher");
         return false;
      }
   }

  if(UseMH2Enforcer)
   {
      if(Other.Class==Class'Enforcer')
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2Enforcer");
         return false;
      }
   }
   
   
     if(UseMH2BioRifle)
   {
      if(Other.Class==Class'UT_BioRifle')
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2Biorifle");
         return false;
      }
   }
   
   
   if(UseMH2ShockRifle)
   {
      if(Other.Class==Class'ShockRifle')
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2ShockRifle");
         return false;
      }
   }
   
   
   if(UseMH2SupershockRifle)
   {
      if(Other.Class==Class'SuperShockRifle')
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2SuperShockRifle");
         return false;
      }
   }
   
      if(UseMH2PulseGun)
   {
      if(Other.Class==Class'PulseGun')
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2PulseGun");
         return false;
      }
   }
   
      if(UseMH2Ripper)
   {
      if(Other.Class==Class'Ripper')
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2Ripper");
         return false;
      }
   }
   
         if(UseMH2Minigun2)
   {
      if(Other.Class==Class'Minigun2')
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2Minigun2");
         return false;
      }
   }

      
      if(UseMH2FlakCannon)
   {
      if(Other.Class==Class'UT_FlakCannon')
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2FlakCannon");
         return false;
      }
   }
      
      if(UseMH2Eightball)
   {
      if(Other.Class==Class'UT_Eightball')
      {
         ReplaceWith(Other,"MH2GoldCTGv2c.MH2Eightball");
         return false;
      }
      
   }


   if ( Other.IsA('Weapon') )
   {
      if ( Other.IsA('TournamentWeapon') )
      return true;
      if ( Other.IsA('UIWeapon') )
      return true;
      if(Other.Class==Class'Stinger')
      {
         ReplaceWith(Other, "MonsterHunt.OLStinger");
         return false;
      }
      if(Other.Class==Class'Rifle')
      {
         ReplaceWith( Other, "MonsterHunt.OLRifle" );
         Return false;
      }
      if(Other.Class==Class'Razorjack')
      {
         ReplaceWith(Other, "MonsterHunt.OLRazorjack");
         Return false;
      }

      if(Other.Class==Class'Minigun')
      {
         ReplaceWith( Other, "MonsterHunt.OLMinigun" );
         return false;
      }
      if(Other.Class==Class'AutoMag')
      {
         ReplaceWith( Other, "MonsterHunt.OLAutoMag" );
         return false;
      }
      if(Other.Class==Class'Eightball')
      {
         ReplaceWith( Other, "MonsterHunt.OLEightball" );
         return false;
      }
      if(Other.Class==Class'FlakCannon')
      {
         ReplaceWith( Other, "MonsterHunt.OLFlakCannon" );
         return false;
      }
      if(Other.Class==Class'ASMD')
      {
         ReplaceWith( Other, "MonsterHunt.OLASMD" );
         return false;
      }
      if(Other.Class==Class'GesBioRifle')
      {
         ReplaceWith( Other, "MonsterHunt.OLGESBioRifle" );
         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 GivenSBInvulnerability(Pawn PlayerPawn)

{
   local SBInvulnerability SBInvulnerability;
   if (bUseInvulnerability)

   if( (PlayerPawn.FindInventoryType(class'SBInvulnerability') != None) || (PlayerPawn.Health <= 0) )
      return;
   SBInvulnerability = spawn(class'SBInvulnerability',PlayerPawn,,PlayerPawn.Location);
   if( SBInvulnerability != None )
   {
      SBInvulnerability.RespawnTime = 0.0;
      SBInvulnerability.GiveTo(PlayerPawn);
      SBInvulnerability.Activate();
   }
}

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

   if(bUseAntiBoost)
   {
      if(Victim != None && InstigatedBy != None)
      {
         if (InstigatedBy.IsA('PlayerPawn') && Victim.IsA('PlayerPawn'))
         {
	    Momentum = Vect(0,0,0);
            ActualDamage = 0;
            if (string(DamageType)=="RedeemerDeath")
            {
	       Velocity = Vect(0,0,0);
	       Victim.Velocity = (Victim.Velocity * 0);
            }
         }
      }
   }
   */
   
   
   function MutatorTakeDamage(out int ActualDamage,Pawn Victim, Pawn InstigatedBy, out Vector HitLocation, out Vector Momentum, name DamageType) {
/******************************************************************************
******************************************************************************/
local sound HitSound;
local bool bIsTeamDamage;
local string msg;

	if (Victim != None && InstigatedBy != None)
	{
		bIsTeamDamage = class'SharedCode'.Static.IsTeamAttack(InstigatedBy, Victim) && ActualDamage > 0;
		// This will remove all player-on-player damage as well as self-damage
		if (bUseAntiBoost)
		{
			if ((PlayerPawn(InstigatedBy) != None) && (PlayerPawn(Victim) != None))
			{
				Momentum = Vect(0, 0, 0);
				ActualDamage = 0;
				// Hack to remove redeemer shockwave from moving you
				if (string(DamageType)=="RedeemerDeath")
				{
					Velocity = vect(0,0,0);
					Victim.Velocity = vect(0, 0, 0);
				}
			}
		}
		else if (bIsTeamDamage)
		{
			msg = InstigatedBy.PlayerReplicationInfo.PlayerName @ "has a team kill attempt against" @ Victim.PlayerReplicationInfo.PlayerName;
			BroadCastMessage(msg);
                        InstigatedBy.ReceiveLocalizedMessage(class'TeamShootMessage', , InstigatedBy.PlayerReplicationInfo);
			if (FriendlyFireSelfDamageRatio > 0)
				InstigatedBy.TakeDamage(ActualDamage * FriendlyFireSelfDamageRatio, InstigatedBy, vect(0, 0, 0) , vect(0, 0, 0), 'FriendlyFire');
		}

		
		if (bAltScoring && ! bIsTeamDamage) // Scoring by damage
			if (actualDamage > 0)
				if (Victim != InstigatedBy)
					if (InstigatedBy.bIsPlayer)
					{
						// Stop scoring above monsters health value:
						if (ActualDamage > Victim.Health)
							InstigatedBy.PlayerReplicationInfo.Score += Victim.Health;
						else
							InstigatedBy.PlayerReplicationInfo.Score += ActualDamage;

					}
	}
   if(bHitsounds)
   {
   
   
     // play hitsount client side only    18.04.2025
   simulated function  ClientPlaySound(sound Asound,optional bool binterrupt, optionnal bool BVolumeControl)
   
   {
                 PlayerPawn(InstigatedBy).ClientPlaySound(Sound'HitsoundEnemy', SLOT_None, ClientHitVolume, false);
	         PlayerPawn(InstigatedBy).ClientPlaySound(Sound'HitsoundEnemy', SLOT_Interface, ClientHitVolume, false);
	        PlayerPawn(InstigatedBy).clientPlaySound(Sound'HitsoundEnemy', SLOT_Interact, ClientHitVolume, false);
	        
	        }

      if(Victim != None && InstigatedBy != None)
      {
         if ( InstigatedBy.IsA('PlayerPawn') && (Victim != InstigatedBy) )
         {
            if( Victim.IsA('PlayerPawn') || Victim.IsA('Bot') )  // When player shoot other player
            {
	       PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_None, teamHitVolume, false);
	       PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_Interface, teamHitVolume, false);
	       PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_Interact, teamHitVolume, false);
            }
            if( Victim.IsA('ScriptedPawn') )  // When player shoots a monster
            {   	// Cows and rabbits are friends
	       if(Victim.IsA('Cow')|| Victim.IsA('BabyCow')|| Victim.IsA('NaliRabbit'))
               {
                  PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_None, teamHitVolume, false);
	          PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_Interface, teamHitVolume, false);
	          PlayerPawn(InstigatedBy).PlaySound(Sound'HitsoundTeam', SLOT_Interact, teamHitVolume, false);
	       }
               else // ScriptedPawn is an enemy
	       {

	       }
            }
         }
      }
   }
   
   // play hitsount client side only    18.04.2025
   simulated function  ClientPlaySound(sound Asound,optional bool binterrupt, optionnal bool BVolumeControl)
   
   {
                 PlayerPawn(InstigatedBy).ClientPlaySound(Sound'HitsoundEnemy', SLOT_None, ClientHitVolume, false);
	         PlayerPawn(InstigatedBy).ClientPlaySound(Sound'HitsoundEnemy', SLOT_Interface, ClientHitVolume, false);
	        PlayerPawn(InstigatedBy).clientPlaySound(Sound'HitsoundEnemy', SLOT_Interact, ClientHitVolume, false);
	        
	        }

   if(bAltScoring) // Scoring by damage
   {
      if (Victim != None && InstigatedBy != None)
      {
         if ( Victim.IsA('ScriptedPawn') && instigatedBy.IsA('ScriptedPawn') || Victim == instigatedBy && Victim.IsA('ScriptedPawn'))
            actualDamage=0;
         if ( actualDamage < 0 )
            return;
         else if ( actualDamage > 1000 )
            actualDamage=MaxDamage;
         if (ActualDamage > Victim.Health)
            ActualDamage = Victim.Health;
         if (Victim != None && InstigatedBy != None && Victim != InstigatedBy)
         {
	    if (Victim.IsA('ScriptedPawn') && InstigatedBy.bIsPlayer)
            {
               InstigatedBy.PlayerReplicationInfo.Score += ActualDamage;
            }
         }
      }
   }
   if ( NextDamageMutator != None )
      NextDamageMutator.MutatorTakeDamage(ActualDamage, Victim, InstigatedBy, HitLocation, Momentum, DamageType);
}

function ModifyPlayer(Pawn Other)
{
   local int randm;
   local inventory inv;
   local class<DJ_InventoryItem> InventoryClass;
   local DJ_InventoryItem DJ_Inv;

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

   Other.Health = DefaultHealth;

   if (stopPlayerCollision == true)
      Other.bBlockPlayers = false;

   if(UseMHTranslocator)
      DeathMatchPlus(Level.Game).GiveWeapon(Other,"MH2GoldCTGv2c.MHTranslocator");

   InventoryClass = class<DJ_InventoryItem>(DynamicLoadObject("MH2GoldCTGv2c.DJ_InventoryItem", class'Class'));

   if(UseAltSniper)
      GiveWeapon(Other,class'MH2Rifle');

   if(DoubleJump)
   {
      DJ_Inv = Spawn(class'DJ_InventoryItem', Other,, Other.Location);
      if( DJ_Inv != None )
      {
         DJ_Inv.RespawnTime = 0.0;
         DJ_Inv.GiveTo(Other);
         DJ_Inv.maxJumps = maxJumps;
         DJ_Inv.jumpType = jumpType;
         DJ_Inv.jumpHeight = jumpHeight;
      }
   }
   if (bUseSpawnProt)
   {
      Inv = Other.FindInventoryType(class'SpawnProtEffect');
      if ( Inv != None )
         SpawnProtEffect(Inv).Duration = SpawnProtDuration;
      else
      {
         inv = Spawn(class'SpawnProtEffect');
         if( inv != None )
         {
            SpawnProtEffect(Inv).Duration = SpawnProtDuration;
            inv.GiveTo(Other);
            inv.Activate();
         }
      }
   }



  if(GiveSniper)
   {
 if(UseAltSniper)
         GiveWeapon(Other,class'MH2Rifle');
      else
         GiveWeapon(Other,class'Botpack.SniperRifle');
}




   if(GiveAllWeapons)
   {
      if(GiveHealingGun)
      GiveWeapon(Other,class'MH2GoldCTGv2c.HealingGun');
      GiveWeapon(Other,class'MH2GoldCTGv2c.MH2PulseGun');
      GiveWeapon(Other,class'MH2GoldCTGv2c.MH2ShockRifle');
      GiveWeapon(Other,class'MH2GoldCTGv2c.MH2FlakCannon');
      GiveWeapon(Other,class'MH2GoldCTGv2c.MH2BioRifle');
      GiveWeapon(Other,class'MH2GoldCTGv2c.MH2Minigun2');
      GiveWeapon(Other,class'MH2GoldCTGv2c.MH2Ripper');
      GiveWeapon(Other,class'MH2GoldCTGv2c.MH2Eightball');
      if(UseHammer)
      GiveWeapon(Other,class'ImpactHammer');
	if(UseSuperShockRifle)
	 GiveWeapon(other,class'MH2GoldCTGv2c.MH2SuperShockRifle');
       if(GiveMHTranslocator)
	 GiveWeapon(other,class'MH2GoldCTGv2c.MHTranslocator');
      if(GiveCoopTranslocator)
      GiveWeapon(other,class'CoopTranslocator12.CoopTranslocator');
      if(UseAltSniper)
         GiveWeapon(Other,class'MH2Rifle');
      else
         GiveWeapon(Other,class'MH2GoldCTGv2c.Mh2SniperRifle');
   }
   if (bUseRandomWeapon && Other.IsA('TournamentPlayer'))
   {
      randm = Rand(10);
      switch(randm)
      {
         case 0:
            GiveWeapon(Other,class'MH2GoldCTGv2c.MH2Biorifle');
            break;
         case 1:
            GiveWeapon(Other,class'MH2GoldCTGv2c.MH2Shockrifle');
            break;
         case 2:
            GiveWeapon(Other,class'MH2GoldCTGv2c.MH2Pulsegun');
            break;
         case 3:
            GiveWeapon(Other,class'MH2GoldCTGv2c.MH2ripper');
            break;
         case 4:
        	GiveWeapon(Other,class'MH2GoldCTGv2c.MH2minigun2');
            break;
         case 5:
              GiveWeapon(Other,class'MH2GoldCTGv2c.MH2Flakcannon');
	    break;
         case 6:
            GiveWeapon(Other,class'MH2GoldCTGv2c.MH2EightBall');
           break;
	 case 7:
            if(UseAltSniper)
               GiveWeapon(Other,class'MH2Rifle');
            else
               GiveWeapon(Other,class'MH2GoldCTGv2c.MH2SniperRifle');
            break;
         case 8:
            if(Use2k4Deemer)
               GiveWeapon(Other,class'MH2WarheadLauncher');
            else
              GiveWeapon(Other,class'WarHeadLauncher');
	       Other.Health += 200;
            break;
         case 9:
	       GiveWeapon(Other,class'ImpactHammer');
	       Other.Health += 200;
            break;
      }
      if(bGiveArmor)
      {
         inv = Spawn(class'MH2Armor2');
         if( inv != None )
	 {
	    inv.bHeldItem = true;
	    inv.RespawnTime = 0.0;
	    inv.GiveTo(Other);
	    inv.Charge = Inv.Default.Charge;
         }
      }
      Other.ReceiveLocalizedMessage( class'MH2GetWeaponMessage', 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;
      PlayerPawn.PendingWeapon = None;
      if ( !newWeapon.IsA('ImpactHammer') && !newWeapon.IsA('Translocator') )
      {
	 newWeapon.GiveAmmo(PlayerPawn);
	 newWeapon.AmmoType.AmmoAmount = newWeapon.AmmoType.MaxAmmo;
      }
   }
}

function ScoreKill(Pawn Killer, Pawn Other)

{

local bool bIsTeamKill;
local int i;
   if(Killer == None)return;
   
   	//bIsTeamKill = Killer.bIsPlayer && Other.bIsPlayer && Killer != Other;
	bIsTeamKill = class'SharedCode'.Static.IsTeamAttack(Killer, Other);
	if ( ! bIsTeamKill && Other.bIsPlayer) // end spree only if other was not killed by team member

	if (bIsTeamKill)
	{
		
		// Teamkill-causes-killers-death-code:
		Killer.Died(None, 'TeamKill', Killer.Location);
		Killer.ReceiveLocalizedMessage(class'TeamKillMessage');
		BroadCastMessage(Killer.PlayerReplicationInfo.PlayerName @ "is a freaking team killer");
	}
   if(Killer == None)return;
   if(!Killer.bIsHuman)return;
   if(Killer.PlayerReplicationInfo.bIsABot) return;
   if(Killer.IsA('ScreptedPawn'))return;
   if(Killer.IsA('ScreptedPawn') && Other.IsA('ScreptedPawn'))return;
   if ( (Killer == None) && (Other == None) )return;
   if ( Killer.bIsPlayer && Other.bIsPlayer )return;

   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 += HealthRegenPerKill;
      }
      if(Killer.Health > MaxHealth)
      {
         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'MH2MultiKillMessage', TournamentPlayer(Killer).MultiLevel );
	 CheckBroadCast(Killer,TournamentPlayer(Killer).MultiLevel);
      }
      else TournamentPlayer(Killer).MultiLevel = 0;
      TournamentPlayer(Killer).LastKillTime = TournamentPlayer(Killer).Level.TimeSeconds;
   }
}

function CheckBroadCast(Pawn Killer,int num)
{   if(bBrodcastMultikill)
   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 still going.... !!!!!!!!!!!";
	 break;
   }
   return "";
}

function NotifySpree(Pawn Other, int num)
{
   local Pawn P;

   if ( num == 30 )
      num = 0;
   else if ( num == 45 )
      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 if ( num == 500 )
      num = 6;
   else if ( num == 1000 )
      num = 7;
   else
      return;

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

function EndSpree(Pawn Killer, Pawn Other)
{
   local Pawn P;

   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'MH2KillingSpreeMessage', Other.Spree, Killer.PlayerReplicationInfo,  Killer.PlayerReplicationInfo );
      else
         P.ReceiveLocalizedMessage( class'MH2KillingSpreeMessage', Other.Spree, Killer.PlayerReplicationInfo, Other.PlayerReplicationInfo );
   }
}

function bool PreventDeath (Pawn Killed, Pawn Killer, name DamageType, Vector HitLocation)
{
   local bool pd;

   pd=Super.PreventDeath(Killed,Killer,DamageType,HitLocation);

   if (Killed != none && !pd)
   {
      if (!Killed.IsA('ScriptedPawn'))
      {
         if(bDropWeaponsOnDeath)
         {
            if (Killer != none && Killer.IsA('ScriptedPawn'))
    	       DiscardInventory(Killed);
         }
         if (Killed.bIsPlayer)
            Killed.PlayerReplicationInfo.Score *= retainScoreOnDeathPercent;
      }
   }
   return pd;
}

function DiscardInventory (Pawn Other)
{
   local Actor dropped;
   local Inventory Inv;
   local class<Weapon> Initial1;
   local class<Weapon> Initial2;

   if (Other != none)
   {
      if ( Other.DropWhenKilled != None )
      {
         dropped=Spawn(Other.DropWhenKilled,,,Other.Location);
         Inv=Inventory(dropped);
         if ( Inv != None )
         {
            Inv.RespawnTime=0.00;
            Inv.BecomePickup();
    	 }
         if ( dropped != None )
         {
            dropped.RemoteRole=ROLE_DumbProxy;
            dropped.SetPhysics(PHYS_Falling);
            dropped.bCollideWorld=True;
            dropped.Velocity=Other.Velocity + VRand() * 280;
    	 }
         if ( Inv != None )
         {
            Inv.GotoState('Pickup','dropped');
    	 }
      }
      Inv=Other.Inventory;
      JL0111:
         if ( Inv != None )
    	 {
            if ( Inv.IsA('Weapon') )
    	    {
    	       if ( (Inv.Class != Level.Game.BaseMutator.MutatedDefaultWeapon()) && ((Weapon(Inv).AmmoType == None) || (Weapon(Inv).AmmoType.AmmoAmount > 0)) && Weapon(Inv).bCanThrow)
               {
                  if (Inv.class != class'MH2Enforcer' && Inv.Class != class'MH2DoubleEnforcer')
                     DropWeapon(Other,Inv);
    	       }
            }
    	    Inv.Destroy();
            Inv=Inv.Inventory;
            goto JL0111;
         }
   }
}

function DropWeapon (Pawn Other, Inventory Inv)
{
   local Inventory DropInv;
   local int DropPitch;
   local int DropYaw;
   local Rotator DropRot;

   DropInv=Spawn(Inv.Class,,,Other.Location);
   if ( DropInv == None )
   {
      return;
   }
   DropRot=Other.ViewRotation;
   DropPitch=Rand(32768);
   DropYaw=Rand(65536);
   DropRot.Pitch=DropPitch;
   DropRot.Yaw=DropYaw;
   Weapon(DropInv).bWeaponStay = false;
   DropInv.Velocity=vector(DropRot) * (Rand(250) + 250);
   DropInv.RespawnTime=0.00;
   DropInv.BecomePickup();
   DropInv.NetPriority=2.50;
   DropInv.RemoteRole=ROLE_DumbProxy;
   DropInv.SetPhysics(PHYS_Falling);
   DropInv.bCollideWorld=True;
   DropInv.GotoState('Pickup','dropped');
}

simulated function Tick (float DT)
{
   Super.Tick(DT);

   if ( Level.Game.bGameEnded ) return;

   if ((bCheckMonsterAttack) && (LastMonsterAttackTime < Level.TimeSeconds)) 
      MonsterAttackCheck();
}

function Timer() 
{
   local Pawn P, PRand;
   local Inventory Inv;
   local skaarjtrooper sp;

   if (Level.Game.bGameEnded) return;

   for (P = Level.PawnList; P != None; P = P.NextPawn)
   {
      if (P.IsA('skaarjtrooper'))
      {
         sp = skaarjtrooper(P);
         sp.bIsPlayer = False;
         if (sp.weapontype == none)
            GiveWeapon(sp, Class 'botpack.minigun2');
         if (sp.weapon != none)
            sp.weapon.bCanThrow = False;
      }
   }

   if (AmpCount < AmpSpawnTime) AmpCount++;

   else if (AmpCount == AmpSpawnTime)
   {
      BroadcastLocalizedMessage(class 'MH2AmpMessage', , , None, None);
      for (P = Level.PawnList; P != None; P = P.NextPawn)
      {
         if (P.IsA('Bot') || P.IsA('TournamentPlayer')) GiveAmp(P);
      }
      AmpCount = 0;
   }
   
         if (bUseInvulnerability)
    if (invulnerabilityCount < invulnerabilityRespawnTime) invulnerabilityCount++;

   else if (invulnerabilityCount == invulnerabilityRespawnTime)
   {
      BroadcastLocalizedMessage(class 'MH2InvulnerabilityMessage', , , None, None);
      for (P = Level.PawnList; P != None; P = P.NextPawn)
      {
         if (P.IsA('Bot') || P.IsA('TournamentPlayer')) GivenSBInvulnerability(P);
      }
      invulnerabilityCount = 0;
   }

   for (P = Level.PawnList; P != None; P = P.NextPawn)
   {
      if (P.IsA('Bot') || P.IsA('TournamentPlayer'))
      {
         if (P.Health > 0)
         {
   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 ( Ammo(Inv).MaxAmmo > 10 ) Ammo(Inv).AmmoAmount = 9999 ;





                  }
               }
            }
            if (bUseRegenHealth)
            {
               if (P.Health < MaxRegenHealth && P.Region.Zone != None && !P.Region.Zone.bWaterZone) // waterzone stoppage of health regen
               {
                  if (P.IsInState('FeigningDeath'))
                     P.Health = FMin(MaxRegenHealth, P.Health + (3 * HealthRegenPerSec));
                  else
                     P.Health = FMin(MaxRegenHealth, P.Health + HealthRegenPerSec);
               }
            }
         }

         PRand = GetRandomPlayer();
         if (PRand != None)


         {
            if (kakuCount < DeemerSpawnTime) kakuCount++;
            if (HealthCount < HealthAwardTime) HealthCount++;
            if (DeemerSpawnTime - kakuCount < 5 && DeemerSpawnTime - kakuCount > 0)
            {  
               BroadcastLocalizedMessage(class 'MH2RandomDeemerMsg', DeemerSpawnTime - kakuCount, PRand.PlayerReplicationInfo);
            }
            if (HealthAwardTime - HealthCount < 5 && HealthAwardTime - HealthCount > 0)
            {
               BroadcastLocalizedMessage(class 'MH2RandomHealthMsg', HealthAwardTime - HealthCount, PRand.PlayerReplicationInfo);
            }
            if (kakuCount >= DeemerSpawnTime)
            {
               kakuCount = 0;
               PRand = GetRandomPlayer();
               if (PRand != None && PRand.bIsPlayer)
               {
                  BroadcastLocalizedMessage(class 'MH2RandomDeemerMsg', kakuCount, PRand.PlayerReplicationInfo);
                  if (Use2k4Deemer)
                     GiveRedeemer(PRand);
                  else
                     GiveOldRedeemer(PRand);
               }
            }
            if (HealthCount >= HealthAwardTime)
            {
               HealthCount = 0;
               PRand = GetRandomPlayer();
               if (PRand != None && PRand.bIsPlayer)
               {
                  BroadcastLocalizedMessage(class 'MH2RandomHealthMsg', HealthCount, PRand.PlayerReplicationInfo);
                  GiveHealth(PRand);
               }
            }
         }
      }
   }
}

function GiveRedeemer(Pawn PlayerPawn)
{
   local MH2WarheadLauncher  rede;
   local bool NoNeed;





   rede= spawn(class'MH2WarheadLauncher');
   if( rede!= None )
   {  
      if (PlayerPawn.FindInventoryType(class'MH2WarheadLauncher') != None)
         NoNeed = true;

      rede.RespawnTime = 0.0;
      rede.GiveTo(PlayerPawn);
      rede.SetSwitchPriority(PlayerPawn);
      PlayerPawn.AddInventory(rede);
      rede.PickupAmmoCount = 1;
      rede.GiveAmmo(PlayerPawn);
      if (NoNeed)
         rede.Destroy();
   }
}

function GiveOldRedeemer(Pawn PlayerPawn)
{
   local Warheadlauncher  redeA;
   local bool NoNeed;

   redeA= spawn(class'Warheadlauncher');
   if( redeA!= None )
   {  
      if (PlayerPawn.FindInventoryType(class'Warheadlauncher') != None)
         NoNeed = true;

      redeA.RespawnTime = 0.0;
      redeA.GiveTo(PlayerPawn);
      redeA.SetSwitchPriority(PlayerPawn);
      PlayerPawn.AddInventory(redeA);
      redeA.PickupAmmoCount = 1;
      redeA.GiveAmmo(PlayerPawn);
      if (NoNeed)
         redeA.Destroy();
   }
}

function MonsterAttackCheck()
{
   local ScriptedPawn S;
   local Queen Q;
   local Pawn P;

   for ( P=Level.PawnList; P!=None; P=P.nextPawn )
   {
      S = ScriptedPawn(P);
      Q = Queen(P);

      if (S != None && S.Enemy != None && S.Enemy.IsA('ScriptedPawn'))
      {
         S.Hated = None;
         S.Enemy = None;
         if (S.OldEnemy!=None && S.OldEnemy.IsA('ScriptedPawn'))
            S.OldEnemy = none;
         S.WhatToDoNext('Waiting','');
      }
      if (!bHaveQueenDests)
      {
         Q = Queen(P);
         if (Q != none)
         {
            if (Q.IsInState('Teleporting'))
               Q.GotoState('Attacking');
         }
      }
   }
   LastMonsterAttackTime = Level.TimeSeconds;
}

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 && Dest.PlayerReplicationInfo.score >= 5000)
      {
         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 Mutate(string MutateString, PlayerPawn Sender)
{
   local mover M;
   local MH2PlayerConfig pConfig;
   local string arg;

   if(!Sender.PlayerReplicationInfo.bIsSpectator || !Sender.PlayerReplicationInfo.bWaitingPlayer)
   {
      if(MutateString ~="HealingGun")
      {
         spawn(class'MH2GoldCTGv2c.HealingGun',,,Sender.Location);
      }
      if(MutateString~="light")
      {
         Sender.ClientMessage("Toggling personal light on");
         Sender.AmbientGlow = 254;
         Sender.LightEffect=LE_NonIncidence;
         Sender.LightBrightness=255;
         Sender.LightHue=210;
         Sender.LightRadius=30;
         Sender.LightSaturation=200;
         Sender.LightType=LT_Steady;
         
      }
      if(MutateString~="dark")
      {
         Sender.ClientMessage("Toggling personal light off");
         Sender.AmbientGlow = Owner.Default.AmbientGlow;
         Sender.LightType = LT_None;
      }
      if(MutateString ~= CommandOpen)
      {
         Sender.ClientMessage("Movers in range opened (Action was logged to the server admin)...");
         foreach RadiusActors(class'Mover', M, 250, Sender.Location)
         {
            log("## ADMIN- Mover opened:"@M@" by player:"@Sender.PlayerReplicationInfo.PlayerName);
            M.DoOpen();
         }
      }
      else if(MutateString ~= CommandClose)
      {
         Sender.ClientMessage("Movers in range closed (Action was logged to the server admin)...");
         foreach RadiusActors(class'Mover', M, 250, Sender.Location)
         {
            log("## ADMIN- Mover closed:"@M@" by player:"@Sender.PlayerReplicationInfo.PlayerName);
            M.DoClose();
         }
      }
   }
   
   	if( MutateString ~= "mh2 toggleradar" )
	{
		log("Player="@Sender.PlayerReplicationInfo.PlayerName@"requested to toggle the radar.");
		
		foreach AllActors(Class'MH2PlayerConfig', pConfig)
		{
			if( pConfig.Owner == Sender )
			{
				break;
			}
		}

		if( pConfig != None )
		{
			Sender.ClientMessage("[MH] Toggling the radar");
			pConfig.SetClientRadarToggle();
		}
		else
		{
			Sender.ClientMessage("[MH] Could not find player config actor.");
			warn("Could not find config actor for player="@Sender);
		}
	}
   if ( NextMutator != None )
      NextMutator.Mutate(MutateString, Sender);
}

simulated function bool AlwaysKeep(Actor Other)
{
   if(Other.IsA('ScriptedPawn')) return true;  //ADD
   if (Other.IsA('ScriptedPawn'))
      ScriptedPawn(Other).bIsPlayer = False;
   if (PlayerPawn(Other) != None)
   {
      Pawn(Other).PlayerReplicationInfoClass=Class'IPRI';
      return True;
   }
   if ( NextMutator != None )
      return ( NextMutator.AlwaysKeep(Other) );
   return false;
}


function CheckMessage( Actor Sender, Pawn Receiver, coerce string S)
{
	local PlayerPawn PSender;
	local string arg;

	PSender = PlayerPawn(Sender);
	if( PSender == None || Sender != Receiver ) return;

	if ( Spectator(Sender) != None ) 
		S = Mid(S, Len(PSender.GetHumanName()) + 1);

	if ( S ~= "!ToggleRadar" ) 
	{
		Mutate("mh2 toggleradar", PSender);
		return;
	}
	
	if ( S ~= "!HG" )
	{
		Mutate("HealingGun", PSender);
		return;
	}
}

function bool MutatorTeamMessage( Actor Sender, Pawn Receiver, PlayerReplicationInfo PRI, coerce string S, name Type, optional bool bBeep ) 
{
	CheckMessage(Sender, Receiver, S);

	return Super.MutatorTeamMessage( Sender, Receiver, PRI, S, Type, bBeep );
}

function bool MutatorBroadcastMessage( Actor Sender, Pawn Receiver, out coerce string Msg, optional bool bBeep, out optional name Type )
{
	CheckMessage(Sender, Receiver, Msg);
	
	return Super.MutatorBroadcastMessage( Sender, Receiver, Msg, bBeep, Type );
}

defaultproperties
{
     bServerInfo="Default message"
     bCapacity=500
     ChangeCovertToFalse=True
     AmpSpawnTime=400
     DeemerSpawnTime=120
     HealthAwardTime=500
     invulnerabilityRespawnTime=115
     invulnerabilityCharges=300
     bGiveArmor=True
     bUseRandomWeapon=True
     bUseRegenAmmo=True
     AmmoInterval=5
     GiveAllWeapons=True
     GiveHealingGun=True
     Use2k4Deemer=True
     UseAltSniper=True
     UseMH2Enforcer=True
     UseMH2BioRifle=True
     UseMH2ShockRifle=True
     UseMH2SuperShockrifle=True
     UseMH2Ripper=True
     UseMH2PulseGun=True
     UseMH2Minigun2=True
     UseMH2FlakCannon=True
     UseMH2Eightball=True
     UseSuperShockRifle=False
     GiveMHTranslocator=False
     GiveCoopTranslocator=True
     DefaultHealth=100
     HealthRegenPerSec=10
     MaxHealth=500
     bUseRegenHealth=True
     MaxRegenHealth=500
     HealthRegenPerKill=10
     bGhostCarcass=True
     bHitsounds=True
     bInterrupt=True
     bVolumeControl=True
     bAltScoring=True
     bCheckMonsterAttack=True
     stopPlayerCollision=True
     ReplaceInvis=True
     HitVolume=16.000000
     teamHitVolume=16.0000
     clientHitvolume=8.00
     VisibleMonsterEnds=True
     retainScoreOnDeathPercent=0.750000
     bDropWeaponsOnDeath=True
     UseMHTranslocator=False
     UseServerStats=True
     MaxDamage=1000
     bBrodcastMultikill=True
     MH2NaliFruit="MH2GoldCTGv2c.MH2NaliFruit"
     MH2MedBox="MH2GoldCTGv2c.MH2MedBox"
     MH2HealthPack="MH2GoldCTGv2c.MH2HealthPack"
     MH2UnrealHealth="MH2GoldCTGv2c.MH2UnrealHealth"
     MH2HealthVial="MH2GoldCTGv2c.MH2HealthVial"
     DoubleJump=True
     maxJumps=4
     jumpType=2
     jumpHeight=2.000000
     bUseSpawnProt=True
     SpawnProtDuration=10
}
 
Image

Letylove49 aka Alicia
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: clientside hitsound for MH2

Post by Barbie »

There is a function definition "ClientPlaySound" within another function "MutatorTakeDamage".   
Auto merged new post submitted 7 minutes later
BTW: lines 697 to 705 contain the same function "ClientPlaySound" definition...
You do not have the required permissions to view the files attached to this post.
"If Origin not in center it be not in center." --Buggie
Letylove49
Adept
Posts: 395
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: clientside hitsound for MH2

Post by Letylove49 »

Barbie wrote: Fri Apr 18, 2025 7:32 pm There is a function definition "ClientPlaySound" within another function "MutatorTakeDamage".   
Auto merged new post submitted 7 minutes later
BTW: lines 697 to 705 contain the same function "ClientPlaySound" definition...
yes when i have got the error i have try to put the function at the begin to see if i go the same error. i forgot to remove the first.

my but is to have only client who heart the hitsound.



now i have add my function there

Code: Select all

if ( NextDamageMutator != None )
      NextDamageMutator.MutatorTakeDamage(ActualDamage, Victim, InstigatedBy, HitLocation, Momentum, DamageType);
}

// play hitsount client side only    18.04.2025
   simulated function  ClientPlaySound(sound Asound,optional bool binterrupt, optional bool BVolumeControl)

   {
   

                 PlayerPawn(InstigatedBy).ClientPlaySound(Sound'HitsoundEnemy', SLOT_None, ClientHitVolume, false);
	         PlayerPawn(InstigatedBy).ClientPlaySound(Sound'HitsoundEnemy', SLOT_Interface, ClientHitVolume, false);
	        PlayerPawn(InstigatedBy).clientPlaySound(Sound'HitsoundEnemy', SLOT_Interact, ClientHitVolume, false);
	        
	        }
i got this error now :PlayerPawn: Bad command or expression.
Image

Letylove49 aka Alicia
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: clientside hitsound for MH2

Post by Barbie »

Letylove49 wrote: Fri Apr 18, 2025 9:45 pm i got this error now :PlayerPawn: Bad command or expression.
There is a line number where the compiler has found the error. Please post the complete error message (like in your first post) and the concerning line of your code; maybe some lines above and below also.

(I noticed you give the name "PlayerPawn" to function parameter, for example function GiveAmp(Pawn PlayerPawn) - this may lead to confusion with the class 'PlayerPawn'...)
"If Origin not in center it be not in center." --Buggie
User avatar
sektor2111
Godlike
Posts: 6539
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: clientside hitsound for MH2

Post by sektor2111 »

I don't see where variable "PlayerPawn" is declared and perhaps some sanity check "if (PlayerPawn(InstigatedBy) != None)".
Anyway... keep trying...
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: clientside hitsound for MH2

Post by Barbie »

sektor2111 wrote: Sat Apr 19, 2025 5:54 am I don't see where variable "PlayerPawn" is declared and perhaps some sanity check "if (PlayerPawn(InstigatedBy) != None)".
I wrote name of a function parameter, not name of a variable. See for example line 553 in the code block of this posting; I already posted the function head in my previous post.
"If Origin not in center it be not in center." --Buggie
User avatar
sektor2111
Godlike
Posts: 6539
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: clientside hitsound for MH2

Post by sektor2111 »

You lost me... I still don't see the sanity check and the rest of needs - Where is the deal with my friend "Bot" ? - I must ask...
These codes are wrecks constantly "copy-paste"-ed... to not forget the lack of optimizations that are needed for that mountain of Pawns used in MonsterHunt... still using "FOR" it's the most pathetic code regarding to "optimizing the compiler" in 2025.
Letylove49
Adept
Posts: 395
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: clientside hitsound for MH2

Post by Letylove49 »

Barbie wrote: Fri Apr 18, 2025 11:34 pm
Letylove49 wrote: Fri Apr 18, 2025 9:45 pm i got this error now :PlayerPawn: Bad command or expression.
There is a line number where the compiler has found the error. Please post the complete error message (like in your first post) and the concerning line of your code; maybe some lines above and below also.

(I noticed you give the name "PlayerPawn" to function parameter, for example function GiveAmp(Pawn PlayerPawn) - this may lead to confusion with the class 'PlayerPawn'...)
here the error :

Code: Select all

 Log: Compiling MH2Base
Error: D:\UT coding\UnrealTournament\MH2GoldCTGv2c\Classes\MH2Base.uc(726) : Error, 'PlayerPawn': Bad command or expression
Critical: appError called:
Critical: Failed due to errors.
Exit: Executing UObject::StaticShutdownAfterError
Critical: CompileError
Critical: TryCompile
Critical: FScriptCompiler::CompileScript
Critical: (Class MH2GoldCTGv2c.MH2Base, Pass 1, Line 726)
Critical: CompileScripts
Critical: CompileScripts
Critical: CompileScripts
Critical: CompileScripts
Critical: CompileScripts
Critical: DoScripts
Critical: UEditorEngine::MakeScripts
Critical: UMakeCommandlet::Main
Exit: Exiting.
Uninitialized: Name subsystem shut down
Uninitialized: Log file closed, 04/18/25 23:14:28
now i have try that:

Code: Select all

 

// play hitsount client side only    18.04.2025
   simulated function  ClientPlaySound(sound Asound,optional bool binterrupt, optional bool bVolumeControl)

   {
   
   if(Victim != None && InstigatedBy != None)

   if ( InstigatedBy.IsA('PlayerPawn') && (Victim != InstigatedBy) )

              {
                 PlayerPawn(InstigatedBy).ClientPlaySound(Sound'HitsoundEnemy', SLOT_None, ClientHitVolume, false);
	         PlayerPawn(InstigatedBy).ClientPlaySound(Sound'HitsoundEnemy', SLOT_Interface, ClientHitVolume, false);
	        PlayerPawn(InstigatedBy).clientPlaySound(Sound'HitsoundEnemy', SLOT_Interact, ClientHitVolume, false);
	        
	        }
	        
          }
i got this now

Code: Select all

 :Error: D:\UT coding\UnrealTournament\MH2GoldCTGv2c\Classes\MH2Base.uc(726) : Error, Bad or missing expression in 'If'
Critical: appError called:
Critical: Failed due to errors.
Exit: Executing UObject::StaticShutdownAfterError
Critical: CompileError
Critical: TryCompile
Critical: FScriptCompiler::CompileScript
Critical: (Class MH2GoldCTGv2c.MH2Base, Pass 1, Line 726)
Critical: CompileScripts
Critical: CompileScripts
Critical: CompileScripts
Critical: CompileScripts
Critical: CompileScripts
Critical: DoScripts
Critical: UEditorEngine::MakeScripts
Critical: UMakeCommandlet::Main
Exit: Exiting.
Uninitialized: Name subsystem shut down
Uninitialized: Log file closed, 04/20/25 01:07:16
Image

Letylove49 aka Alicia
Deaod
Average
Posts: 61
Joined: Fri Jul 10, 2020 9:22 am

Re: clientside hitsound for MH2

Post by Deaod »

Please read the error message carefully.
Error: D:\UT coding\UnrealTournament\MH2GoldCTGv2c\Classes\MH2Base.uc(726) : Error, Bad or missing expression in 'If'
Lets go over it in parts:
Error:
Means this is an actual error, not a warning.
D:\UT coding\UnrealTournament\MH2GoldCTGv2c\Classes\MH2Base.uc
This is the file the error occurred in.
(726)
This is the line within the file that the error occurred on.
Error, Bad or missing expression in 'If'
Means you have an if statement and something within the condition of the if statement is not defined within the scope youre currently in.

I hope this explanation of the error message helps you diagnose the issue on your own.
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: clientside hitsound for MH2

Post by Barbie »

Plz post line 726 of the code plus some lines above and below.
"If Origin not in center it be not in center." --Buggie
Letylove49
Adept
Posts: 395
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: clientside hitsound for MH2

Post by Letylove49 »

Barbie wrote: Sun Apr 20, 2025 8:59 am Plz post line 726 of the code plus some lines above and below.
error MH2Base.uc.png
You do not have the required permissions to view the files attached to this post.
Image

Letylove49 aka Alicia
User avatar
Barbie
Godlike
Posts: 3225
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: clientside hitsound for MH2

Post by Barbie »

Looks like "Victim" is not known there and probably neither "InstigatedBy".

May I show how I coded that in Basemutator's function MutatorTakeDamage()?

Code: Select all

function MutatorTakeDamage(out int ActualDamage,Pawn Victim, Pawn InstigatedBy, out Vector HitLocation, out Vector Momentum, name DamageType) {
local sound HitSound;
...
	if(bDamageSounds)
		if (PlayerPawn(InstigatedBy) != None && (Victim != InstigatedBy) && (actualDamage > 0))
		{
			if (PlayerPawn(Victim) != None || Bot(Victim) != None) // When player/bot shoot other player/bot
				HitSound = Sound'HitsoundTeam';
			else
				if (Victim.AttitudeToPlayer == ATTITUDE_Ignore || Victim.AttitudeToPlayer == ATTITUDE_Friendly || Victim.AttitudeToPlayer == ATTITUDE_Follow)
					HitSound = Sound'HitsoundTeam';
				else
					HitSound = Sound'HitsoundEnemy';
			PlayerPawn(InstigatedBy).ClientPlaySound(HitSound);
			//PlayerPawn(InstigatedBy).PlaySound(HitSound, SLOT_None, HitVolume, false);
			//PlayerPawn(InstigatedBy).PlaySound(HitSound, SLOT_Interface, HitVolume, false);
			//PlayerPawn(InstigatedBy).PlaySound(HitSound, SLOT_Interact, HitVolume, false);
		}
...
"If Origin not in center it be not in center." --Buggie
Letylove49
Adept
Posts: 395
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: clientside hitsound for MH2

Post by Letylove49 »

Code: Select all

 	if(bHitSounds)
		if (PlayerPawn(InstigatedBy) != None && (Victim != InstigatedBy) && (actualDamage > 0))
		{
			if (PlayerPawn(Victim) != None || Bot(Victim) != None) // When player/bot shoot other player/bot
				HitSound = Sound'HitsoundTeam';
			else
				if (Victim.AttitudeToPlayer == ATTITUDE_Ignore || Victim.AttitudeToPlayer == ATTITUDE_Friendly || Victim.AttitudeToPlayer == ATTITUDE_Follow)
					HitSound = Sound'HitsoundTeam';
				else
					HitSound = Sound'HitsoundEnemy';
			PlayerPawn(InstigatedBy).ClientPlaySound(HitSound);
			//PlayerPawn(InstigatedBy).PlaySound(HitSound, SLOT_None, HitVolume, false);
			//PlayerPawn(InstigatedBy).PlaySound(HitSound, SLOT_Interface, HitVolume, false);
			//PlayerPawn(InstigatedBy).PlaySound(HitSound, SLOT_Interact, HitVolume, false);
		}
that work now thanks. i would like to add ClientHitvolume how i can add that ?
Image

Letylove49 aka Alicia