| Home Page | Recent Changes

SpeciesGameRules

UT2003 :: Actor >> Info >> GameRules >> SpeciesGameRules (Package: XGame)

The SpeciesGameRules affects the amount of damage a particular species deals and recieves in the game. Species are defined in subclasses in of SpeciesType and contain their augmented damage ratios in their respective defaultproperties.

Known SpeciesType Subclasses

 SpeciesType
    +-SPECIES_Alien?  
    +-SPECIES_Bot?
    +-SPECIES_Human?
    |   +-SPECIES_Egypt?
    |   +-SPECIES_Merc?
    |   +-SPECIES_Night?
    +-SPECIES_Jugg?

Methods

int NetDamage( int OriginalDamage, int Damage, Pawn injured, Pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType )
Augments the amount of damage done by a specific species in the game.

Code Walkthrough.

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

class SpeciesGameRules extends GameRules;
        
function int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType )
{
    if ( NextGameRules != None )
        return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
    if ( xPawn(injured) != None )
        Damage = xPawn(injured).Species.static.ModifyReceivedDamage(Damage,injured,instigatedBy,HitLocation,Momentum,DamageType);
    if ( (InstigatedBy != Injured) && (xPawn(InstigatedBy) != None) )
        Damage = xPawn(InstigatedBy).Species.static.ModifyImpartedDamage(Damage,injured,instigatedBy,HitLocation,Momentum,DamageType);
    return Damage;
}

The block of code handles three things: Allows the other GameRules modifiers to go first; Calculates the damage recieved by the xPawn; Calculates the damage Imparted by the xPawn.

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.

Here is a list of damage received and imparted modifiers.

NetDamange Table

Species Imparted Received
Alien 1.000000 1.300000
Bot 1.200000 1.200000
Human_Egypt 1.000000 1.200000
Human_Merc 1.000000 1.000000
Human_Night Affected By Health 0.700000
Jugg 1.000000 0.700000

Discussion

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


Category Class (UT2003)

Category Class (UT2004)

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In