Unit Color Variation/Changer (Skin/Scale/Armour)

Discussion of all aspects of multiplayer development: unit balancing, map development, server development, and so forth.

Moderator: Forum Moderators

User avatar
DuncanDill
Posts: 157
Joined: December 30th, 2022, 11:57 am
Location: Knagla, the evil twin sister of Knalga...

Re: Unit Color Variation (Skin/Scale/Armour)

Post by DuncanDill »

Yomar wrote: February 8th, 2025, 6:39 pm I think this would even be a good adition to the core default faction, maybe as an option that can be checked.
Waiting to see skinn colors on human faces and hands.
Sadly skin colour is not easily possible, due to irregularities in the palette
viewtopic.php?p=690573#p690573 Curent Maintainer of Talentless Mage
viewtopic.php?p=689462#p689462 Gaze at my art :D
User avatar
Refumee
Posts: 286
Joined: February 12th, 2023, 10:17 am
Location: Vendraxis' Lair

Re: Unit Color Variation (Skin/Scale/Armour)

Post by Refumee »

Yomar wrote: February 8th, 2025, 6:39 pm I think this would even be a good adition to the core default faction, maybe as an option that can be checked.
Waiting to see skinn colors on human faces and hands.
Sadly skin colors dont work, it does conflict with wooden parts of weapons or boots.
User avatar
Refumee
Posts: 286
Joined: February 12th, 2023, 10:17 am
Location: Vendraxis' Lair

Re: Unit Color Variation (Skin/Scale/Armour)

Post by Refumee »

Saurian Color Changer and Randomiser is no more!

I present to you Unit Color Variation and Unit Color Changer!

Unit Color Variation got a new entry the Loyalist Armour.
Unit Color Changer replaces Saurian Scalechanger.
You can choose between
- Saurians
- Drakes
- Loyalist Armour
User avatar
Yomar
Posts: 431
Joined: October 27th, 2011, 5:14 am
Contact:

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by Yomar »

Good job !
Beheld the origins of BFW.
Max G on WIF
Rank 🌟🌟🌟🌟🌟
User avatar
Refumee
Posts: 286
Joined: February 12th, 2023, 10:17 am
Location: Vendraxis' Lair

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by Refumee »

Trolls are added.
troll.png
troll2.png
troll2.png (129.25 KiB) Viewed 10625 times
User avatar
Refumee
Posts: 286
Joined: February 12th, 2023, 10:17 am
Location: Vendraxis' Lair

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by Refumee »

New Update 1.1.3

Merfolk is added as well as minor bugfixes
Attachments
merfolk5.png
merfolk4.png
merfolk3.png
merfolk3.png (73.35 KiB) Viewed 3244 times
merfolk2.png
merfolk2.png (62.35 KiB) Viewed 3244 times
merfolk1.png
merfolk6.png
User avatar
Refumee
Posts: 286
Joined: February 12th, 2023, 10:17 am
Location: Vendraxis' Lair

Re: Unit Color Variation (Skin/Scale/Armour)

Post by Refumee »

Yomar wrote: February 8th, 2025, 6:39 pm I think this would even be a good adition to the core default faction, maybe as an option that can be checked.
Waiting to see skinn colors on human faces and hands.
Right now this is not possible for technical reasons.
But I found a way to navigate around the reason.

First of all, what is the reasons? Human skins color is used for wooden parts and sometimes leather or bows.
So recoloring thus seems suboptimal.

I learned the solution for the human skin problem in ly merfolk update.
The solution is, to recreate every human sprite from mainline wesnoth. Give them a fix skin color and use this new sprites for my randomizer or picker.
But this will be a lot of manual work, I am not ready to do yet.
User avatar
Refumee
Posts: 286
Joined: February 12th, 2023, 10:17 am
Location: Vendraxis' Lair

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by Refumee »

Unit Color Changer the Orcish Incursion Update!
New Unit Color Changer/Variation Version 1.2.0 is up on 1.18 wesnoth addon servers.

Now new with the Orcs, Wolves, Goblins!

