[Solved] Player Translations and ZScript

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
Jarewill
 
 
Posts: 1766
Joined: Sun Jul 21, 2019 8:54 am

[Solved] Player Translations and ZScript

Post by Jarewill »

I have been looking for a way to change the player's translation in ZScript.
So far, I have defined all 8 pre-set translations (from Strife) in the TRNSLATE lump and I'm calling A_SetTranslation based on the player's "colorset" CVar.
Trying to change the Translation property by itself without A_SetTranslation resulted so far in the player turning invisible with white and [color] accents.

However, I have been stuck with custom player colors.
I know that they are kept in the "color" CVar, but I don't know how to convert that into a TRNSLATE definition, without having to define 16,581,375 different translations and change them based on every slight change to the CVar.

So I wanted to ask the following:
- How to modify the "Translation" property in ZScript, and;
- How to convert the "color" CVar into a translation?

Thank you.

Edit: I have managed to make it work by storing the player's translation in a variable in PostBeginPlay.
I assume players have a special Translation going on? Because bringing back that variable into the property causes the player to start changing color again.
I didn't even need to define those translations in a TRNSLATE lump.
Post Reply

Return to “Scripting”