A_FaceTarget

From ZDoom Wiki
(Redirected from A FaceMaster)
Jump to navigation Jump to search
DoomWiki.org
For more information on this article, visit the A_FaceTarget page on the Doom Wiki.

void A_FaceTarget [(double max_turn [, double max_pitch [, double ang_offset [, double pitch_offset [, int flags [, double z_ofs]]]]])]
void A_FaceTracer [(double max_turn [, double max_pitch [, double ang_offset [, double pitch_offset [, int flags [, double z_ofs]]]]])]
void A_FaceMaster [(double max_turn [, double max_pitch [, double ang_offset [, double pitch_offset [, int flags [, double z_ofs]]]]])]

Usage

Change the calling actor's angle to face a specific actor, depending on the chosen function.

  • A_FaceTarget changes the angle to face the calling actor's target.
  • A_FaceTracer changes the angle to face the calling actor's tracer.
  • A_FaceMaster changes the angle to face the calling actor's master.

Parameters

  • max_turn: The maximum turn angle; the calling actor cannot turn by more than said angle, however the SHADOW flag has no effect in such case. A value of 0 is interpreted as unlimited angle. Default is 0.
  • max_pitch: If specified to a value no greater than 180, then the calling actor's pitch is adjusted up to said value to face the actor. A value of 0 is interpreted as unlimited angle; and technically a pitch change will never be greater than 180 degrees. It will also aim at the actor's feet when set to 0. Default is 270, which means its disabled.
  • ang_offset: Specifies the amount of degrees to offset the actor's angle by. Positive values turn it left, while negative values turn it right. This is factored in after max_turn is performed. Due to limitations, distance is not factored in. Default is 0.
  • pitch_offset: Adjusts the pitch by this many degrees after max_pitch has been taken into account. Default is 0.
  • flags: Customizes the behavior of the function. Multiple flags can be combined by using the bitwise OR operator (|) between the constant names:
    • FAF_BOTTOM — Aim for the bottom of the actor, otherwise known as the raw Z position. Whenever max_pitch is taken into account, it will aim towards the actor's feet + 32 units above. This flag disables adding that 32 units.
    • FAF_MIDDLE — Aim for the middle of the actor (z position + height / 2).
    • FAF_TOP — Aim for the top of the actor (z position + height).
Note that all of these flags are taken into account first before anything else.
Default is 0.
  • z_ofs: Offsets the z position distance of the actor to face by this amount. Unlike pitch_offset, this takes into account how far away the actor is at all times. Default is 0.

Examples

Almost every monster uses A_FaceTarget before it shoots at its target.

Missile:
    TROO EF 8 A_FaceTarget
    TROO G 6 A_TroopAttack // See DoomImpBall
    Goto See


This lost soul homes in on its target by calling A_FaceTarget and A_SkullAttack repeatedly.

actor HomingLostSoul : LostSoul
{
    States
    {
    Missile:
        SKUL C 10 Bright A_FaceTarget
        SKUL D 4 Bright A_SkullAttack
        SKUL CD 4 Bright
        Goto Missile+1
    }
}

See also