Change colors on a thing?

Discuss all aspects of editing for ZDoom.
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.

Change colors on a thing?

Postby DeumReaper » Thu Aug 03, 2006 8:01 pm

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 allExpand view
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?
DeumReaper
 
Joined: 27 Dec 2005

Postby Cyrez » Thu Aug 03, 2006 8:13 pm

this may sound dumb but are the sprites in png format? AFAIK png's can not use color translation.
User avatar
Cyrez
Avraging 3 years per Project
 
Joined: 15 Jul 2003
Location: Missouri

Postby DeumReaper » Thu Aug 03, 2006 8:46 pm

the PLAY marine sprites are the default player sprites (not modified in any way) and this actor uses them.
DeumReaper
 
Joined: 27 Dec 2005

Postby Enjay » Thu Aug 03, 2006 8:53 pm

As a matter of interest, why are you setting the translation using an enter script? This should work equally well:

Code: Select allExpand view
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 allExpand view
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]
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Postby DeumReaper » Thu Aug 03, 2006 9:38 pm

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?
DeumReaper
 
Joined: 27 Dec 2005

Postby Enjay » Thu Aug 03, 2006 10:04 pm

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 allExpand view
#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
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Postby DeumReaper » Thu Aug 03, 2006 10:26 pm

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
DeumReaper
 
Joined: 27 Dec 2005


Return to Editing (Archive)

Who is online

Users browsing this forum: No registered users and 2 guests