Craigs Posted April 6, 2006 I've noticed that in a lot of wads, those NPC marines have different colored armor. At first, I thought it was a voodoo doll trick, but it isn't. Then I thought they were custom sprites but still no. So how do you change one of those Zdoom NPC's armor color? 0 Quote Share this post Link to post
Enjay Posted April 7, 2006 http://www.zdoom.org/wiki/index.php?title=CreateTranslation 0 Quote Share this post Link to post
Kinsie Posted April 7, 2006 Enjay said:http://www.zdoom.org/wiki/index.php?title=CreateTranslation I'm having a little trouble with this. #include "zcommon.acs" script 1 OPEN { PrintBold(s:"Palleteshifting..."); //Pallete shifting the four marines at level start CreateTranslation (1, 112:127=32:47); CreateTranslation (2, 112:127=32:47); CreateTranslation (3, 112:127=32:47); CreateTranslation (4, 112:127=32:47); }It prints the message, but doesn't do the specified recolours on those Things. 0 Quote Share this post Link to post
Enjay Posted April 7, 2006 You also have to give the marines the translation: http://www.zdoom.org/wiki/index.php?title=Thing_SetTranslation You have set up 4 identical translations. You don't need to do that. You can set up one translation and give it to 4 different things. Assuming you are giving your marines tids 1,2,3 and 4 it should look something like this: script 1 OPEN { CreateTranslation (1, 112:127=32:47); Thing_SetTranslation(1, 1); Thing_SetTranslation(2, 1); Thing_SetTranslation(3, 1); Thing_SetTranslation(4, 1); } The first number in CreateTranslation is an index for the translation you have created. So, you use Thing_SetTranslation to give that translation number to any items with the specified tid. Of course, unless you need your marines to all have different tids, they can all share the same tid and cut down on the script still further. script 1 OPEN { CreateTranslation (1, 112:127=32:47); Thing_SetTranslation(1, 1); } 0 Quote Share this post Link to post
Kinsie Posted April 7, 2006 Ohhh... haha, shit. Thanks Enjay! I am now 1% smarter. 0 Quote Share this post Link to post
D2Jk Posted July 28, 2014 Bumping this thread for a follow-up question. I'd like to change an actor's color dynamically within one of its actor states. Unfortunately the list of action functions doesn't seem to offer anything to accomplish this, so I'm guessing I'll have to create a custom ACS script for this instead, passing the R,G,B values as arguments in ACS_NamedExecute. I came up with the following script:Script "Colorize" (int R, int B, int G) { CreateTranslation (99, 0:255=%[0,0,0]:[R,G,B]); Thing_SetTranslation(5, 99); Delay(1); } The Thing ID (5) is just something I made up for now. What should I replace it with, considering that I may be calling this script from a number of different actors, all of which I'm assuming have their own IDs? Can it be done this way? 0 Quote Share this post Link to post
Gez Posted July 28, 2014 If you use CallACS from the actor's DECORATE code, you can use 0 as the TID for Thing_SetTranslation. I'm not sure, however, redefining the same translation all the time will work out as you expect it... 0 Quote Share this post Link to post
D2Jk Posted July 28, 2014 I see. So it would be more advisable to simply create a script for each colorization, assigning each translation a unique ID (95,96,97...)? EDIT: It's not working yet:Script "ColorizeRed" (void) { CreateTranslation (98, 0:255=%[0,0,0]:[1,0,0]); Thing_SetTranslation(0, 98); Delay(1); } This is how I call it in decorate:TNT1 A 0 ACS_NamedExecute("ColorizeRed") What did I miss? 0 Quote Share this post Link to post
D2Jk Posted July 29, 2014 Still trying to get this work. I could simply create new sprites with the desired color in image editing program, but I'd like to learn to do this in a smarter way. Are there any WADs that might already have a script like this, that I could take look at? I don't mean recoloring monsters or players upon entering a map, but instead during the play. 0 Quote Share this post Link to post
Kappes Buur Posted July 29, 2014 http://zdoom.org/wiki/DECORATE_expressions#ACS_function 0 Quote Share this post Link to post
D2Jk Posted July 29, 2014 I don't know why you posted that link, as I already knew what functions I'm going to need. Anyway, I also happened to find the problem. This was wrong: "CreateTranslation (98, 0:255=%[0,0,0]:[1,0,0])" It has to be: "CreateTranslation (98, 0:255=%[0.0,0.0,0.0]:[1.0,0.0,0.0])" (though slightly more compact 0:255=%[0,0,0]:[1.0,0,0] seems to work as well) What a headache over a simple matter... 0 Quote Share this post Link to post
Kappes Buur Posted July 29, 2014 D2Jk said:I don't know why you posted that link, as I already knew what functions I'm going to need. You have this:TNT1 A 0 ACS_NamedExecute("ColorizeRed") The WIKI states this: ACS_ExecuteWithResult — runs a script and uses its return value. ACS_NamedExecuteWithResult — runs a named script and uses its return value. CallACS — shorter alias for ACS_NamedExecuteWithResult. From that I would assume that you have to useTNT1 A 0 ACS_NamedExecuteWithResult("ColorizeRed") Or as Gez suggested:TNT1 A 0 CallACS("ColorizeRed") 0 Quote Share this post Link to post
D2Jk Posted July 29, 2014 Well, ACS_NamedExecute has worked well in my previous scripts. But in fact, I'm currently just using "TNT1 A 0 Thing_SetTranslation(0, 98)" (a script creates the translation). Apparently this works too. 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.