From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.

int GetSpriteIndex(name sprt)

Used to find and return the appropriate four letter sprite's image series, which can be assigned to an actor's sprite internal variable.

NOTE: The sprite should be defined regularly (can be any actor, or even give the class a dummy state) with the sprite defined to ensure the sprite and frames are loaded correctly. For example, specifying ZOMB A 0 in a dummy state will ensure every frame is correctly loaded for ZOMB. Glitches can occur otherwise, such as using the wrong sprite or more.


The following roughly translates into how sprite frames are normally specified. This is equivalent of using ZOMB A 2 for that point in the state.

TNT1 A 0
     sprite = GetSpriteIndex("ZOMB"); // Will override the TNT1, replacing it with ZOMB.
     frame = 0; //Translates to letter A. 1 is B, 2 is C, etc.