SectorDamage: Difference between revisions
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
:Any other flags are reserved and must be avoided, because the behaviour may change in future Eternity versions. | :Any other flags are reserved and must be avoided, because the behaviour may change in future Eternity versions. | ||
|examples= | |examples= | ||
This will apply 15% damage to all players in sector(s) tagged 1, if they're not wearing a radiation suit, regardless if they're touching the floor or not. If any of them dies, they get the slime/nukage obituary | This will apply 15% damage to all players in sector(s) tagged 1, if they're not wearing a radiation suit, regardless if they're touching the floor or not. If any of them dies, they get the slime/nukage obituary: | ||
SectorDamage(1, 15, "Slime", "PowerIronFeet", DAMAGE_PLAYERS <nowiki>|</nowiki> DAMAGE_IN_AIR); | SectorDamage(1, 15, "Slime", "PowerIronFeet", DAMAGE_PLAYERS <nowiki>|</nowiki> DAMAGE_IN_AIR); | ||
Other usable ''protection'' examples: <code>"Shotgun"</code> ('''[[weaponinfo]]''') or <code>"RedSkull"</code> ('''[[EDF_item_effects_and_inventory#artifact|artifact]]'''). | |||
This applies damage to everyone, with a default "died" obituary in case of death, and no protection: | |||
SectorDamage(1, 35, "", "", DAMAGE_PLAYERS <nowiki>|</nowiki> DAMAGE_NONPLAYERS <nowiki>|</nowiki> DAMAGE_IN_AIR); | |||
|notes= | |notes= | ||
You need to set ''flags'' to at least '''DAMAGE_PLAYERS''' or '''DAMAGE_NONPLAYERS''', otherwise this function will have no effect. | You need to set ''flags'' to at least '''DAMAGE_PLAYERS''' or '''DAMAGE_NONPLAYERS''', otherwise this function will have no effect. |
Revision as of 04:26, 2 January 2022
Description
This is an ACS built-in function.
Damages all things inside tagged sectors.
Usage
void SectorDamage(int tag, int amount, str type, str protection, int flags)
Parameters
- tag: tag of sectors whose things will take damage.
- amount: how much damage to inflict on each thing.
- type: damagetype i.e. the kind of attack to inflict on each thing, for purposes such as damage resistance or obituary. Use
""
for no specific damage type (this is the general default behaviour in Doom). - protection: optional name of inventory item (the name of an artifact or weaponinfo EDF block) or power-up effect (use one of the options of its type field, e.g. PowerIronFeet) which, if present, will protect players in tagged sectors from taking damage. Use
""
for no protection. - flags: a combination of 0 or more of the following:
- 1 or DAMAGE_PLAYERS: if set, it can damage players from sectors.
- 2 or DAMAGE_NONPLAYERS: if set, it can damage monsters and any non-player destructibles from sectors.
- 4 or DAMAGE_IN_AIR: if set, it can damage things which don't touch the floor. By default they must rest on the floor to take damage.
- Any other flags are reserved and must be avoided, because the behaviour may change in future Eternity versions.
Return value
None.
Examples
This will apply 15% damage to all players in sector(s) tagged 1, if they're not wearing a radiation suit, regardless if they're touching the floor or not. If any of them dies, they get the slime/nukage obituary:
SectorDamage(1, 15, "Slime", "PowerIronFeet", DAMAGE_PLAYERS | DAMAGE_IN_AIR);
Other usable protection examples: "Shotgun"
(weaponinfo) or "RedSkull"
(artifact).
This applies damage to everyone, with a default "died" obituary in case of death, and no protection:
SectorDamage(1, 35, "", "", DAMAGE_PLAYERS | DAMAGE_NONPLAYERS | DAMAGE_IN_AIR);
Notes
You need to set flags to at least DAMAGE_PLAYERS or DAMAGE_NONPLAYERS, otherwise this function will have no effect.
Beware that this will not damage things flagged NOSECTOR. Use the DONTDRAW thing type flag if you want such invisible things to be harmed by SectorDamage.
This function only applies immediate damage. It does not turn the tagged sectors into continually damaging areas.
This function's identification in zspecial.acs
is: ACC internal.