Notes on ScriptedTexture

Discussions about Coding and Scripting
Post Reply
Deaod
Average
Posts: 37
Joined: Fri Jul 10, 2020 9:22 am

Notes on ScriptedTexture

Post by Deaod »

Heres a random assortment of notes from trying to use ScriptedTexture in unrealscript:
  • ScriptedTextures cannot be created through unrealscript itself. They must be created in the editor, saved to a .utx, loaded into your .u using #EXEC LOAD FILE=... PACKAGE=<YourPackage>, and assigned to a variable in unrealscript.
  • ScriptedTextures should not be rendered to from anywhere outside the RenderTexture event called on its NotifyActor. You can render to a ScriptedTexture outside RenderTexture, but my experience is that it only works on 436. So for compatibility you should stick to RenderTexture.
  • ScriptedTextures cannot be used for more than one purpose, because each ScriptedTexture will only call RenderTexture once per frame.
  • If the SourceTexture property is set to anything other than None, the ScriptedTexture's content will be reset to the content of SourceTexture before every invocation of RenderTexture.
  • Changing SourceTexture at run-time does not do anything
  • RenderTexture is invoked while the game is trying to draw the ScriptedTexture for the first time during a Tick. It will not be invoked more than once per ScriptedTexture and Tick.
  • Since ScriptedTextures are palettized, they can be transparent either by using STY_Translucent as style when drawing the ScriptedTexture, or by using STY_Masked. When using STY_Masked you have to set bMasked to true on the ScriptedTexture in unrealscript, as the editor does not allow you to change that property when creating ScriptedTextures and you can also not change the value of bMasked inside the editor.
And heres how to create a new ScriptedTexture:
  • Make base image with desired palette
  • Import base image into editor (mark as masked, do not generate mipmaps, and select palette compression, then put it into a new package)
  • Create new ScriptedTexture in the same package, then a second
  • Open Properties on new ScriptedTextures, go to Texture section and click on the Palette property, then go back to Texture Browser and select previously imported base image, then go back to Properties window of ScriptedTexture and press "Use" on the Palette property value.
  • Set the SourceTexture property on ScriptedTextures if you want the content of it reset every Tick
  • Save through Texture Browser (should result in a .utx file)
I hope these help others trying to go down the same path.
Post Reply