A Explode: Difference between revisions

From ZDoom Wiki
Jump to navigation Jump to search
No edit summary
(Added return value and an example)
Line 1: Line 1:
{{codepointer|Generic Attack}}
__NOTOC__{{codepointer|Generic Attack}}
'''A_Explode''' [(int ''explosiondamage'' [, int ''explosionradius'' [, int ''flags'' [, bool ''alert''[, int ''fulldamageradius''[, int ''nails''[, int ''naildamage''[, str ''pufftype'']]]]]]])]
'''A_Explode''' [(int ''explosiondamage'' [, int ''explosionradius'' [, int ''flags'' [, bool ''alert'' [, int ''fulldamageradius'' [, int ''nails'' [, int ''naildamage'' [, str ''pufftype'']]]]]]])]<br>
'''A_Explode''' [(int ''explosiondamage'' [, int ''explosionradius'' [, int ''flags'' [, bool ''alert''[, int ''fulldamageradius''[, int ''nails''[, int ''naildamage''[, str ''pufftype''[, name ''damagetype'']]]]]]]])] {{git|aa2ca77}}
int '''A_Explode''' [(int ''explosiondamage'' [, int ''explosionradius'' [, int ''flags'' [, bool ''alert'' [, int ''fulldamageradius'' [, int ''nails'' [, int ''naildamage'' [, str ''pufftype'']]]]]]])] {{git|ec14dd9}}<br>
int '''A_Explode''' [(int ''explosiondamage'' [, int ''explosionradius'' [, int ''flags'' [, bool ''alert'' [, int ''fulldamageradius'' [, int ''nails'' [, int ''naildamage'' [, str ''pufftype'' [, str ''damagetype'']]]]]]]])] {{git|aa2ca77}}

== Usage ==
== Usage ==


Performs an explosive (radius) attack.
Performs an explosive (radius) attack. The amount of damage and the attack's radius are specified with ''explosiondamage'' and ''explosionradius'', respectively. If the actor is a missile, you can set ''hurtshooter'' to 0 so that its originator will not be harmed by the attack. If the ''hurtshooter'' parameter is omitted, the shot will assume normal behavior and damage the shooter.


=== Parameters ===
=== Parameters ===


* ''explosiondamage'': How much damage are inflicted at the center of the explosion. (Default: 128)
* ''explosiondamage'': How much damage is inflicted at the center of the explosion. Default is 128.
* ''explosionradius'': The area covered by the damage (damage inflicted drop linearly with distance). Note that a radius larger than 32767 extends beyond ZDoom's map space limitations, and will overflow with undesired results (such as becoming too small and damaging nothing). (Default: 128)
* ''explosionradius'': The area covered by the damage (damage inflicted drop linearly with distance). Note that a radius larger than 32767 extends beyond ZDoom's map space limitations, and will overflow with undesired results (such as becoming too small and damaging nothing). Default is 128.
* ''flags'': The following flags can be combined by using the <tt>|</tt> character between the constant names:
* ''flags'': The following flags can be combined by using the {{!}} character between the constant names:
** '''XF_HURTSOURCE'''&nbsp;&mdash; Hurts the source: if set, the source can be damaged by the explosion. Note that the source is not necessarily the calling actor. This flag is set by default.
** '''XF_HURTSOURCE'''&nbsp;&mdash; Hurts the source: if set, the source can be damaged by the explosion. Note that the source is not necessarily the calling actor. This flag is set by default.
** '''XF_NOTMISSILE'''&nbsp;&mdash; Not a missile: if set, the calling actor is considered to be the source. By default, the calling actor is assumed to be a projectile, and the source is therefore considered to be the calling actor's [[actor pointer|target]].
** '''XF_NOTMISSILE'''&nbsp;&mdash; Not a missile: if set, the calling actor is considered to be the source. By default, the calling actor is assumed to be a projectile, and the source is therefore considered to be the calling actor's [[actor pointer|target]].
** '''XF_NOACTORTYPE''' - The damagetype parameter will never change to the actor's damagetype. {{git|aa2ca77}}
** '''XF_EXPLICITDAMAGETYPE''' {{git|aa2ca77}} &nbsp;&mdash; the damagetype parameter will never change to the actor's damagetype.
* ''alert'': Whether the explosion rings the alarm? (Default: false)
* ''alert'': Whether the explosion rings the alarm? Default is ''false''.
* ''fulldamageradius'': The area within which full damage is inflicted. (Default: 0)
* ''fulldamageradius'': The area within which full damage is inflicted. Default is 0.
* ''nails'': The number of horizontal hitscan attacks performed in a ring. (Default: 0) A value of 30 emulates the A_NailBomb codepointer from [[SMMU]], while still allowing to modify all other parameters from '''A_Explode'''.
* ''nails'': The number of horizontal hitscan attacks performed in a ring. Default is 0. A value of 30 emulates the A_NailBomb codepointer from [[SMMU]], while still allowing to modify all other parameters from '''A_Explode'''.
* ''naildamage'': The amount of damage inflicted by nails, if any. (Default: 10)
* ''naildamage'': The amount of damage inflicted by nails, if any. Default is 10.
* ''pufftype'': The name of the puff to use upon calling the explosion, originating from the actor's center. If nothing is supplied, {{Class|BulletPuff}} is used.
* ''pufftype'': The name of the puff to use upon calling the explosion, originating from the actor's center. If nothing is supplied, {{Class|BulletPuff}} is used.
* ''damagetype'': The damagetype to use for the damage of this function rather than the actor's damagetype. Defaults to none. If left as is without XF_NOACTORTYPE, will use the actor's damagetype instead. {{git|aa2ca77}}
* ''damagetype'': The damagetype to use for the damage of this function rather than the actor's damagetype. Defaults to none. If left as is without XF_EXPLICITDAMAGETYPE, will use the actor's damagetype instead. {{git|aa2ca77}}

