Resetting Player Translation

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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!)
Post Reply
Heisanevilgenius
Posts: 95
Joined: Wed Dec 15, 2021 8:38 pm
Graphics Processor: nVidia (Modern GZDoom)

Resetting Player Translation

Post by Heisanevilgenius »

Hi, I have some scripted effects where a player's translation will change due to status conditions, such as an ice palette if they're frozen. The problem is, I'm not sure how to set it back to normal. If I use A_SetTranslation and use the normal palette (0:255=0:255) then it resets the player to the default green palette rather than the one created in the player setup or the multiplayer defaults.

Is there any way to revert the translation to the proper colours rather than just the default green?
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Resetting Player Translation

Post by Jarewill »

The way I did it was saving the player translation to a variable and then restoring it, like so:

Code: Select all

uint storetrans;
Override void PostBeginPlay()
{
	Super.PostBeginPlay();
	storetrans=Translation;
}

//This will restore the translation:
// Translation=storetrans;
Heisanevilgenius
Posts: 95
Joined: Wed Dec 15, 2021 8:38 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Resetting Player Translation

Post by Heisanevilgenius »

Oh, cool! Thank you
Heisanevilgenius
Posts: 95
Joined: Wed Dec 15, 2021 8:38 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Resetting Player Translation

Post by Heisanevilgenius »

I had to make some small modifications but now it works perfectly!

(Storing a translation as a uint is depricated now so I just needed to change it to a TranslationID variable instead.)
I also put the code under Tick instead of BeginPlay in case a player changes their player colour on the fly, with a quick check to make sure they're not frozen so it doesn't save the frozen translation
Post Reply

Return to “Scripting”