Statnum: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
Fox (talk | contribs)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Statnums are used by the game internally to see whether something is an actor, player, projectile, etc, and then process it appropriately.
'''statnum''' is used by the game internally to see whether something is an actor, player, projectile, etc, and then process it appropriately.


{| {{prettytable}}
The statnums also serve to cache the sprites in shorter lists. It's optimal to use [[for|loops]] of the sprites using a statnum instead of all sprites.
!Name!!Number!!Description!!
|-
|STAT_DEFAULT
|align="right"|'''0'''
|Sprites that are not defined by the CON code as actors, and are not projectiles, etc, have a statnum of 0. (i.e. the floor texture sprites used to make up a sprite bridge)
|-
|STAT_ACTOR
|align="right"|'''1'''
|Actors. Sprites with a statnum of 1 will execute the actor code that applies to their tile number in the CON scripts.
|-
|STAT_ZOMBIEACTOR
|align="right"|'''2'''
|Sleepers. Sprites taking a break from code execution (e.g. a Pig Cop that has been left alone for long enough will revert to statnum 2, only waking up and going back to statnum 1 upon seeing the player again)
|-
|STAT_EFFECTOR
|align="right"|'''3'''
|
|-
|STAT_PROJECTILE
|align="right"|'''4'''
|Projectiles. This includes hardcoded projectiles like RPG, FREEZEBLAST, and SHRINKSPARK, as well as [[defineprojectile|custom projectiles]].  It does not include hitscan projectiles (bullets), since those are not sprites that exist in the game world. (SHOTSPARK1, the sprite spawned by bullets, is not itself a projectile.)
|-
|STAT_MISC
|align="right"|'''5'''
|
|-
|STAT_STANDABLE
|align="right"|'''6'''
|On spawn, the following sprites have statnum 6: BOLT1+, SIDEBOLT1+, VIEWSCREEN, VIEWSCREEN2, CRANE, TRASH, WATERDRIP, WATERDRIPSPLASH, PLUG, WATERBUBBLEMAKER, MASTERSWITCH, DOORSHOCK, TREE1, TREE2, TIRE, CONE, BOX, FLOORFLAME, CEILINGSTEAM, OOZFILTER, CRACK1-CRACK4, FIREEXT, TOILETWATER.


A few other ones become STANDABLE on seeing the player (changing from ZOMBIEACTOR): RUBBERCAN, EXPLODINGBARREL, WOODENHORSE, HORSEONSIDE, CANWITHSOMETHING, CANWITHSOMETHING2-4, FIREBARREL, FIREVASE, NUKEBARREL, NUKEBARRELDENTED, NUKEBARRELLEAKED, TRIPBOMB.
In older version of Eduke32, it was necessary to use [[changespritestat]] to change '''statnum'''. This is no longer necessary.
|-
|STAT_LOCATOR
|align="right"|'''7'''
|
|-
|STAT_ACTIVATOR
|align="right"|'''8'''
|
|-
|STAT_TRANSPORT
|align="right"|'''9'''
|
|-
|STAT_PLAYER
|align="right"|'''10'''
|Player and Holoduke
|-
|STAT_FX
|align="right"|'''11'''
|RESPAWN, MUSICANDSFX
|-
|STAT_FALLER
|align="right"|'''12'''
|Decorative sprites that have a nonzero hitag to make them destructible are assigned to the FALLER statnum.
|-
|STAT_DUMMYPLAYER
|align="right"|'''13'''
|
|-
|STAT_LIGHT
|align="right"|'''14'''
|
|-
|TSPR_TEMP
|align="right"|'''99'''
|A [[Members of the tsprite structure|tspr]] will have this when it is a shadow cast by an actor.
|-
|STAT_MIRROREDACTOR
|align="right"|'''100'''
|A [[Members of the tsprite structure|tspr]] will have this when it is part of a mirror reflection.
|-
|MAXSTATUS
|align="right"|'''1024'''
|A sprite id with this statnum is invalid, meaning that it has been deleted or just never existed in the map. Do NOT try to destroy a sprite by setting this value on it, instead use the [[killit]] command or else try setting the sprite's [[xrepeat]] to zero.
|}


