From ZDoom Wiki
Jump to: navigation, search

A_Warp(int ptr_destination [, float x-offset [, float y-offset [, float z-offset [, float angle [, int flags [, state success_state]]]]]])
A_Warp(int ptr_destination [, float x-offset [, float y-offset [, float z-offset [, float angle [, int flags [, state success_state [, float heightoffset]]]]]]]) (development version d87b6d6 only)
A_Warp(int ptr_destination [, float x-offset [, float y-offset [, float z-offset [, float angle [, int flags [, state success_state [, float heightoffset [, float radiusoffset [, float pitch]]]]]]]]]) (development version a8ac748 only)

This command is considered an extension of A_Fire, with more versatility and flexible actor controls. Unlike A_Fire, it does not require an actor to be visible like the Archvile's fire attack, and these can be used with actor pointers.


  • ptr_destination: Teleports the calling actor to the pointer they have. See actor pointers for more information.
  • x-offset: Specifies how far forward/backward in front/behind of the pointed actor the calling actor will appear. Positive numbers result in the actor spawning in front, and behind for negative.
  • y-offset: Specifies how far to the side the calling actor will appear to the pointer. Positive numbers are further to the pointer actor's right, while negative numbers spawn them more to the left.
  • z-offset: Specifies how high off the ground to appear. Positive numbers mean a higher altitude, negative means under the pointer and possibly into the ground.
  • angle: Specifies the offset to add after the calling actor sets its angle to the reference actor's angle.
  • flags:
Flags that affect the behavior:
  • WARPF_ABSOLUTEOFFSET — Do not apply the angle to the xy-offset.
  • WARPF_ABSOLUTEANGLE — Use the angle parameter as an absolute angle (not an offset).
  • WARPF_ABSOLUTEPOSITION (development version 848225e only) — Treat x, y and z offset parameters as absolute coordinates for the calling actor's position, instead of being relative to the pointer actor's. This flag overrides WARPF_ABSOLUTEOFFSET, but can still add the z offset of floorz when used with WARPF_TOFLOOR.
  • WARPF_USECALLERANGLE — Use the calling actor's angle instead of the reference actor's. The angle parameter changes as such: it will add itself to the caller's angle and cause it to orbit around the reference. The greater the number in angle, the faster it will orbit.
  • WARPF_NOCHECKPOSITION — Blindly accept any resultant position.
  • WARPF_STOP — Reduce caller velocity to 0 when the move is completed.
  • WARPF_TOFLOOR — Set caller z relative to floor z where teleported to, instead of relative to reference actor.
  • WARPF_TESTONLY — Does not warp the actor, but still allows it to jump to the success state if it were to warp. This is useful for checking things and causing chains to occur, such as with inventory items. This flag ignores all other flags and properties, including but not limited to pitch and angle changes, with the exception of WARPF_NOCHECKPOSITION, which is not recommended for use with this flag due to forcing success upon the test.
  • WARPF_BOB (development version 643d37a only) — Gets the float bob offsets of the targeted actor and offsets it to follow with it.
  • WARPF_MOVEPTR (development version 643d37a only) - The target does the warping instead of the calling actor, and all the flags apply. The calling actor is still responsible for performing a state jump and determining success, however.
  • WARPF_USETID (development version efce2a2 only) — If set, the first parameter changes to accept a tid instead of an actor pointer.
  • WARPF_COPYVELOCITY (development version a8ac748 only) - Copies the exact velocity of the actor, which is relative only to the target's own, regardless of what angle the warped actor receives.
  • WARPF_COPYPITCH (development version a8ac748 only) - Gains the same pitch as the target, and then adds pitch after it, if any.
Flags to customize appearance of the warp:
  • WARPF_INTERPOLATE — Keep old interpolation data (make it appear as if actor moved from its previous location).
  • WARPF_WARPINTERPOLATION — Modify interpolation data with the vector PlayerNewPosition - PlayerOldPosition.
  • WARPF_COPYINTERPOLATION — Copies the actor's interpolation data for itself, allowing the actor to mimic the pointer closely.
  • success_state: An optional state to jump to in the event of success.
  • heightoffset: A multiplier for the target's height. This allows for further adjustment to the calling actor's z-offset by way of adding the result of multiplying the target's height by the passed value to the z-offset. Default is 0. (development version d87b6d6 only)
  • radiusoffset: A multiplier for the target's radius. Similar to heightoffset but using radius instead. (development version a8ac748 only)
  • pitch: The amount of pitch to add to the offset, negative values aim the actor higher while positive will lower it. Unlike angle, this is NOT copied unless WARPF_COPYPITCH is specified for compatibility purposes. (development version a8ac748 only)

NOTE: If the actor being orbited stops existing, and the success state is defined, it will ultimately fail to jump. Even if success state is left undefined, though, it will fail to move at all. The success state can be useful for getting rid of orbiting/external actors when the main actor is no longer being used.


The following example is a replication of A_Fire:


A useful application of this function is to have "orbiters". This example baron has a projectile circulating it all the time.

ACTOR SpecialBaronOfHell : BaronOfHell
    BOSS A 0 NoDelay A_CustomMissile("OrbitBall", 32, 0, 0, CMF_AIMDIRECTION)
    Goto Super::Spawn

ACTOR OrbitBall
  RenderStyle "Add"
  Translation "0:255=%[0,0,0]:[0.93,2,0.87]" // Makes it green-colored

  var int user_angle; // See user variables

    TNT1 A 0 A_SetUserVar("user_angle", user_angle + 8)

When choosing the pointer for the function, i.e, the actor the projectile should orbit, target is what to go for, in this case, since a projectile's target is usually the actor which fires it.