Supported Units:
- Saurian Scales,
- Drake Scales,
- Loyalist Blue Armour,
- Troll Skin,
- Merfolk Scales, Hair and Armour,
- Orc Armour/Skin,
- Orcish Assassin Cloth/Skin,
- Goblin Armour,
- Wolf Fur (counts for Wolf Rider too),
- Orcish Shaman Cloth/Skin (SotBE, TDG),

Have fun! I am looking forward for your feedback and suggestions!
Attachments
Orc_UCCV6.png
Orc_UCCV5.png
Orc_UCCV4.png
Orc_UCCV3.png
Orc_UCCV2.png
Orc_UCCV2.png (256.8 KiB) Viewed 539 times
Orc_UCCV1.png
User avatar
Refumee
Posts: 286
Joined: February 12th, 2023, 10:17 am
Location: Vendraxis' Lair

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by Refumee »

Two more images
Attachments
Orc_UCCV8.png
Orc_UCCV7.png
User avatar
tsunami_
Posts: 16
Joined: June 22nd, 2024, 2:07 am
Location: Pacific

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by tsunami_ »

You know, it would be an interesting option, if you have 6 colour variations: then instead of randomly, you assign colour variation based on traits. (4x3/2=6 combinations for most races, 10 for elf, dwarf and heavy infantry.)
Then you could have the information just from looking at the army, or the unit you recruited.
User avatar
beetlenaut
Developer
Posts: 2867
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by beetlenaut »

tsunami_ wrote: June 6th, 2025, 2:15 am Then you could have the information just from looking at the army, or the unit you recruited.
That's a really useful idea. It seems like it should have been obvious now that someone has thought of it! I don't think the number of variations is that important, so cutting it down to six in some cases doesn't seem like a huge loss. It would be outweighed by the advantage of being able to see the traits at a glance.

Here is an idea for someone who wants to contribute but doesn't have the coding or painting skills: Work on converting human unit sprites so that this variation code works on them. As far as I understand, the skin color and armor color just need to be in different spots in the palette, so one of them needs to be changed by a tiny amount that is barely noticeable to the eye.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Refumee
Posts: 286
Joined: February 12th, 2023, 10:17 am
Location: Vendraxis' Lair

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by Refumee »

tsunami_ wrote: June 6th, 2025, 2:15 am You know, it would be an interesting option, if you have 6 colour variations: then instead of randomly, you assign colour variation based on traits. (4x3/2=6 combinations for most races, 10 for elf, dwarf and heavy infantry.)
Then you could have the information just from looking at the army, or the unit you recruited.
Interesting idea, this could be added aswell, but what about other traits like loyal?

In MP your idea works, for campaigns I am not that sure. Sometimes I also see a dextrous drakes, saurian or other races who dont have it regulary.
On rare occasions we can also see units with 3 traits.
To take everything into account will be a lot of work.

What can be done is, adding a dummy trait, where the player can see which color it is. It is just a textbox.
User avatar
tsunami_
Posts: 16
Joined: June 22nd, 2024, 2:07 am
Location: Pacific

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by tsunami_ »

Well, I suppose these unusual units would be specially given, so you could give them default colours.
Or, you could add extra four colours, for (strong/quick/intelligent/resilient) + (unusual trait).

I have seen traits-checking-code before, and I think an implementation like this would work:
Check first trait and give a score, for example strong=1, quick=4, resilient=13, intelligent=15.
Then check second trait and add.
Then you check the number:
1 = strong,loyal = colour 1
4 = quick,loyal = colour 2
13 = resilient,loyal = colour 3
15 = intelligent,loyal = colour 4

5 = strong,quick = colour 5
14 = strong,resilient = colour 6
16 = strong,intelligent = colour 7
17 = quick,resilient = colour 8
19 = quick,intelligent = colour 9
28 = resilient,intelligent = colour 10

and other scores, e.g. 0 = loyal,fearless or 8 = quick,quick remain as default. And third and fourth traits are ignored.

--
User avatar
tsunami_
Posts: 16
Joined: June 22nd, 2024, 2:07 am
Location: Pacific

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by tsunami_ »

