Maybe a confusing title so let me go into more detail about what I'm trying to do: I thought it would a cool stylistic choice to, rather than the traditional doom mugshot, have my player character's face appear in the reflection of their visor similar to how Metroid Prime and Toy Story 2 do it, but I'm having a little trouble figuring out the how; Ideally I'd want to be able to change the opacity of the mugshots on the fly, keeping it at 0 or near 0 most of the time and then increasing it when you fire guns, pick up weapons, die etc, but I'm not sure if this is at all possible.
tl;dr Is there a way to change the opacity of HUD elements, specifically the mugshot, and if so how?
Variable opacity on mugshot?
Moderator: GZDoom Developers
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!)
-
- Posts: 3
- Joined: Thu Jun 01, 2023 3:47 pm
- Preferred Pronouns: It/Its
- Operating System Version (Optional): Windows 10
-
-
- Posts: 1805
- Joined: Sun Jul 21, 2019 8:54 am
Re: Variable opacity on mugshot?
If you are using SBARINFO you can use the Alpha command to change the opacity of the next specified element.
If you are using ZScript, it depends on what function you use.
The default Doom status bar uses the following function to display the mugshot: DrawTexture(GetMugShot(5), (143, 168), DI_ITEM_OFFSETS);
The very next parameter of this function is alpha, so by doing this: DrawTexture(GetMugShot(5), (143, 168), DI_ITEM_OFFSETS, 0.5); you can render the mugshot at 50% opacity.
If you want it to only appear when specific conditions are done, you will have to experiment a bit.
For example set a variable inside the player class whenever they are firing and display the mugshot only when that variable is set to true.
If you are using ZScript, it depends on what function you use.
The default Doom status bar uses the following function to display the mugshot: DrawTexture(GetMugShot(5), (143, 168), DI_ITEM_OFFSETS);
The very next parameter of this function is alpha, so by doing this: DrawTexture(GetMugShot(5), (143, 168), DI_ITEM_OFFSETS, 0.5); you can render the mugshot at 50% opacity.
If you want it to only appear when specific conditions are done, you will have to experiment a bit.
For example set a variable inside the player class whenever they are firing and display the mugshot only when that variable is set to true.
-
- Posts: 3
- Joined: Thu Jun 01, 2023 3:47 pm
- Preferred Pronouns: It/Its
- Operating System Version (Optional): Windows 10
Re: Variable opacity on mugshot?
Either sound perfect! I'm just happy to hear there is a way to do this, will experiment with both when I get my HUD fully fitted, thanks!Jarewill wrote: ↑Thu Jun 01, 2023 4:11 pm If you are using SBARINFO you can use the Alpha command to change the opacity of the next specified element.
If you are using ZScript, it depends on what function you use.
The default Doom status bar uses the following function to display the mugshot: DrawTexture(GetMugShot(5), (143, 168), DI_ITEM_OFFSETS);
The very next parameter of this function is alpha, so by doing this: DrawTexture(GetMugShot(5), (143, 168), DI_ITEM_OFFSETS, 0.5); you can render the mugshot at 50% opacity.
If you want it to only appear when specific conditions are done, you will have to experiment a bit.
For example set a variable inside the player class whenever they are firing and display the mugshot only when that variable is set to true.