A_CheckLOF (state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT)
Performs a would-be-hitscan/line of fire test to see if anything other than the target is encountered along the way. If the target would be hit, jump to the specified state.
- jump: Actor state jump, used if the target or another acceptable victim blocks the line of fire.
- flags: The following flags can be combined by using the | character between the constant names:
- CLOFF_NOAIM_VERT — Disables vertical aiming.
- CLOFF_NOAIM_HORZ — Disables horizontal aiming.
- CLOFF_AIM_VERT_NOOFFSET — Do not adjust aim (pitch) according to height offset. Will aim from whatever origin the other flags indicate (base/feet of actor, or calculated hitscan height).
- CLOFF_FROMBASE — Move origin to actor's base
- CLOFF_MUL_HEIGHT — Multiply height offset by actor's height, i.e. an offsetheight of 2 and a radius of 32 will offset to 64. This does nothing if offsetheight is 0. (If called by a player, takes into account whether they are crouching or not.)
- CLOFF_MUL_WIDTH — Multiply width offset by actor's radius, i.e. an offsetwidth of 2 and a radius of 32 will offset to 64. This does nothing if offsetwidth is 0.
- CLOFF_JUMPENEMY — Allows jumping if an enemy breaks the line of fire.
- CLOFF_JUMPFRIEND — Same as the above, but the monsters must be friendly.
- CLOFF_JUMPOBJECT — Anything that isn't a monster can cause the jump.
- CLOFF_JUMPNONHOSTILE — Actors in the way that are not attacking the calling actor will trigger the jump.
- CLOFF_SKIPENEMY — Always act as if there are no enemies in the way to block the shot.
- CLOFF_SKIPFRIEND — Same as the above, only with friendlies.
- CLOFF_SKIPOBJECT — Same as CLOFF_SKIPENEMY, but applies to non-monsters.
- CLOFF_SKIPNONHOSTILE — Pretends monsters not attacking the calling actor between itself and the desired target are non-obstructive.
- CLOFF_JUMP_ON_MISS — Hitting a wall, floor, or ceiling is a success if they are within range.
The following do not apply to the actor targeted by the line of fire check.
- CLOFF_MUSTBESHOOTABLE — Ignore actors that are not shootable (checks SHOOTABLE and NONSHOOTABLE).
- CLOFF_MUSTBEGHOST — Ignore actors that are not ghosts.
- CLOFF_IGNOREGHOST — Ignore actors that are ghosts.
- CLOFF_MUSTBESOLID — Ignore actors that are not solid.
- CLOFF_SKIPTARGET — Ignores the target actor breaking the ray -- none of the other filters apply to the target actor, only towards intercepting actors.
- CLOFF_BEYONDTARGET — Requires CLOFF_SKIPTARGET. Trace past the targeted actor (only useful if checking for some of the additional jump qualifiers).
- CLOFF_ALLOWNULL — Cast the ray even if target is null. When there is no target, caller aim (pitch, angle) is used regardless of aim-flags.
- CLOFF_CHECKPARTIAL — Perform the check even if the target itself is actually out of range. (Useful if the actor is still interested in closer intercepting actors)
- CLOFF_SETTARGET — Set the intercepting actor as the target of the calling actor. (development version only)
- CLOFF_SETMASTER — Set the intercepting actor as the master of the calling actor. (development version only)
- CLOFF_SETTRACER — Set the intercepting actor as the tracer of the calling actor. (development version only)
- CLOFF_SKIPOBSTACLES — Implies the SKIPENEMY, SKIPFRIEND, SKIPOBJECT, SKIPNONHOSTILE flags. Partial overriding is allowed with combinations such as CLOFF_SKIPOBSTACLES|CLOFF_JUMPFRIEND.
- CLOFF_NOAIM — Implies NOAIM_VERT and NOAIM_HORZ.
- range: Range of the check.
- minrange: Fail if the line of fire is blocked too near the shooting actor.
- angle: Offsets the aim by this angle. Base aim depends on flags; on target by default.
- pitch: Offset your aim by this angle (vertical). Base aim depends on flags; on target by default.
- Note: To gain absolute pitch when the caller does not have a target, use -pitch [+ <expression>] since the function relies upon pitch when not aiming at anything.
- offsetheight: Offset the line of fire's point of origin by this value. The base height depends on flags; hitscan emulation (around the middle) by default. When pitch is determined by aiming for target, aim is adjusted to correct for this offset.
- offsetwidth: Offset the line of fire's point of origin by this value (horizonal). Aim is not adjusted to correct for this value.
- ptr_target: Pick an actor to aim for, AAPTR_DEFAULT picks TARGET (to ensure no actor is targeted, use AAPTR_NULL)
|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. This will make it easier to understand for future authors seeking assistance. Your contibutions are greatly appreciated.|