SetActorProperty: Difference between revisions
Marisa Heit (talk | contribs) (More information about APROP_Speed) |
Marisa Heit (talk | contribs) m (→The wrong way: alter's -> alters) |
||
| Line 78: | Line 78: | ||
SetActorProperty(0, APROP_Speed, (GetActorProperty(0, APROP_Speed) * 3 / 4)); |
SetActorProperty(0, APROP_Speed, (GetActorProperty(0, APROP_Speed) * 3 / 4)); |
||
} |
} |
||
The problem with this script is that it |
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===== |
=====The right way===== |
||
script 1 enter |
script 1 enter |
||
Revision as of 18:58, 24 December 2006
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
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 actor is "deaf" or not |
| APROP_Invulnerable | Actor will not lose any health |
| APROP_JumpZ | Player's jump speed |
| 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);
}