Legacy:BigHeadRules - Unreal Wiki

# Legacy:BigHeadRules

### From Unreal Wiki, The Unreal Engine Documentation Site

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.

## Properties

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

## Functions

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) )
                    Killer.Pawn.SetHeadScale(BigHeadMutator.GetHeadScaleFor(Killer.Pawn));

            if ( NextGameRules != None )
                    NextGameRules.ScoreKill(Killer,Killed);
    }

    defaultproperties
    {
    }

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;
            else
                    NewScale = (P.PlayerReplicationInfo.Score+1)/(P.PlayerReplicationInfo.Deaths+1);
            return FClamp(NewScale, 0.5, 4.0);
    }

## Related Topics

- Mutator Topics
- MutBigWheel – UT2004 only

## Discussion

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. :)

Categories: Legacy Class (UT2003) | Legacy Class (UT2004) | Legacy Tutorial

##### Views

- Legacy
- Discussion
- Current revision

##### Search