Warp (ZScript)

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.
Note: Not to be confused with the ACS function Warp.

Actor

native bool Warp(Actor dest, double xofs = 0, double yofs = 0, double zofs = 0, double angle = 0, int flags = 0, double heightoffset = 0, double radiusoffset = 0, double pitch = 0)

Usage

Warps the calling actor (by default) to the specified actor pointer. Generally, functions exactly the same way as A_Warp, but takes a ZScript actor pointer rather than a DECORATE AAPTR* pointer. In contrast to A_Warp, however, this cannot perform a state jump.

Note, for simple warping using SetOrigin is generaly preferable; Warp is only really necessary if there's a need to add relative offsets to the warping position.

Parameters

  • Actor dest
An actor pointer to warp the calling actor to.
  • double xofs
How far in front/behind of the dest actor the warping actor will appear. Positive numbers move the offset point forward, negative move it backward.
  • double yofs
How far to the right/left of the dest actor the warping actor will appear. Positive numbers move the offset point to the right, negative move it to the left.
  • double zofs
How far above/below the dest actor the warping actor will appear. Positive numbers move the offset point up, negative move it down. Note that at 0 the warping actor will be placed at the bottom of the dest actor.
  • double angle
Specifies how far the calling actor's angle will be offset from the dest actor's angle. At the default value (0) the calling actor's angle will become equal to dest's angle. Positive values will offset the calling actor's angle to the right of dest's angle, negative will offset it to the left.
  • int flags
Flags that affect the behavior:
  • WARPF_ABSOLUTEOFFSET — Makes xofs and yofs arguments function as absolute offsets along the X/Y axes of the map, ignoring the dest's angle.
  • WARPF_ABSOLUTEANGLE — Use the angle parameter as an absolute value to set the actor's angle to, instead of an offset from dest's angle.
  • WARPF_ABSOLUTEPOSITION — Treat xofs/yofs/zofs arguments as absolute coordinates for the warping actor's position instead of being relative to the dest's position. This flag overrides WARPF_ABSOLUTEOFFSET, but can still add the z offset of floorz when used with WARPF_TOFLOOR.
  • WARPF_USECALLERANGLE — Use the warping actor's angle instead of the warped-to actor's to calculate the xofs/yofs offsets. The angle argument will instead add itself to the warping's angle and cause it to orbit around the dest actor. The greater the angle parameter, the faster it will orbit.
  • WARPF_NOCHECKPOSITION — Blindly accept any resultant position, instead of checking for the warp being a valid movement.
  • WARPF_STOP — Reduce warping actor's velocity to 0 when the move is completed, similar to A_Stop.
  • WARPF_TOFLOOR — Makes the zofs parameter relative to the floor, rather than relative to the dest's Z position.
  • WARPF_BOB — Makes the warping actor copy the dest's FloatBobPhase property. This is useful if the destination actor uses FLOATBOB.
  • WARPF_MOVEPTR — The dest will warp to the calling actor rather than vice versa.
  • WARPF_COPYVELOCITY — Copies the dest actor's velocity exactly, regardless of how the warping actor is moving.
  • WARPF_COPYPITCH — Copies the dest actor's pitch, and then adds the pitch parameter to it.
Flags to customize appearance of the warp:
  • WARPF_INTERPOLATE — Keeps the warping actor's default interpolation data.
  • WARPF_WARPINTERPOLATION — Modify interpolation data with the vector PlayerNewPosition - PlayerOldPosition.
  • WARPF_COPYINTERPOLATION — Copies the warped-to actor's interpolation data, allowing the warping actor to mimic it.
  • double heightoffset
Adds the warped-to actor's height multiplied by heightoffset to the zofs parameter. Default is 0.
  • double radiusoffset
Adds the warped-to actor's radius multiplied by radiusoffset to the xofs and yofs parameters. Default is 0.
  • double pitch
With WARPF_COPYPITCH, this parameter works exactly as angle, but with pitch instead. Without WARPF_COPYPITCH, this parameter merely adds to the warping actor's pitch.

Return values

  • bool — Returns true if the warping succeeded. Warping may fail if the WARPF_NOCHECKPOSITION flag is not passed and there's no space for the warped actor to move.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.