Page 1 of 1

Change colors on a thing?

Posted: Thu Aug 03, 2006 7:01 pm
by DeumReaper
Here's the situation: I'm making a GZDoom wad that uses the zdoom feature in which a thing changes certain colors.
Specifically I have created an actor (a wandering PLAY marine sprite) and he loads into the map fine; but I'm trying to use scripts that change his green armor to red armor and it won't work! Here's the relevant scripts in the SCRIPTS lump:

Code: Select all

script 4 OPEN //Changes 2ndLtSmith actor with tid 1 from green color to red color
{
	CreateTranslation (1, 112:127=32:47); //Defines a palette translation from green to red
)
	
script 5 enter //Activates script 4
{
	Thing_SetTranslation(1, 1); //Uses the defined translation from green to red armor
}
As you can see I'm trying to change his armor pemanently from the start; not activated--The actor's TID in the map is clearly defined as #1. I've tried searching forums and wads for examples, but I can't get it to work. Anyone have any suggestions?

Posted: Thu Aug 03, 2006 7:13 pm
by Cyrez
this may sound dumb but are the sprites in png format? AFAIK png's can not use color translation.

Posted: Thu Aug 03, 2006 7:46 pm
by DeumReaper
the PLAY marine sprites are the default player sprites (not modified in any way) and this actor uses them.

Posted: Thu Aug 03, 2006 7:53 pm
by Enjay
As a matter of interest, why are you setting the translation using an enter script? This should work equally well:

Code: Select all

script 4 OPEN //Changes 2ndLtSmith actor with tid 1 from green color to red color 
{ 
   CreateTranslation (1, 112:127=32:47); //Defines a palette translation from green to red 
   Thing_SetTranslation(1, 1); //Uses the defined translation from green to red armor 
}
Also, I'm assuming the ) at the end of script 4 in your post is a typo. It should, of course, be a }

Although, perhaps that is your problem because I tried both your (without the ")" ) and my scripts and they both worked.

Also, I noticed this comment:

Code: Select all

script 5 enter //Activates script 4 
Perhaps it's just the way you phrased it, but it doesn't activate script 4, it merely applies the translation in script 4. An open script runs when a map starts and the activator of the script is "the world". An enter script is run once for every player who enters a map and the activator is the player.

And Cyrez is correct, if your sprites are png graphics, this will not work. [edit]OK forget that last bit, I see you've clarified that point.[/edit]

Posted: Thu Aug 03, 2006 8:38 pm
by DeumReaper
Nope it didn't work the bastard is still green
First I tried fixing the } and setting it to OPEN (the wiki said enter that's why I had it originally)..nope
Then I just copy/pasted that script...nope

I'm pretty sure DeePSea recognizes the actor, doesn't recognize it as DECORATE but allowed me to give it TID-1

Do I have to use Thing_SetSpecial or ACS_Execute on the thing properties?

Posted: Thu Aug 03, 2006 9:04 pm
by Enjay
You shouldn't need anything more than I posted in the above script. Are you actually compiling the script? If you had that ) in the actual script, then the compiler should have complained.

If you're using DeePSea, you'll find all your script options under the F6 button.

Here, try the attached. It's just using the following in a script:

Code: Select all

#include "zcommon.acs"

script 4 OPEN //Changes 2ndLtSmith actor with tid 1 from green color to red color 
{ 
   CreateTranslation (1, 112:127=32:47); //Defines a palette translation from green to red 
   Thing_SetTranslation(1, 1); //Uses the defined translation from green to red armor 
}
Anyway, did you know that you can apply translations directly to a thing in DECORATE? So you don't need to script the colour change at all if you don't want to. I only found out about that recently: http://forum.drdteam.org/viewtopic.php? ... tion#11023

Posted: Thu Aug 03, 2006 9:26 pm
by DeumReaper
The only thing I missed there was the #include, but it still didn't work. I ditched the script and tried the Decorate flag you mentioned.. and it did work! very useful. thnx NJ for your time