CheckActorProperty

From ZDoom Wiki
Jump to navigation Jump to search

bool CheckActorProperty (int tid, int property, int value)
bool CheckActorProperty (int tid, int property, float value)
bool CheckActorProperty (int tid, int property, str value)

Parameters

  • tid: TID of the actor. Use 0 to refer to the activator.
  • property: One of the properties listed below.
  • value: The value to which the property must be compared.

Actor Properties

APROP_ActiveSound string Sound played when the actor is walking around, as defined in SNDINFO.
APROP_Accuracy integer Accuracy of the actor.
APROP_Alpha fixed point Alpha of the actor. Range is [0.0, 1.0]
APROP_Ambush bool Whether the actor's AMBUSH flag is set or not.
APROP_AttackSound string Sound played when the actor attacks, as defined in SNDINFO.
APROP_AttackZOffset fixed point The attack z offset of the player.
APROP_ChaseGoal bool Walks to goal instead of target if a valid goal is set
APROP_Damage integer Actor's damage.
APROP_DamageFactor fixed point Generic damage factor for the actor. It is applied before any specific DamageFactor.
APROP_DamageMultiplier fixed point Generic damage multiplier for the actor. This is typically used on actors (e.g monsters) to strengthen or weaken the damage they deal from their attacks.
APROP_DamageType string Actor's damage type.
APROP_DeathSound string Sound played when the actor dies, as defined in SNDINFO.
APROP_Dormant bool Whether or not actor has the DORMANT flag.
APROP_Dropped bool Whether or not actor has the DROPPED flag. Dropped items are destroyed by closing doors and crushers while non-dropped items are not; and in games with the “Weapons Stay” option of DMFlags turned on, only weapons with the DROPPED flag set to 0 stay. By default, any item not placed originally on the map has the DROPPED flag set to 1.
APROP_Friction fixed point Actor's current friction factor.
APROP_Friendly bool Actor is friendly to the player and hostile to enemies. In addition to setting and clearing the FRIENDLY flag, when the property is set to true, the total kill count of the map is decreased by one for each affected actor, provided they are countable (only hostile monsters are countable), and is increased when the property is set to false.
APROP_FriendlySeeBlocks integer The range in which friendly monsters or hostile monsters with SEEFRIENDLYMONSTERS on can see other non-player actors. This value is measured in increments of 128 map units, e.g a value of 32 equals a range of 4096 map units.
APROP_Frightened bool Monster runs away from player.
APROP_Gravity fixed point Current gravity factor of actor.
APROP_Health integer Actor's current health. Setting this property to 0 or less, kills the actor.
APROP_Height fixed point Actor's current height.
APROP_Invulnerable bool Actor will not lose any health.
APROP_JumpZ fixed point Player's jump height. The formula for jumping distance is (JumpZ * 2) / 2 + MaxStepHeight, and to get a specific JumpZ from a jumping height you want to achieve, use Sqrt((jump height - MaxStepHeight) / 2 ) * 2.
APROP_Mass integer Actor's mass.
APROP_MasterTID integer The TID of the actor linked to by the actor's master field.
APROP_MaxDropOffHeight fixed point Defines the maximum height of a step this actor can climb down when moving.
APROP_MaxStepHeight fixed point Defines the maximum height of a step this actor can climb up when moving.
APROP_MeleeRange fixed point Actor's melee range.
APROP_NameTag string Name of the actor. If the actor has not been explicitly named by the Tag property or in a script, its name is by default the same as its class name.
APROP_NoTrigger bool Whether or not actor has the NOTRIGGER flag.
APROP_NoTarget bool Actor cannot be targeted by other monsters.
APROP_PainSound string Sound played when the actor is injured, as defined in SNDINFO.
APROP_Radius fixed point Actor's current radius.
APROP_ReactionTime integer The time in tics a monster needs to attack back. However, the main use of this property is to serve as a counter for A_Countdown.
APROP_RenderStyle integer How the actor is rendered:
STYLE_None Do not draw
STYLE_Normal Normal; just copy the image to the screen
STYLE_Fuzzy Draw silhouette using “fuzz” effect
STYLE_SoulTrans Draw translucent with amount in transsouls CVAR
STYLE_OptFuzzy Draw as fuzzy or translucent, based on user preference
STYLE_Stencil Draw as single color
STYLE_AddStencil Draw as single additive color
STYLE_AddShaded Treats 8-bit indexed images as an alpha map while applying additive translucency. Index 0 = fully transparent, index 255 = fully opaque.
STYLE_Translucent Draw translucent
STYLE_Add Draw additive
STYLE_Shaded Treats 8-bit indexed images as an alpha map. Index 0 = fully transparent, index 255 = fully opaque.
STYLE_TranslucentStencil Draw as single translucent color
STYLE_Shadow Draw dark translucent stencil
STYLE_Subtract Draw subtractive
APROP_ScaleX fixed point Horizontal scaling of the actor's sprite. Does not affect collision box size.
APROP_ScaleY fixed point Vertical scaling of the actor's sprite. Does not affect collision box size.
APROP_Score integer A simple counter. Score items automatically increase it by their amount.
APROP_SeeSound string Sound played when actor sees the player, as defined in SNDINFO.
APROP_SoundClass string Sound class of the player.
APROP_SpawnHealth integer The current max health of the actor. Only players may have their max health set this way. Note that for them the default value is 0, which is interpreted as "100 unless modified by DeHackEd". The Player.MaxHealth property can change the default value.
APROP_Species string Species the actor belongs to.
APROP_Speed fixed point Actor's speed.

For monsters, this is the distance they move every time A_Chase is called. For projectiles, this is the distance they move each tic. For players, this is multiplied by the player's class speed to determine the final speed the player will move for each tic that they have a movement key held down. Consequently, the standard APROP_Speed for a player is always 1.0, not what their actual speed is.

APROP_Stamina integer Stamina of the actor.
APROP_StencilColor color Stencil color of the actor, as a hexadecimal value, e.g. 0xFFFFFF (white).
APROP_TargetTID integer The TID of the actor linked to by the actor's target field.
APROP_TracerTID integer The TID of the actor linked to by the actor's tracer field.
APROP_ViewHeight fixed point The view height of the player.
APROP_Waterlevel integer How "submerged" the actor is.
0: Not submerged at all (e.g. standing on solid ground)
1: Less than half submerged ("ankle deep")
2: At least half submerged ("waist deep")
3: Entirely submerged (completely underwater)
APROP_WaterDepth fixed point The exact depth at which the actor is submerged at in a water volume.

Return value

True if the value given is the same as that used by the actor, false otherwise. This is especially useful for string properties (such as sounds and species) which cannot be obtained by GetActorProperty (as of r4307, this is not the case, and this function can be used on string-based properties) as ACS does not handle dynamic strings (this is not the case starting with r4295).

Examples

This example checks the species of the thing with the specified tid and destroys it if it is a DoomImp.

script 1 (int tid)
{
  if (CheckActorProperty(tid, APROP_SPECIES, "DoomImp"))
  {
    if (ThingCountName("DoomImp", tid) > 1)
      print(s:"These Imps must die!");
    else
      print(s:"This Imp must die!");
    
    Thing_Destroy(tid, TRUE);
  }
}

See also