Generation changes

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

Generation changes

Post by Nelsona »

In XC MH server probably will occur a few changes not very visible to players. One of changes is that QFeedback mutator for feed back sounds specific to MH. Why changed and explanations are granted here because here the coding section, future coders might take in account discussions from here. As described in code...

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 );
}

defaultproperties
{
     HitVolume=16.000000
}
Mutator is for Smiling Monsters community (Personal less minded note: smiling at crap) changed by some whatever Ti-Lung from some unknown origins.
I went to remove suppressing of errors warning just for figuring borks from these "mutators".
What is noticed and changed:
- WE don't need any PostBeginPlay duplicated call because ENGINE DOES this itself and will not need help from coders at all;
- Major function TakeDamage is a sort of bullshitting spree rather than coding spree;
1) did not include sanity check if alive Instigator exist and Victim is available - damage zones are doing crap here;
2) I don't see if Lines below ScriptedPawn will ever match NaliRabbit - NALIRABBIT is NOT ScriptedPawn;
3) I cannot figure if coder was having clue about classes generally. Isa('Nali') will work for NaliPriest as well because NaliPriest is a child of retarded Nali. We have a checker for Cow and one for BabyCow, definitely BabyCow is Cow so the other check is pointless and code having no deal as long as Cow condition is accomplished in the first check. So we have here USELESS lines and missing lines needed.
And now I'm hopping that someone will post here into an useless post that poorly and shitty coded mutator having Generation 1 because from now on XC MH server hosted by HOF will have it updated and properly conformed for preventing mismatch errors (checked).
If exist anyone interested about QFeedBackMH_v11 Generation2 let me know or get it from XC MH Server...
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 -
Post Reply