SetActorProperty: Difference between revisions
(svn tags) |
(→Actor Properties: Changed Deaf to Ambush) |
||
| Line 22: | Line 22: | ||
| <tt>APROP_RenderStyle</tt> || How the actor is rendered (listed [[#Render Styles|below]]) |
| <tt>APROP_RenderStyle</tt> || How the actor is rendered (listed [[#Render Styles|below]]) |
||
|- style="background-color: #ddd" |
|- style="background-color: #ddd" |
||
| <tt>APROP_Ambush</tt> || Whether actor is |
| <tt>APROP_Ambush</tt> || Whether the actor's Ambush flag is set or not. |
||
|- style="background-color: #eee" |
|- style="background-color: #eee" |
||
| <tt>APROP_Invulnerable</tt> || Actor will not lose any health |
| <tt>APROP_Invulnerable</tt> || Actor will not lose any health |
||
Revision as of 18:41, 2 June 2008
Prototype
void SetActorProperty(int tid, int property, int 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) |
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);
}