A_JumpIfHigherOrLower

From ZDoom Wiki
Jump to: navigation, search

state A_JumpIfHigherOrLower (str "high", str "low" [, float offsethigh [, float offsetlow [, bool includeHeight [, pointer ptr]]]])

Note: Jump functions perform differently inside of anonymous functions.

Usage

Jumps to either the high state or the low state if the actor pointer ptr is higher or lower than the calling actor's self based upon z-height. If the pointed actor is higher than the calling actor, adds (or subtracts) offsethigh to its check, and vice versa if the pointer is lower. includeHeight is important to consider as this can radically change the behavior of the function.

Either state jump can be disabled by leaving the space between the quotation marks empty ("" without parenthesis and no spaces between), but at least one state jump must be enabled to have any effect.

Parameters

  • high: State jump the calling actor goes to if the pointer is higher. Set to "" to disable.
  • low: State jump the calling actor goes to if the pointer is lower. Set to "" to disable.
  • offsethigh: Default is 0. Offsets the calling actor's height or z (see includeHeight) for the pointer being above the caller by this amount. Positive values require the pointer to be this much higher over the calling actor's height in order to jump to the high state. Negative values allow the pointer to be lower by this much and successfully trigger the high state jump.
  • offsetlow: Default is 0. Offsets the calling actor's z check for the pointer being below the caller by this amount. Negative values will require the pointer to be lower. Positive values will allow the pointer to rise above the callers z by this much, depending on includeHeight.
  • includeHeight: Defaults to true. When enabled, this works two-fold.
    • The function will factor in the caller's height if the pointer is above the caller.
    • Inversely, it will factor in the pointer's height if the pointer is below the caller.
    • If set to false, the function will simply compare z positions without adding height. offsethigh and offsetlow are still added in, however.
  • ptr: Defaults to AAPTR_TARGET. Checks the following actor pointer. Can take any pointer except AAPTR_DEFAULT and AAPTR_NULL; the function was built to check another actor, not itself, and will do nothing in that regard.

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 contibutions are greatly appreciated.