Htextra: Difference between revisions
No edit summary |
TrooperDan (talk | contribs) No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
htextra is the amount of damage | htextra is the amount of damage, if any, being incurred on the sprite. htextra has a default value of -1, which means that no damage is being incurred. | ||
Example: | Example: | ||
getactor[THISACTOR].htextra | getactor[THISACTOR].htextra RETURN | ||
This would set RETURN to the amount of damage [[THISACTOR]] is taking (if any). This amount can be modified before the actor processes any damage. If you want no damage be taken, set to -1 (the default value), not 0. The value 0 is used when actors are hit by SHRINKSPARK. | |||
Modifying the htextra value can be used to increase, decrease, or otherwise simulate damage from a weapon. | |||
The command ifhitweapon is true when htextra is greater than -1, so setting it to a positive value will register as damage. Important note: the ifhitweapon CON command will cause the actor to process damage, decreasing the actor's extra member by the amount of htextra and resetting htextra to -1. Therefore, in order to modify damage taken by an enemy, manipulation of htextra should occur in the actor's code before a call to ifhitweapon is made. | |||
[[Category:Sprite structure members]] | [[Category:Sprite structure members]] |
Latest revision as of 16:37, 3 July 2022
htextra is the amount of damage, if any, being incurred on the sprite. htextra has a default value of -1, which means that no damage is being incurred.
Example:
getactor[THISACTOR].htextra RETURN
This would set RETURN to the amount of damage THISACTOR is taking (if any). This amount can be modified before the actor processes any damage. If you want no damage be taken, set to -1 (the default value), not 0. The value 0 is used when actors are hit by SHRINKSPARK.
Modifying the htextra value can be used to increase, decrease, or otherwise simulate damage from a weapon. The command ifhitweapon is true when htextra is greater than -1, so setting it to a positive value will register as damage. Important note: the ifhitweapon CON command will cause the actor to process damage, decreasing the actor's extra member by the amount of htextra and resetting htextra to -1. Therefore, in order to modify damage taken by an enemy, manipulation of htextra should occur in the actor's code before a call to ifhitweapon is made.