A_KillTarget

From ZDoom Wiki
Jump to navigation Jump to search

A_KillTarget [(string damagetype [, int flags [, string filter [, string species [, int src [, int inflict]]]]])]

Usage

Kills the calling actor's target. Optionally, a damage type can be given. Note that damage inflicted by this codepointer is not affected by damage factors.

Parameters

  • damagetype: if the actor dies, the actor will enter a death state based on the specified damage type if present (or pain state if using NODAMAGE). Default is "None"
  • flags: the following flags can be combined using the | character between name constants:
    • KILS_FOILINVUL - kills monsters and/or missiles that have the INVULNERABLE flag.
    • KILS_KILLMISSILES - causes missiles that are affected to enter their death state. Note that this follows the INVULNERABLE and NODAMAGE rules for monsters.
    • KILS_NOMONSTERS - do not target monsters with this function. Alone, it makes the function do nothing, but can be combined with KILS_KILLMISSILES to only affect missiles.
    • KILS_FOILBUDDHA — the buddha effect is ignored when attempting to kill the actor.
    • KILS_EXFILTER — inverts the case of the class name filter; the calling actor's target is only killed if its class name does not match the value passed to filter.
    • KILS_EXSPECIES — inverts the case of the species filter; the calling actor's target is only killed if its species does not match the value passed to species.
    • KILS_EITHER — the calling actor's target is killed if either of its class name or species matches the values passed to filter and species, respectively.
  • filter: the actor class to kill. The calling actor's target is only killed if its class name matches the specified filter class. Default is "None".
  • species: the actor species to kill. The calling actor's target is only killed if its species matches the specified species filter. Default is "None".
  • src: Indicates the actor pointer responsible for dealing the damage. A monster dealing the damage should use AAPTR_DEFAULT, and missiles should use AAPTR_TARGET (so monsters can identify missiles belonging to their owners and give proper credit for the kill). Default is AAPTR_DEFAULT.
  • inflict: The actor doing the actual damage. By changing this, the actor's flags upon the pointed actor are taken into account instead of the calling actor's own.

Examples

This cyberdemon kills target by Psi-wave with chance less than 1%:

Actor PsiCyber4ZDoomWiki: Cyberdemon replaces Cyberdemon
{
 States
 {
 Missile:
   CYBR E 0 A_Jump( 1, "PsiKill" )
   CYBR E 6 A_FaceTarget
   CYBR F 12 A_CyberAttack
   CYBR E 12 A_FaceTarget
   CYBR F 12 A_CyberAttack
   CYBR E 12 A_FaceTarget
   CYBR F 12 A_CyberAttack
   Goto See
 PsiKill:
   CYBR E 0 A_PlaySound( "cyber/sight", CHAN_VOICE )
   CYBR E 12 Bright A_FaceTarget
   CYBR E 12 A_FaceTarget
   CYBR E 8 Bright A_FaceTarget
   CYBR E 8 A_FaceTarget
   CYBR E 4 Bright A_FaceTarget
   CYBR E 4 A_FaceTarget
   CYBR E 2 Bright A_FaceTarget
   CYBR E 2 A_FaceTarget
   CYBR F 20 A_KillTarget( "PsiDmg" )
   Goto See
 }
}