GetActorProperty

From ZDoom Wiki
Jump to: navigation, search

int GetActorProperty (int tid, int property)

Parameters

  • tid: TID of the actor. Use 0 to refer to the activator.
  • property: One of the properties listed below.

Actor Properties

APROP_Accuracy Accuracy of the actor.
APROP_Alpha Alpha value for STYLE_Translucent. Range is [0.0, 1.0]
APROP_Ambush Whether the actor's AMBUSH flag is set or not.
APROP_AttackZOffset The attack z offset of the player. (development version b187451 only)
APROP_ChaseGoal Walks to goal instead of target if a valid goal is set
APROP_Damage Actor's missile damage
APROP_DamageFactor Generic damage factor for the actor, in fixed point. It is applied before any specific DamageFactor.
APROP_Dormant Whether or not actor has the DORMANT flag.
APROP_Dropped 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_Friendly 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_Frightened Monster runs away from player
APROP_Gravity Current gravity factor of actor
APROP_Health Actor's current health
APROP_Height Actor's current height (New from 2.7.1)
APROP_Invulnerable Actor will not lose any health
APROP_JumpZ Player's jump height as a fixed point number. 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 Actor's mass.
APROP_MasterTID The TID of the actor linked to by the actor's master field.
APROP_MeleeRange Actor's melee range (New from 2.7.1). Note that setting the property requires development build 79d9a57 or newer.
APROP_NoTrigger Whether or not actor has the NOTRIGGER flag.
APROP_NoTarget Actor cannot be targeted by other monsters
APROP_Radius Actor's current radius (New from 2.7.1)
APROP_ReactionTime 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 (New from 2.7.1)
APROP_RenderStyle 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 (development version 30f57c0 only)
STYLE_AddShaded Treats 8-bit indexed images as an alpha map while applying additive translucency. Index 0 = fully transparent, index 255 = fully opaque. (development version 30f57c0 only)
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 (development version 265917c only)
STYLE_Subtract Draw subtractive (development version 265917c only)
APROP_ScaleX Horizontal scaling of the actor's sprite. Does not affect collision box size.
APROP_ScaleY Vertical scaling of the actor's sprite. Does not affect collision box size.
APROP_Score A simple counter. Score items automatically increase it by their amount.
APROP_SpawnHealth 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_Speed Actor's speed (This is a fixed point value).

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 Stamina of the actor.
APROP_StencilColor Stencil color of the actor. (development version 697ef028 only)
APROP_TargetTID The TID of the actor linked to by the actor's target field.
APROP_TracerTID The TID of the actor linked to by the actor's tracer field.
APROP_ViewHeight The ViewHeight of the player, (development version b187451 only)
APROP_Waterlevel 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)

Return value

The value of the specified property of the actor. Since ACS does not handle dynamic strings (this is not the case starting with r4295), this function cannot be used with certain properties and CheckActorProperty can be used instead (note that as of r4307, this is not the case, and this function can be used on string-based properties). It's important to note that when using APROP_Health, it returns the exact value of the current health, even if it's a negative value.

Examples

This script checks for a few different properties and prints helpful messages about them.

script 1 (int tid)
{
    if (GetActorProperty (tid, APROP_HEALTH) <= 25)
        print (s:"Thing ", d:tid, " has less than 26 health!!");

    if (GetActorProperty (12, APROP_RENDERSTYLE) == STYLE_OPTFUZZY)
        print (s:"Thing 12 is probably a spectre!");
}

See also