There is no spoon

Legacy:UTClassicGameRules

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT2003 :: Actor >> Info >> GameRules >> UTClassicGameRules (Package: XGame)

The UTClassicGameRules augments the damage dealing process in the game by increasing the damage by 20%.

Properties[edit]

None

Methods[edit]

int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType ) 
Augments the damage dealing process by increasing the damage by 20%.

Known Subclases[edit]

None

Code Walkthrough.[edit]

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

class UTClassicGameRules extends GameRules;
 
function int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType )
{
    Damage = Damage * 1.2;
    if ( NextGameRules != None )
        return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
    return Damage;
}

The block of code handles two things: Increases the NetDamage done by 20% and then allows the other GameRules modifiers to go first.

This GameRules allows all other GameRules to affect the NetDamage before it augments the damage in play. If you neglect giving the other GameRules a chance to augment NetDamage, then all other GameRules loaded after this GameRules will not have a chance to augment play.