ReplaceTextures (ZScript)

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

struct LevelLocals
Void ReplaceTextures(String From, String To, Int Flags);


Changes all the instances of a texture in the level to another texture, similar to the ReplaceTextures ACS function. Also has flags to exclude specific instances of the texture to be replaced from being so, for more fine control.


  • String From
The texture to be replaced in the map.
  • String To
The texture to replace the texture specified above with.
  • Int Flags
    The flags that can be used to exclude certain types of the From texture from being replaced. To combine multiple flags, use the | separator. Because the flags are inside the TexMan struct, you need to add the TexMan. prefix on every flag like in the example below to use them.
    • NOT_BOTTOM: Excludes the bottom sidedefs of lines from being replaced.
    • NOT_MIDDLE: Excludes the middle sidedefs of lines from being replaced.
    • NOT_TOP: Excludes the top sidedefs of lines from being replaced.
    • NOT_FLOOR: Exludes floor flats from being replaced.
    • NOT_CEILING: Exludes ceiling flats from being replaced.
    • NOT_WALL: Excludes all walls from being replaced.
    • NOT_FLAT: Excludes all flats from being replaced.


This is a special Imp that when spawned will replace all STARTAN1 instances, except for ones on bottom sidedefs, with GSTONE1. Replace all FLOOR0_1 instances, except for ones on any linedef or ceiling, with BLOOD1, and replace all CEIL1_1 instances, except for ones on floors and linedefs with the special F_SKY1 sky texture.

Class TextureReplacingImp : DoomImp
	Override Void PostBeginPlay()
		Level.ReplaceTextures ("STARTAN2","GSTONE1",TexMan.NOT_BOTTOM);
		Level.ReplaceTextures ("FLOOR0_1","BLOOD1",TexMan.NOT_WALL|TexMan.NOT_CEILING);
		Level.ReplaceTextures ("CEIL1_1","F_SKY1",TexMan.NOT_WALL|TexMan.NOT_FLOOR);