| Home Page | Recent Changes | Preferences

BigHeadRules

UT2003 :: Actor >> Info >> GameRules >> BigHeadRules (Package: UnrealGame)

The BigHeadRules class affects the gameplay be increasing the size of the Controller's head after they have made a kill.

Properties

None

Variables

BigHeadMutator
is an object of the MutBigHead? class which is used to GetHeadScaleFor the Pawn that has performed the successfully killed another Controller.

Methods

ScoreKill (Controller Killer, Controller Killed)
Augments the size of the Killer's head after they have made a successful kill of another Controller.

Known Subclases

None

Code Walkthrough.

I thought that these would be useful examples to further demonstrate writing a GameRules for your game.

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

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

Category Class (UT2003)

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In