'''Do not use the old actor property method of passing the parameters. Only use the parameters of '''A_Explode''' directly.'''
'''Do not use the old actor property method of passing the parameters. Only use the parameters of '''A_Explode''' directly.'''

=== Return value ===

The return value of the function is the number of damaged actors.


== Examples ==
== Examples ==
Line 37: Line 44:
Stop
Stop
}
}
}


Whenever this rocket explodes, it logs the number of actors which got damaged by its splash effect.
ACTOR SmartRocket : {{Class|Rocket}}
{
States
{
Death:
MISL B 8 Bright [[A_LogInt]]([[A_Explode]])
Goto Super::Death+1
}
}
}

Revision as of 12:39, 16 August 2016

A_Explode [(int explosiondamage [, int explosionradius [, int flags [, bool alert [, int fulldamageradius [, int nails [, int naildamage [, str pufftype]]]]]]])]
int A_Explode [(int explosiondamage [, int explosionradius [, int flags [, bool alert [, int fulldamageradius [, int nails [, int naildamage [, str pufftype]]]]]]])] (development version ec14dd9 only)
int A_Explode [(int explosiondamage [, int explosionradius [, int flags [, bool alert [, int fulldamageradius [, int nails [, int naildamage [, str pufftype [, str damagetype]]]]]]]])] (development version aa2ca77 only)

Usage

Performs an explosive (radius) attack.

Parameters

  • explosiondamage: How much damage is inflicted at the center of the explosion. Default is 128.
  • explosionradius: The area covered by the damage (damage inflicted drop linearly with distance). Note that a radius larger than 32767 extends beyond ZDoom's map space limitations, and will overflow with undesired results (such as becoming too small and damaging nothing). Default is 128.
  • flags: The following flags can be combined by using the | character between the constant names:
    • XF_HURTSOURCE — Hurts the source: if set, the source can be damaged by the explosion. Note that the source is not necessarily the calling actor. This flag is set by default.
    • XF_NOTMISSILE — Not a missile: if set, the calling actor is considered to be the source. By default, the calling actor is assumed to be a projectile, and the source is therefore considered to be the calling actor's target.
    • XF_EXPLICITDAMAGETYPE (development version aa2ca77 only)  — the damagetype parameter will never change to the actor's damagetype.
  • alert: Whether the explosion rings the alarm? Default is false.
  • fulldamageradius: The area within which full damage is inflicted. Default is 0.
  • nails: The number of horizontal hitscan attacks performed in a ring. Default is 0. A value of 30 emulates the A_NailBomb codepointer from SMMU, while still allowing to modify all other parameters from A_Explode.
  • naildamage: The amount of damage inflicted by nails, if any. Default is 10.
  • pufftype: The name of the puff to use upon calling the explosion, originating from the actor's center. If nothing is supplied, BulletPuff is used.
  • damagetype: The damagetype to use for the damage of this function rather than the actor's damagetype. Defaults to none. If left as is without XF_EXPLICITDAMAGETYPE, will use the actor's damagetype instead. (development version aa2ca77 only)

Do not use the old actor property method of passing the parameters. Only use the parameters of A_Explode directly.

Return value

The return value of the function is the number of damaged actors.

Examples

Actor MyGrenade : Grenade
{
	Speed 17
	BounceFactor 0.4
	BounceCount 6
	States
	{
	Death:
		QEX1 A 0 A_PlaySound("Weapon/GenericExplode", CHAN_WEAPON)
		QEX1 A 5 A_Explode(100, 128)
		QEX1 BCDE 5
		Stop
	}
}


Whenever this rocket explodes, it logs the number of actors which got damaged by its splash effect.

ACTOR SmartRocket : Rocket
{
    States
    {
    Death:
        MISL B 8 Bright A_LogInt(A_Explode)
        Goto Super::Death+1
    }
}