A CheckBlock: Difference between revisions

From ZDoom Wiki
Jump to navigation Jump to search
m (removing "new" for GZDoom 2.4.0 release)
m (replacing git tags with new tags for GZDoom 2.4.0 release)
Line 1: Line 1:
{{codepointer|Jump}}
{{codepointer|Jump}}
state '''A_CheckBlock''' (str "''block''" [, int ''flags'' [, pointer ''ptr'']])<br>
state '''A_CheckBlock''' (str "''block''" [, int ''flags'' [, pointer ''ptr'']])<br>
state '''A_CheckBlock''' (str "''block''" [, int ''flags'' [, pointer ''ptr''[, float ''xofs''[, float ''yofs''[, float ''zofs''[, float ''angle]]]]]]]) {{git|b16e696}}
state '''A_CheckBlock''' (str "''block''" [, int ''flags'' [, pointer ''ptr''[, float ''xofs''[, float ''yofs''[, float ''zofs''[, float ''angle]]]]]]]) {{new}}
{{JumpNotice}}
{{JumpNotice}}
==Usage==
==Usage==
Line 15: Line 15:
**'''CBF_SETONPTR''' - By default, the calling actor is the one to set the blocking actor as it's target/master/tracer regardless of who blocks it. This inverses that behavior so the pointer gets the actor blocking the caller or itself instead. Does nothing if none of the other pointer manipulating flags are present.
**'''CBF_SETONPTR''' - By default, the calling actor is the one to set the blocking actor as it's target/master/tracer regardless of who blocks it. This inverses that behavior so the pointer gets the actor blocking the caller or itself instead. Does nothing if none of the other pointer manipulating flags are present.
**'''CBF_DROPOFF''' - Checks to see if the pointer is standing on or stuck in a tall dropoff.
**'''CBF_DROPOFF''' - Checks to see if the pointer is standing on or stuck in a tall dropoff.
**'''CBF_NOACTORS''' - The caller never jumps if any actors are blocking it. {{git|59ad620}}
**'''CBF_NOACTORS''' - The caller never jumps if any actors are blocking it. {{new}}
**'''CBF_ABSOLUTEPOS''' - Use ''x/y/zofs'' as absolute coordinates. {{git|b16e696}}
**'''CBF_ABSOLUTEPOS''' - Use ''x/y/zofs'' as absolute coordinates. {{new}}
**'''CBF_ABSOLUTEANGLE''' - Use the ''angle'' parameter as an absolute angle instead of an offset to add/subtract from. {{git|b16e696}}
**'''CBF_ABSOLUTEANGLE''' - Use the ''angle'' parameter as an absolute angle instead of an offset to add/subtract from. {{new}}
*''ptr'': Defaults to AAPTR_TARGET. Checks the following [[actor pointer]]. Can take any pointer except AAPTR_NULL.
*''ptr'': Defaults to AAPTR_TARGET. Checks the following [[actor pointer]]. Can take any pointer except AAPTR_NULL.
*''x/y/zofs'': Offsets the position to check by this much. Behaves similarly to [[A_SpawnItemEx]]. Default is 0. {{git|b16e696}}
*''x/y/zofs'': Offsets the position to check by this much. Behaves similarly to [[A_SpawnItemEx]]. Default is 0. {{new}}
*''angle'': Offsets the angle to turn the ''x/y/z'' offsets. Default is 0. {{git|b16e696}}
*''angle'': Offsets the angle to turn the ''x/y/z'' offsets. Default is 0. {{new}}


== Examples ==
== Examples ==

Revision as of 17:13, 20 March 2017

state A_CheckBlock (str "block" [, int flags [, pointer ptr]])
state A_CheckBlock (str "block" [, int flags [, pointer ptr[, float xofs[, float yofs[, float zofs[, float angle]]]]]]]) (New from 4.14.2)

Note: Jump functions perform differently inside of anonymous functions.

Usage

Performs a check and jumps to block state based upon if an actor or a line is blocking the caller. This checks the current actor's flags and all THRU flags to see if it is currently being blocked from properly moving with A_Chase or similar.

Parameters

  • block: State jump the calling actor goes to if a line or actor is blocking it. Unlike other jump functions, leaving this empty ("") will NOT cause the function to do nothing, depending on flags. No jump is made if the actor is clear of blockage.
  • flags: The following can be combined with a ('|') symbol (logical or)
    • CBF_NOLINES - The caller never jumps if any lines are blocking it.
    • CBF_SETTARGET - If an actor is blocking the caller/pointer, sets it as the calling actor's target. Can be used to determine through other pointer checking functions to determine the difference between line and actor blocking, as the pointer will change.
    • CBF_SETMASTER - Same, but for master.
    • CBF_SETTRACER - Same, but for tracer.
    • CBF_SETONPTR - By default, the calling actor is the one to set the blocking actor as it's target/master/tracer regardless of who blocks it. This inverses that behavior so the pointer gets the actor blocking the caller or itself instead. Does nothing if none of the other pointer manipulating flags are present.
    • CBF_DROPOFF - Checks to see if the pointer is standing on or stuck in a tall dropoff.
    • CBF_NOACTORS - The caller never jumps if any actors are blocking it. (New from 4.14.2)
    • CBF_ABSOLUTEPOS - Use x/y/zofs as absolute coordinates. (New from 4.14.2)
    • CBF_ABSOLUTEANGLE - Use the angle parameter as an absolute angle instead of an offset to add/subtract from. (New from 4.14.2)
  • ptr: Defaults to AAPTR_TARGET. Checks the following actor pointer. Can take any pointer except AAPTR_NULL.
  • x/y/zofs: Offsets the position to check by this much. Behaves similarly to A_SpawnItemEx. Default is 0. (New from 4.14.2)
  • angle: Offsets the angle to turn the x/y/z offsets. Default is 0. (New from 4.14.2)

Examples

This zombie is very nevrous: he starts run around if anything disturbed him.

Actor NevrousZombie4ZDWiki: Zombieman replaces Zombieman
{
  States
  {
  See:
    POSS AA 4 Fast A_Chase
    POSS A 0 A_CheckBlock( "Nevrous", CBF_SETTARGET )
    POSS BB 4 Fast A_Chase
    POSS B 0 A_CheckBlock( "Nevrous", CBF_SETTARGET )
    POSS CC 4 Fast A_Chase
    POSS C 0 A_CheckBlock( "Nevrous", CBF_SETTARGET )
    POSS DD 4 Fast A_Chase
    POSS D 0 A_CheckBlock( "Nevrous", CBF_SETTARGET )
    Loop
  Pain:
    POSS G 3
    POSS G 3 A_Pain
    Goto Nevrous
  Nevrous:
    POSS AABBCCDD 2 Fast A_Wander
    POSS A 0 A_Jump( 63, "See" )
    Loop
  }
}