It was once not suggested to manually change statnum via "''setactor[].statnum''" because it would not update the game's internal linked lists, causing oddball occurrences like sprites freezing in midair and general game state corruption.  "''setactor[].statnum''" is an alias of [[changespritestat]] in newer versions of EDuke32, preventing this corruption from occurring.
Unassigned status numbers may be reserved for future EDuke32 features, so it's suggested to define custom statnums starting from 101.


Unassigned status numbers are reserved for future EDuke32 features. Please ask the developers to allocate an official user statnum range for CON-side features, should this be desired.
== Values ==
 
{{Statnums}}


[[Category:Sprite structure members]]
[[Category:Sprite structure members]]

Latest revision as of 09:47, 22 February 2020

statnum is used by the game internally to see whether something is an actor, player, projectile, etc, and then process it appropriately.

The statnums also serve to cache the sprites in shorter lists. It's optimal to use loops of the sprites using a statnum instead of all sprites.

In older version of Eduke32, it was necessary to use changespritestat to change statnum. This is no longer necessary.

Unassigned status numbers may be reserved for future EDuke32 features, so it's suggested to define custom statnums starting from 101.

Values

The following values are used with statnum.

Exposed Value Label Description
Yes 0 STAT_DEFAULT Sprites that are not defined by the CON code as actors, and are not projectiles, etc, have a statnum of 0. (i.e. the floor texture sprites used to make up a sprite bridge)
Yes 1 STAT_ACTOR Actors. Sprites with a statnum of 1 will execute the actor code that applies to their tile number in the CON scripts.
Yes 2 STAT_ZOMBIEACTOR Sleepers. Sprites taking a break from code execution (e.g. a Pig Cop that has been left alone for long enough will revert to statnum 2, only waking up and going back to statnum 1 upon seeing the player again)
Yes 3 STAT_EFFECTOR
Yes 4 STAT_PROJECTILE Projectiles. This includes hardcoded projectiles like RPG, FREEZEBLAST, and SHRINKSPARK, as well as custom projectiles. It does not include hitscan projectiles (bullets), since those are not sprites that exist in the game world. (SHOTSPARK1, the sprite spawned by bullets, is not itself a projectile.)
Yes 5 STAT_MISC
Yes 6 STAT_STANDABLE On spawn, the following sprites have statnum 6: BOLT1+, SIDEBOLT1+, VIEWSCREEN, VIEWSCREEN2, CRANE, TRASH, WATERDRIP, WATERDRIPSPLASH, PLUG, WATERBUBBLEMAKER, MASTERSWITCH, DOORSHOCK, TREE1, TREE2, TIRE, CONE, BOX, FLOORFLAME, CEILINGSTEAM, OOZFILTER, CRACK1-CRACK4, FIREEXT, TOILETWATER.

A few other ones become STANDABLE on seeing the player (changing from ZOMBIEACTOR): RUBBERCAN, EXPLODINGBARREL, WOODENHORSE, HORSEONSIDE, CANWITHSOMETHING, CANWITHSOMETHING2-4, FIREBARREL, FIREVASE, NUKEBARREL, NUKEBARRELDENTED, NUKEBARRELLEAKED, TRIPBOMB.

Yes 7 STAT_LOCATOR
Yes 8 STAT_ACTIVATOR
Yes 9 STAT_TRANSPORT
Yes 10 STAT_PLAYER Player and Holoduke
Yes 11 STAT_FX RESPAWN, MUSICANDSFX
Yes 12 STAT_FALLER Decorative sprites that have a nonzero hitag to make them destructible are assigned to the FALLER statnum.
Yes 13 STAT_DUMMYPLAYER
Yes 14 STAT_LIGHT
No 99 TSPR_TEMP A tspr will have this when it is a shadow cast by an actor.
No 100 STAT_MIRROREDACTOR A tspr will have this when it is part of a mirror reflection.
Yes 1024 MAXSTATUS A sprite id with this statnum is invalid, meaning that it has been deleted or just never existed in the map. Do NOT try to destroy a sprite by setting this value on it, instead use the killit command or else try setting the sprite's xrepeat to zero.
Defines
define TSPR_TEMP                        99
define STAT_MIRROREDACTOR               100