GetDamageDealtByType(int)
Determines the amount of damage of a specific type dealt to an object.
int GetDamageDealtByType( int nDamageType );
Parameters
nDamageType
Description
Returns the amount of damage of type nDamageType that has been dealt to the caller. When called from the OnDamaged event, this function returns only the damage which was caused during that event.
nDamageType can be assigned to OR-ed values from the constant group DAMAGE_TYPE_*.
For example, GetDamageDealtByType(DAMAGE_TYPE_PIERCING | DAMAGE_TYPE_SLASHING) would return the damage dealt by piercing and slashing attacks.
Remarks
This only works with EffectDamage, as detailed below.
Known Bugs
Only EffectDamage will make this anything else then the default, so phisical damage (and probably elemental damage from weapons) will actually not bring up 1 or more.
A workaround might be to have GetTotalDamageDealt and subtract all the damage types in GetDamageDealtByType.
DAMAGE_TYPE_SONIC will always return 0.
Version
1.61
Example
// If we had any fire damage applied to us, we will say some catchline. void main() { if(GetDamageDealtByType(DAMAGE_TYPE_FIRE) >= 1) { // Obviously a high-strung-evangilist voiceset helps. SpeakString("Hey, baby, I'm on FIIIREEEEE!"); } }
See Also
categories: | Action on Object Functions |
constants: | DAMAGE_TYPE_* Constants |
author: Tom Cassiotis, editor: Jasperre, additional contributor(s): Peter Westergaard, Jassper, Undivine, NetRacer56, Ryan Workman, Dan Wyman
Send comments on this topic.