Heretic Translation / Palette swap example

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.

Heretic Translation / Palette swap example

Postby peewee_RotA » Sat May 29, 2021 7:38 pm

Anyone have an example of using the Translation feature in ZScript, especially for heretic?

CreateTranslation appears to not exist in ZScript, and absolutely every single combination of A_SetTranslation that I've used (including multiple existing examples from Decorate from other mods) fail to work in Heretic. Even the presets (2 and 3) completely break the rendering. The only combination that I could get to work was A_SetTranslation ("Ice");

Any examples of a working palette swap for ZScript and for Heretic would be very much appreciated. Thanks!
peewee_RotA
 
Joined: 07 Feb 2014

Re: Heretic Translation / Palette swap example

Postby Jarewill » Sun May 30, 2021 4:13 am

You can use the Translation property in the default block to change the translation for the actor, it supports the preset ones.
If you want to change it on the fly, you have to use A_SetTranslation, however that works differently:
You have to create a TRNSLATE file that will contain translation like this:
Code: Select allExpand view
EnergyEmpty = "241:246=26:31", "224:229=29:31"

Then you have to use the assigned name in A_SetTranslation:
Code: Select allExpand view
A_SetTranslation("EnergyEmpty");
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Heretic Translation / Palette swap example

Postby peewee_RotA » Sun May 30, 2021 11:13 am

That works. Thank you.

For others who are new to this, when I added a file named TRNSLATE in the root of the project folder (root of the wad/pk3) with one of these translations written like a variable, ZScript was able to use it by name in A_SetTranslation. This is to set the translation/palette swap in code after an event.

C:\(mod root folder)\TRNSLATE
Code: Select allExpand view
StoneSkin = "80:143=0:63", "144:207=0:63"


C:\(mod root folder)\zscript\mycodefile.zs
Code: Select allExpand view
class MyMonster: Actor
{
   //... a bunch of monster code

   override int TakeSpecialDamage(Actor inflictor, Actor source, int damage, Name damagetype)
   {
      A_SetTranslation("StoneSkin");
      
      return Super.TakeSpecialDamage(inflictor, source, damage, damagetype);
   }
}
peewee_RotA
 
Joined: 07 Feb 2014


Return to Scripting

Who is online

Users browsing this forum: TXTX and 1 guest