I'm trying to make a decorative actor in ZScript. Is there any way within ZScript to darken the PNG image used for a sprite?
I would like to avoid creating separate lighter or darker variants of the PNGs, so ideally I’d like to be able to spawn normal versions (using the lighting on the original PNG) as well as darker versions (possibly with different darkness values), where ZScript reduces the brightness of the sprite at runtime.
Is this at all possible?
I've been reading about render styles (for example A_OverlayRenderstyle) on the ZDoom documentation that affect transparency and blending, but I don’t want to make the sprite transparent in any way. I just want to darken the image (as if it were in shadow), not fade it.
Any ideas?
Darken a sprite in zscript
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
cjdubreu
- Posts: 5
- Joined: Tue Mar 31, 2026 5:44 am
- Operating System Version (Optional): windows
-
Kappes Buur
-

- Posts: 4219
- Joined: Thu Jul 17, 2003 12:19 am
- Graphics Processor: nVidia (Legacy GZDoom)
- Location: British Columbia, Canada
Re: Darken a sprite in zscript
I do not know if this is possible with scripting.
Personaly I make different images of the decoration and then create the actors in either DECORATE or ZSCRIPT , it just seems easier to do that way.

The subject on morphing actors is discussed here.
Personaly I make different images of the decoration and then create the actors in either DECORATE or ZSCRIPT , it just seems easier to do that way.

The subject on morphing actors is discussed here.
You do not have the required permissions to view the files attached to this post.
-
Average Raven Fan
- Posts: 26
- Joined: Sat Oct 05, 2024 12:00 am
Re: Darken a sprite in zscript
You can use A_SetTranslation to dynamically change the sprite's tint. Bit of a setup to get it going, though!
This is a TRNSLATE file. Adding it here so the next bit of code makes sense.
This is a Zombieman that pulses with darkness! Very evil. It does so by changing its translation every four tics, basically "tinting" it different shades of black as defined in TRNSLATE up there. Should be easy enough to implement in your own actors for dynamic changes! If you just want to set it at spawn time and never look at it again, however, try this one instead :
This is an Imp that you can spawn darker or lighter with map editor arguments in UDB! Just place the actor and set up its first argument field to be any number from 1 to 7.
Give them a go, see if that's what you wanted!
Code: Select all
Dark7 = "0:255=@70[0,0,0]"
Dark6 = "0:255=@60[0,0,0]"
Dark5 = "0:255=@50[0,0,0]"
Dark4 = "0:255=@40[0,0,0]"
Dark3 = "0:255=@30[0,0,0]"
Dark2 = "0:255=@20[0,0,0]"
Dark1 = "0:255=@10[0,0,0]"Code: Select all
class PulseZombieman : Zombieman replaces Zombieman
{
int light;
bool down;
override void Tick()
{
if(GetAge()%4 == 0)
{
switch(light)
{
case 0:
self.A_SetTranslation("");
down = false;
break;
case 7:
self.A_SetTranslation("Dark7");
down = true;
break;
default:
self.A_SetTranslation("Dark"..light);
break;
}
if(down) light--;
else light++;
}
Super.Tick();
}
}Code: Select all
class DarkDoomImp : DoomImp replaces DoomImp
{
override void BeginPlay()
{
self.A_SetTranslation("Dark"..args[0]);
Super.BeginPlay();
}
}Give them a go, see if that's what you wanted!