Old stuff:
Code: Select all
// QFeedBack for MonsterHunt
// Modification of original QFeedBack by Scott "Frood" Shingler
// By Ti-Lung 18/08/2007
// Version 1.0 - 20070801
// Created for the Smiling Monsters community
// http://www.smiling-monsters.com/community/
class QFeedBackMH expands Mutator;
#exec AUDIO IMPORT FILE="Sounds\QFeedbackWav.wav" NAME="QFeedbackWav" GROUP="QFeedback"
#exec AUDIO IMPORT FILE="Sounds\QFeedbackArmourWav.wav" NAME="QFeedbackArmourWav" GROUP="QFeedback"
#exec AUDIO IMPORT FILE="Sounds\QFeedbackTeamWav.wav" NAME="QFeedbackTeamWav" GROUP="QFeedback"
// Config variable
var config float HitVolume;
var bool bInitialized;
function PostBeginPlay()
{
	if (bInitialized)
		return;
	bInitialized = True;
	log("Mutator initialized.",'QFeedBackMH');
	if( !Level.Game.IsA('MonsterHunt') )
	{
		log("This mutator is for MonsterHunt and will not work properly on other gametype",'QFeedBackMH');
		log("The gametype is now"@Level.Game.GameName,'QFeedBackMH');
	}
	Level.Game.RegisterDamageMutator(Self);
	// If there is another mutator execute the postbeginplay
	if ( NextMutator != None )
		NextMutator.PostBeginPlay();
}
function MutatorTakeDamage( out int ActualDamage, Pawn Victim, Pawn InstigatedBy, out Vector HitLocation, out Vector Momentum, name DamageType)
{
	if ( InstigatedBy.IsA('PlayerPawn') && (Victim != InstigatedBy) )
	{
		// When player shoot other player
		if( Victim.IsA('PlayerPawn') || Victim.IsA('Bot') )
		{
			// Play sound on all slot except talk so incoming sound does not interfere
			// Remove Playsound Slot_Ambient to stop native error on server
			PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackTeamWav', SLOT_None, HitVolume, false);
			PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackTeamWav', SLOT_Interface, HitVolume, false);
			PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackTeamWav', SLOT_Interact, HitVolume, false);
			// PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackTeamWav', SLOT_Misc, HitVolume, false);
		}
		// When player shoot ScriptedPawn
		if( Victim.IsA('ScriptedPawn') )
		{
			// Nali and animal are friends
			if(
				Victim.IsA('Nali')
				|| Victim.IsA('NaliPriest')
				|| Victim.IsA('Cow')
				|| Victim.IsA('BabyCow')
				|| Victim.IsA('NaliRabbit')
			)
			{
				PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackTeamWav', SLOT_None, HitVolume, false);
				PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackTeamWav', SLOT_Interface, HitVolume, false);
				PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackTeamWav', SLOT_Interact, HitVolume, false);
				// PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackTeamWav', SLOT_Misc, HitVolume, false);
			}
			else // ScriptedPawn is ennemy
			{
				PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackWav', SLOT_None, HitVolume, false);
				PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackWav', SLOT_Interface, HitVolume, false);
				PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackWav', SLOT_Interact, HitVolume, false);
				// PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackWav', SLOT_Misc, HitVolume, false);
			}
		}
	}
	// Go to next Damage mutator
	if ( NextDamageMutator != None )
		NextDamageMutator.MutatorTakeDamage( ActualDamage, Victim, InstigatedBy, HitLocation, Momentum, DamageType );
}
- BabyCow it's Cow - no need check - and it looks the same with NaliPriest but...
- NaliRabbit - is not ScriptedPawn
- Instigatedby and Victim have to be checked else Hit-Sound doesn't make sense;
- Referring to player and Bot is doable by a single check for PRI - PlayerReplicationInfo;
- PostBeginPlay it's a function called by Engine - won't need extra-call causing duplicate calls to next mutator - that's a non-sense.
New code is like this (not perfect yet but errors have been vanished) - I did not see any configuration file defined... and I won't change structure - this is Generation 2 that has to be compatible
Code: Select all
class QFeedBackMH expands Mutator;
#exec AUDIO IMPORT FILE="Sounds\QFeedbackWav.wav" NAME="QFeedbackWav" GROUP="QFeedback"
#exec AUDIO IMPORT FILE="Sounds\QFeedbackArmourWav.wav" NAME="QFeedbackArmourWav" GROUP="QFeedback"
#exec AUDIO IMPORT FILE="Sounds\QFeedbackTeamWav.wav" NAME="QFeedbackTeamWav" GROUP="QFeedback"
// Config variable
var config float HitVolume; //I gotta see this
var bool bInitialized;
function PostBeginPlay()
{
	if (bInitialized)
		return;
	bInitialized = True;
	log("Mutator initialized.",'QFeedBackMH');
	if( !Level.Game.IsA('MonsterHunt') )
	{
		log("This mutator is for MonsterHunt and will not work properly on other gametype",'QFeedBackMH');
		log("The gametype is now"@Level.Game.GameName,'QFeedBackMH');
	}
	Level.Game.RegisterDamageMutator(Self);
	// If there is another mutator execute the postbeginplay
/*
	Nelsona: No shit me. PostBeginPlay it's already called by engine for all Actors.
UnGame.cpp
_________________________
		// Init scripting.
		for( i=0; i<GLevel->Actors.Num(); i++ )
			if( GLevel->Actors(i) )
				GLevel->Actors(i)->InitExecution();
		// Enable actor script calls.
		Info->bBegunPlay = 1;
		Info->bStartup = 1;
		// Init the game.
		if( Info->Game )
			Info->Game->eventInitGame( Options, Error ); // DONE !
		// Send PreBeginPlay.
		for( i=0; i<GLevel->Actors.Num(); i++ )
			if( GLevel->Actors(i) )
				GLevel->Actors(i)->eventPreBeginPlay(); // DONE !
		// Set BeginPlay.
		for( i=0; i<GLevel->Actors.Num(); i++ )
			if( GLevel->Actors(i) )
				GLevel->Actors(i)->eventBeginPlay(); // DONE !
		// Set zones.
		for( i=0; i<GLevel->Actors.Num(); i++ )
			if( GLevel->Actors(i) )
				GLevel->SetActorZone( GLevel->Actors(i), 1, 1 ); // DONE !
		// Post begin play.
		for( i=0; i<GLevel->Actors.Num(); i++ )
			if( GLevel->Actors(i) )
				GLevel->Actors(i)->eventPostBeginPlay(); // DONE !
		// Begin scripting.
		for( i=0; i<GLevel->Actors.Num(); i++ )
			if( GLevel->Actors(i) )
				GLevel->Actors(i)->eventSetInitialState(); // DONE !
___________________________________________________________ q.e.d.
	if ( NextMutator != None )
		NextMutator.PostBeginPlay();
*/
}
function MutatorTakeDamage( out int ActualDamage, Pawn Victim, Pawn InstigatedBy, out Vector HitLocation, out Vector Momentum, name DamageType)
{
	if ( InstigatedBy != None && Victim != None ) //Wrapping mode turned on - None it's not in account
	{
	if ( InstigatedBy.PlayerReplicationInfo != None && ( Victim != InstigatedBy ) )
	{
		// When player shoot other player
		if( Victim.PlayerReplicationInfo != None )
		{
			// Play sound on all slot except talk so incoming sound does not interfere
			// Remove Playsound Slot_Ambient to stop native error on server
			InstigatedBy.PlaySound(Sound'QFeedbackTeamWav', SLOT_None, HitVolume, false);
			InstigatedBy.PlaySound(Sound'QFeedbackTeamWav', SLOT_Interface, HitVolume, false);
			InstigatedBy.PlaySound(Sound'QFeedbackTeamWav', SLOT_Interact, HitVolume, false);
			// PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackTeamWav', SLOT_Misc, HitVolume, false);
		}
		// When player shoot ScriptedPawn
		if ( ScriptedPawn(Victim) != None )
		{
			// Nali and animal are friends
			if (
				Victim.IsA('Nali')
				|| Victim.IsA('NaliPriest') // This one is pointless too
				|| Victim.IsA('Cow')
//				|| Victim.IsA('BabyCow') // This is definitely a COW
//				|| Victim.IsA('NaliRabbit') // This is not ScriptedPawn, geniuses
				)
			{
				InstigatedBy.PlaySound(Sound'QFeedbackTeamWav', SLOT_None, HitVolume, false);
				InstigatedBy.PlaySound(Sound'QFeedbackTeamWav', SLOT_Interface, HitVolume, false);
				InstigatedBy.PlaySound(Sound'QFeedbackTeamWav', SLOT_Interact, HitVolume, false);
				// PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackTeamWav', SLOT_Misc, HitVolume, false);
			}
			else // ScriptedPawn is enemy
			{
				InstigatedBy.PlaySound(Sound'QFeedbackWav', SLOT_None, HitVolume, false);
				InstigatedBy.PlaySound(Sound'QFeedbackWav', SLOT_Interface, HitVolume, false);
				InstigatedBy.PlaySound(Sound'QFeedbackWav', SLOT_Interact, HitVolume, false);
				// PlayerPawn(InstigatedBy).PlaySound(Sound'QFeedbackWav', SLOT_Misc, HitVolume, false);
			}
		}
	}
	}
	// Go to next Damage mutator
	if ( NextDamageMutator != None )
		NextDamageMutator.MutatorTakeDamage( ActualDamage, Victim, InstigatedBy, HitLocation, Momentum, DamageType );
}
defaultproperties
{
	HitVolume=16.000000
}
I might want to bet that this mutator is supporting a delayed start. If not, explain me why... I'm such a curious person...