Gah - a solution with more questions. – EntropicLqd
The DamageType class in UT's Class Hierarchy creates quite some confusion. It was intended to contain more specific information about how this kind of damage acts. However the TakeDamage and HurtRadius functions (these are used to damage Actors) only take a variable of type Name which cannot be used to access classes like the DamageType subclasses.
How do damage types work?
Damage types are passed as the last parameter of the TakeDamage function:
function TakeDamage (int Damage, Pawn InstigatedBy, vector HitLocation, vector Momentum, name DamageType)
Usually the DamageType parameter isn't used unless the damaged actor is a Pawn. In that case several other actors have the opportunity to reduce the amount of damage the Pawn receives.
First the current GameInfo (UT)'s ReduceDamage function is called. This function returns 0 if the player is in a zone with bNeutralZone = True. Otherwise multiplies the damage by 1.5 if the game runs in Hardcore or Turbo mode and also by the DamageScaling property of the Pawn who was responsible for the damage. In team games the friendly fire scaling is also applied here. Custom GameInfo subclasses could also reduce the damage based on the damage type.
The next step depends on the Pawn's bIsPlayer property. If it is True then there are three possibilities:
- The Pawn's ReducedDamageType property has the value 'All'. In this case the actual damage is set to 0.
- The Pawn's inventory list is not empty. The first Inventory (UT) item gets a ReduceDamage call. The items create a temporary list of armor items sorted by the items' armor priorities based on the damage type and reduce the damage. As long as the damage is not 0 the next item in that list may reduce the damage through the ArmorAbsorbDamage function. (see Armor Damage Absorption for details)
- The Pawn's inventory list is empty. The damage remains unchanged.
If bIsPlayer is False there are also two possibilities:
- The attacker is either a parent class or a subclass of the damaged Pawn. The actual damage is multiplied by the lower value of either 1 - ReducedDamagePct (a Pawn class property) or 0.35.
- The Pawn's ReducedDamageType property has the value 'All' or is equal to the DamageType parameter. The actual damage is multiplied by 1 - ReducedDamagePct.
Then the registered damage mutators are allowed to further adjust the damage (even if it is already 0) through their MutatorTakeDamage function.
Now the damage can be applied.
If the health now goes below 0 the Pawn's Died function is called. Again the damage type is passed as a parameter:
function Died (Pawn Killer, name DamageType, vector HitLocation)
The first thing this function does is ask the mutators if the Pawn may die by calling the PreventDeath function of the game type's BaseMutator. If it returns True the Pawn will not die. If it returns False the Killed function is called on all Pawns (including this one) and the GameInfo.
The GameInfo's Killed function is responsible for displaying all those kill-related messages. It also call's the GameInfo's ScoreKill function which in turn calls the ScoreKill function of the BaseMutator.
Special damage type death messages
A kill is considered as a suicide if either the killer is None or killer and victim are the same Pawn.
- "<killed player's name> left a small crater."
- "<killed player's name> was blown up."
- "<killed player's name> forgot to come up for air."
- "<killed player's name> was incinerated."
- "<killed player's name> was slimed."
- "<killed player's name> was blown up by a mortar."
- (any other)
- "<killed player's name> killed his/her own dumb self."
Player vs player kills
(Both the killer and the victim have bIsPlayer = True.)
If the damage type is not listed here, the DeathMessage of the weapon the killer currently has selected will be used. If the killer has no weapon (e.g. when he is dead) the message will empty.
- The LevelInfo's SpecialDamageString is used as death message.
- "<victim's player name> was vaporized by <killer's player name>'s Redeemer!!"
- 'RocketDeath', 'GrenadeDeath'
- "<victim's player name> was smacked down by <killer's player name>'s Rocket Launcher!!"
- "<victim's player name> was eradicated by the unholy power of <killer's player name>!!"
- "<victim's player name> was telefragged by <killer's player name>!"