Those obsolete ones

Development assistance and tutorials here.
Post Reply
Nelsona
Posts: 1737
Joined: Sat Sep 30, 2017 5:03 am

Those obsolete ones

Post by Nelsona »

Repositories for NWIII have been loved a bit. QFeedbackMH_v11 - servers spammer for years has been changed.
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 );
}
Explained plonks:
- 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 did not remove 3rd useless sound for maintaining mutator integrity and compatibility.

I might want to bet that this mutator is supporting a delayed start. If not, explain me why... I'm such a curious person...
UncodeX Stuff
Not often maintained
My UT Mapping works...
Learn the rules like a pro, so you can break them like an artist.
- Pablo Picasso -
User avatar
SC]-[WARTZ_{HoF}
Site Admin
Posts: 426
Joined: Wed May 10, 2017 7:08 am

Re: Those obsolete ones

Post by SC]-[WARTZ_{HoF} »

I can't recall whom made this version of QFB. Your guess is as good as mine.
User avatar
Kelly
Posts: 185
Joined: Fri Sep 29, 2017 1:54 pm
Location: Coos Bay Oregon

Re: Those obsolete ones

Post by Kelly »

I ripped it from Smiling Monster's file server and made an MH version. I don't know if this one is it though or someone made another version. That doesn't look like my code. My stuff almost always uses three space indents. I just like the way that looks, all compact and neat.
I don’t wanna give the end away
but we’re gonna die one day
Post Reply