Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel

Legacy:SpeciesGameRules

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 19:24, 30 November 2005 by SuperApe (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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[edit]

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

Methods[edit]

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.[edit]

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[edit]

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[edit]

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