Here, I have made a quick version of what I explained. I put this .cfg (attachment) inside your add-on, then I added the name to _main and commented out randomizer.

Code: Select all

#{~add-ons/UCV/macros/randomizer.cfg}
{~add-ons/UCV/macros/HI_traits.cfg}
Er, add-on sort of breaks. I am not familiar with "modification" code.
But still it works, if you debug some Heavy infantry, you will see. They are hideous :lol:.

Code: Select all



# quick,strong 		-> red
# quick,resilient 	-> green
# quick,intelligent 	-> blue
# strong,resilient	-> yellow
# strong,intelligent	-> magenta
# resilient,intelligent	-> cyan
# fearless,anything	-> black


[modification]
    id=modification_traits_HI

#define RECOLOUR_UNITS_BY_TRAIT UNIT_TYPE
[event]
	name=unit placed
        first_time_only=no
	[filter]
            [not]
                [filter_wml]
                    [modifications]
                        [object]
                            colour_shifted=yes
                        [/object]
                    [/modifications]
                [/filter_wml]
            [/not]
	     x,y=$x1,$y1
	     type={UNIT_TYPE}
        [/filter]
	[set_variable]
	      name=colour_score
	      value=0
	[/set_variable]
	# quick		= 1
	# strong 	= 10
	# resilient	= 100
	# intelligent	= 1000
	# fearless gives no score.


	[switch]
		variable=unit.modifications.trait[0].id
		[case]
			value=quick
			[set_variable]
			      name=colour_score
			      add=1
			[/set_variable]
		[/case]
		[case]
			value=strong
			[set_variable]
			      name=colour_score
			      add=10
			[/set_variable]
		[/case]
		[case]
			value=resilient	
			[set_variable]
			      name=colour_score
			      add=100
			[/set_variable]
		[/case]
		[case]
			value=intelligent	
			[set_variable]
			      name=colour_score
			      add=1000
			[/set_variable]
		[/case]
		[else]
		[/else]
	[/switch]

	[switch]
		variable=unit.modifications.trait[1].id
		[case]
			value=quick
			[set_variable]
			      name=colour_score
			      add=1
			[/set_variable]
		[/case]
		[case]
			value=strong
			[set_variable]
			      name=colour_score
			      add=10
			[/set_variable]
		[/case]
		[case]
			value=resilient	
			[set_variable]
			      name=colour_score
			      add=100
			[/set_variable]
		[/case]
		[case]
			value=intelligent	
			[set_variable]
			      name=colour_score
			      add=1000
			[/set_variable]
		[/case]
		[else]
		[/else]
	[/switch]
	
	[switch]
		variable=colour_score
		[case]
			value=11
			{VARIABLE new_colour FF0000}
		[/case]
		[case]
			value=101
			{VARIABLE new_colour 00FF00}
		[/case]
		[case]
			value=1001
			{VARIABLE new_colour 0000FF}
		[/case]
		[case]
			value=110
			{VARIABLE new_colour FFFF00}
		[/case]
		[case]
			value=1010
			{VARIABLE new_colour FF00FF}
		[/case]
		[case]
			value=1100
			{VARIABLE new_colour 00FFFF}
		[/case]
		[else]
			{VARIABLE new_colour 000000}
		[/else]
	[/switch]

	[object]
		colour_shifted=yes
		silent=yes
		[effect]
			apply_to=image_mod
			add=PAL(A8A098 > $new_colour)
		[/effect]
	[/object]

[/event]
#enddef


{RECOLOUR_UNITS_BY_TRAIT (Heavy Infantryman)}


[/modification]
Attachments
HI_traits.cfg
(2.77 KiB) Downloaded 8 times
User avatar
Refumee
Posts: 286
Joined: February 12th, 2023, 10:17 am
Location: Vendraxis' Lair

Re: Unit Color Variation/Changer (Skin/Scale/Armour)

Post by Refumee »

@tsunami
Your code looks good 👍
I will add it, players don't need to put this feature on if they don't want it, after my addon creation break.
I also need to adjust my code for the new modifications line.

Ready out traits isn't that difficult, I have that for loyal already. Your code looks quite well indeed.
Post Reply