SetActorProperty: Difference between revisions
(→Actor Properties: Linked in GetActorProperty, since it's relevant) |
m (Removing {{svn}} to celebrate ZDoom 2.3.0!) |
||
| Line 42: | Line 42: | ||
| <tt>APROP_ActiveSound</tt> || Sound played when the actor is walking around(defined in SNDINFO) |
| <tt>APROP_ActiveSound</tt> || Sound played when the actor is walking around(defined in SNDINFO) |
||
|- style="background-color: #ddd" |
|- style="background-color: #ddd" |
||
| <tt>APROP_Dropped</tt> || Whether or not actor has the "Dropped" flag. In games with the "Weapons Stay" option of [[DMFlags]] turned on, only weapons with the "Dropped" flag set to 0 stay. By default, any weapon not placed originally on the map has the "Dropped" flag set to 1. |
| <tt>APROP_Dropped</tt> || Whether or not actor has the "Dropped" flag. In games with the "Weapons Stay" option of [[DMFlags]] turned on, only weapons with the "Dropped" flag set to 0 stay. By default, any weapon not placed originally on the map has the "Dropped" flag set to 1. |
||
|} |
|} |
||
Revision as of 09:40, 1 March 2009
void SetActorProperty (int tid, int property, int value)
void SetActorProperty (int tid, int property, str value)
Description
Sets a property (listed below) of the actor(s) with the specified tid to value.
Actor Properties
| APROP_Health | Actor's current health |
| 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, no what their actual speed is. |
| APROP_Damage | Actor's missile damage |
| APROP_Alpha | Alpha value for STYLE_Translucent. Range is [0.0, 1.0] |
| APROP_RenderStyle | How the actor is rendered (listed below) |
| APROP_Ambush | Whether the actor's Ambush flag is set or not. |
| APROP_Invulnerable | Actor will not lose any health |
| APROP_JumpZ | Player's jump speed |
| APROP_Friendly | Actor is friendly to the player and hostile to enemies. |
| APROP_SpawnHealth | The current max health of the actor. Note that only players may have their max health set this way. |
| APROP_SeeSound | Sound played when actor sees the player (defined in SNDINFO) |
| APROP_AttackSound | Sound played when the actor attacks(defined in SNDINFO) |
| APROP_PainSound | Sound played when the actor is injured(defined in SNDINFO) |
| APROP_DeathSound | Sound played when the actor dies(defined in SNDINFO) |
| APROP_ActiveSound | Sound played when the actor is walking around(defined in SNDINFO) |
| APROP_Dropped | Whether or not actor has the "Dropped" flag. In games with the "Weapons Stay" option of DMFlags turned on, only weapons with the "Dropped" flag set to 0 stay. By default, any weapon not placed originally on the map has the "Dropped" flag set to 1. |
You can also use GetActorProperty to retrieve the current values of any of these properties, with the exception that you cannot read the properties ending in *Sound because ACS doesn't support returning strings.
Render Styles
| STYLE_None | 0 | Do not draw |
| STYLE_Normal | 1 | Normal; just copy the image to the screen |
| STYLE_Fuzzy | 2 | Draw silhouette using "fuzz" effect |
| STYLE_SoulTrans | 3 | Draw translucent with amount in r_transsouls |
| STYLE_OptFuzzy | 4 | Draw as fuzzy or translucent, based on user preference |
| STYLE_Translucent | 64 | Draw translucent |
| STYLE_Add | 65 | Draw additive |
Examples
script 1 (void)
{
//makes things with tid 13 fuzzy, have 1000 health, the
//boss brain death sound and doubles their current speed
//(try it, it's fun! ;) )
SetActorProperty(13, APROP_RenderStyle, STYLE_Fuzzy);
SetActorProperty(13, APROP_Health, 1000);
SetActorProperty(13, APROP_DeathSound, "brain/death");
SetActorProperty(13, APROP_Speed, (GetActorProperty(13, APROP_Speed) * 2));
}
Player speed
Setting the player's speed is an operation that seems to frequently be done incorrectly. As an example, consider an enter script that gives the player 75% of normal speed:
The wrong way
script 1 enter
{
SetActorProperty(0, APROP_Speed, (GetActorProperty(0, APROP_Speed) * 3 / 4));
}
The problem with this script is that it alters the player's previous speed. If this script is used on multiple maps in a hub or even just a single map that gets revisited in a hub, players will find themselves going slower and slower as they switch maps in the hub. There is a much simpler way to do this, knowing that a player's normal speed is always 1.0:
The right way
script 1 enter
{
SetActorProperty(0, APROP_Speed, 0.75);
}