EVENT DAMAGESPRITE: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Fox (talk | contribs)
Created page with "'''EVENT_DAMAGESPRITE''' is a Game Event. This event is triggered whenever a sprite is hit by a weapon, however it is executed before the damage. This..."
 
m Document return values in more detail
Line 1: Line 1:
'''EVENT_DAMAGESPRITE''' is a [[EDuke32_event_list|Game Event]].
'''EVENT_DAMAGESPRITE''' is a [[EDuke32_event_list|Game Event]].


This event is triggered whenever a sprite is hit by a weapon, however it is executed before the damage.
This event is only executed if the tilenum was set with [[damageeventtile]] and [[damageeventtilerange]].


This event is only executed if the tilenum was set with [[damageeventtile]] and [[damageeventtilerange]].
This event is triggered whenever a sprite is hit by a weapon, however it is executed before the damage is actually accumulated in [[htextra]].


[[THISACTOR]] equals the ID of the projectile or source of damage.
[[THISACTOR]] equals the ID of the projectile or source of damage.


[[RETURN]] or the userdef [[return (userdef)|return]] 0 equals the ID of what is being damaged.
[[RETURN]] contains the ID of the sprite that is being damaged. If you set this to -1, you can skip damage application entirely, in which case no damage is accumulated in [[htextra]], and [[EVENT_POSTDAMAGESPRITE]] will not occur.
 
See also [[EVENT_DAMAGEFLOOR]], [[EVENT_DAMAGECEILING]], [[EVENT_DAMAGEWALL]] and [[EVENT_POSTDAMAGESPRITE]].
 
== Return Values ==
 
The return values of this event are only set if the damage type is RADIUSDAMAGE.
 
Note that radius damage is hard-coded to override all previously accumulated damage in a single tic. To bypass this, set RETURN to -1 and use the following values to apply the radius damage manually.
 
:; userdef.return 0 (alias RETURN)
:: Is set to the spritenum of the sprite being damaged. Set to -1 to skip applying the damage entirely. Cannot be used to change the destination of the damage.
 
:; userdef.return 1
:: Contains the blast radius if the damage type was radius damage. This value is set to -1 if no radius damage occurred.
 
:; userdef.return 2
:: Contains the damage dealt in the outermost blast radius area. (usually defined to be the lowest)


The userdef return 1 through 5 equals the [[hitradius]] parameters. If there's no radius damage, return 1 equals -1.
:; userdef.return 3
:: Contains the damage dealt in the second to outermost blast radius area.


See also [[EVENT_DAMAGEFLOOR]], [[EVENT_DAMAGECEILING]], [[EVENT_DAMAGEWALL]] and [[EVENT_POSTDAMAGESPRITE]].
:; userdef.return 4
:: Contains the damage dealt in the second to innermost blast radius area.
 
:; userdef.return 5
:: Contains the damage dealt in the innermost blast radius area. (usually defined to be the highest)

Revision as of 03:18, 18 December 2021

EVENT_DAMAGESPRITE is a Game Event.

This event is only executed if the tilenum was set with damageeventtile and damageeventtilerange.

This event is triggered whenever a sprite is hit by a weapon, however it is executed before the damage is actually accumulated in htextra.

THISACTOR equals the ID of the projectile or source of damage.

RETURN contains the ID of the sprite that is being damaged. If you set this to -1, you can skip damage application entirely, in which case no damage is accumulated in htextra, and EVENT_POSTDAMAGESPRITE will not occur.

See also EVENT_DAMAGEFLOOR, EVENT_DAMAGECEILING, EVENT_DAMAGEWALL and EVENT_POSTDAMAGESPRITE.

Return Values

The return values of this event are only set if the damage type is RADIUSDAMAGE.

Note that radius damage is hard-coded to override all previously accumulated damage in a single tic. To bypass this, set RETURN to -1 and use the following values to apply the radius damage manually.

userdef.return 0 (alias RETURN)
Is set to the spritenum of the sprite being damaged. Set to -1 to skip applying the damage entirely. Cannot be used to change the destination of the damage.
userdef.return 1
Contains the blast radius if the damage type was radius damage. This value is set to -1 if no radius damage occurred.
userdef.return 2
Contains the damage dealt in the outermost blast radius area. (usually defined to be the lowest)
userdef.return 3
Contains the damage dealt in the second to outermost blast radius area.
userdef.return 4
Contains the damage dealt in the second to innermost blast radius area.
userdef.return 5
Contains the damage dealt in the innermost blast radius area. (usually defined to be the highest)