I'm a doctor, not a mechanic


From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 13:51, 16 December 2005 by SuperApe (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
UT2003 :: Actor >> Info >> GameRules >> BigHeadRules (Package: UnrealGame)

The BigHeadRules class affects the size of the Pawn's head after they have made a kill or died.


The MutBigHead object associated with this GameRules actor, which is used to GetHeadScaleFor after a controlled Pawn has successfully killed another Pawn.


ScoreKill ( Controller Killer, Controller Killed ) 
Alters the size of the Killer's head, based on Deaths vs Score, after any kill is made.

Source Code Walkthrough

This might be useful to further demonstrate custom GameRules scripting.

class BigHeadRules extends GameRules;
var MutBigHead BigHeadMutator;
function ScoreKill(Controller Killer, Controller Killed)
	if ( (Killer != None) && (Killer.Pawn != None) )
	if ( NextGameRules != None )

First lets look after the action, at the use of the variable NextGameRules. NextGameRules is the next GameRules in the linked list of GameRules. If you neglect to add these two lines of code in a GameRules function, any GameRules loaded after this GameRules will not have a chance to augment play.

This simply states that if the Killer exists and that the Killer happens to be a Pawn, then in fact increase the size of the head on the Killer's Pawn. The size factor is determined by the function GetHeadScaleFor inside MutBigHead.

function float GetHeadScaleFor(Pawn P)
	local float NewScale;
	if ( abs(P.PlayerReplicationInfo.Deaths) < 1 )
		NewScale = P.PlayerReplicationInfo.Score + 1;
		NewScale = (P.PlayerReplicationInfo.Score+1)/(P.PlayerReplicationInfo.Deaths+1);
	return FClamp(NewScale, 0.5, 4.0);	

Related Topics


Burtlo: Thought I would use the subclasses as a great oppurtunity to show how GameRules work.

SuperApe: Fine idea. I've also used the code for this and MutVampire to learn about GameRules and Mutator classes. Nice and concice. :)