Catgirls, the WML side

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
laerne
Posts: 47
Joined: January 2nd, 2014, 11:49 pm

Catgirls, the WML side

Post by laerne »

Hello, I'm trying to develop my own factions of catgirls. The art was started and can be found here.

I'm trying to recolor the following sprite with two color ranges. There's the default magenta palette and a new "cyan" palette. I'd like the magenta to be recolored normally to the team color, but on top of that, I'd like the cyan palette to also be recolored to a custom color_range ("Indigo", "Sky Blue" or "Sun Yellow").
chakram_units4.png
chakram_units4.png (11.3 KiB) Viewed 1783 times
Here is the custom team-colors.cfg that define the palette and the color ranges

Code: Select all

[color_range]
    id=indigo
    rgb=60219C,FFFFFF,080808,60219C
    name= _ "Indigo"
[/color_range]

[color_range]
    id=skyblue
    rgb=18B8DF,FFFFFF,000510,18B8DF
    name= _ "Sky Blue"
[/color_range]

[color_range]
    id=sunyellow
    rgb=FFDC2D,FFF7DC,893C09,FFDC2D
    name= _ "Sun Yellow"
[/color_range]

[+color_palette]
    # secondary value used to recolor catgirls
    cyan=00FFFF,002424,003636,004545,005252,005E5E,006B6B,007979,008585,009292,00A1A1,00C0C0,00D2D2,00E2E2,00F0F0,30FFFF,60FFFF,91FFFF,C5FFFF
    #sorted light-to-dark: C5FFFF,91FFFF,60FFFF,30FFFF,00FFFF,00F0F0,00E2E2,00D2D2,00C0C0,00A1A1,009292,008585,007979,006B6B,005E5E,005252,004545,003636,002424
    #sorted dark-to-light: 002424,003636,004545,005252,005E5E,006B6B,007979,008585,009292,00A1A1,00C0C0,00D2D2,00E2E2,00F0F0,00FFFF,30FFFF,60FFFF,91FFFF,C5FFFF
[/color_palette]
team-colors.cfg
(857 Bytes) Downloaded 44 times
I linked this file from my _main.cfg of the add-ons (currently named "Feu_Ra") like this:

Code: Select all

[game_config]
	{~add-ons/Feu_Ra/team-colors.cfg}
[/game_config]
Then in the `[unit_type]` tag I added the following:

Code: Select all

    [object]
        [effect]
            apply_to=image_mod
            add=RC(cyan>sunyellow)
        [/effect]
    [/object]
chakram_warrior.cfg
(850 Bytes) Downloaded 43 times
It doesn't seem to work...
Screenshot from 2024-11-24 02-11-55.png
Screenshot from 2024-11-24 02-11-55.png (21.79 KiB) Viewed 1783 times
Could you help me ?
Many thanks in advance :)
User avatar
Celtic_Minstrel
Developer
Posts: 2371
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Catgirls, the WML side

Post by Celtic_Minstrel »

laerne wrote: November 24th, 2024, 1:13 am
Then in the `[unit_type]` tag I added the following:

Code: Select all

    [object]
        [effect]
            apply_to=image_mod
            add=RC(cyan>sunyellow)
        [/effect]
    [/object]
That's not valid. [object] is not allowed in [unit_type].

I'm not quite sure, but you might just be able to write image_mod=RC(cyan>sunyellow) without any tags. If that doesn't work you'd need to append ~RC(cyan>sunyellow) to each of the images, in other words everywhere an image is used in the file (except for the portrait).
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
beetlenaut
Developer
Posts: 2867
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Catgirls, the WML side

Post by beetlenaut »

You could use that [object] code in an event (I would use a unit_placed event), and the [event] can go in [unit_type].
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
laerne
Posts: 47
Joined: January 2nd, 2014, 11:49 pm

Re: Catgirls, the WML side

Post by laerne »

Neither method seems to work...

Code: Select all

    [event]
        type=unit_placed
        [object]
            [effect]
                apply_to=image_mod
                add=RC(cyan>sunyellow)
            [/effect]
        [/object]
    [/event]
or

Code: Select all

    image="units/feu-ra/chakram_fighters/chakram_warrior+TEST.png~RC(cyan>indigo)"
Wesnoth does not complain to stdout or stderr when launching from a terminal, even with the `--debug` flag. Is there another log I need to check ? Or is there a console command I can run to list the available color_range and color_palette ?
User avatar
laerne
Posts: 47
Joined: January 2nd, 2014, 11:49 pm

Re: Catgirls, the WML side

Post by laerne »

Hum, I'm not sure I can define my own color ranges… The wiki says :
This tag is a top level WML tag which can only be used once because it defines basic settings that are used everywhere in the game. In official versions of Wesnoth it is in game_config.cfg; values used there are labeled 'standard'.
Even though I don't know the codebase, I tried to debug a little and indeed it seems there is only one game_config tag, the one in /usr/share/wesnoth/data/schema/game_config.cfg...

Any workaround to add color ranges ? using [+game_config] doesn't seem to work...
gnombat
Posts: 892
Joined: June 10th, 2010, 8:49 pm

Re: Catgirls, the WML side

Post by gnombat »

laerne wrote: November 24th, 2024, 3:18 pm

Code: Select all

    [event]
        type=unit_placed
        [object]
            [effect]
                apply_to=image_mod
                add=RC(cyan>sunyellow)
            [/effect]
        [/object]
    [/event]
This should be:

Code: Select all

    [event]
        name=unit_placed
        first_time_only=no
        [object]
            [effect]
                apply_to=image_mod
                add=RC(cyan>sunyellow)
            [/effect]
        [/object]
    [/event]
laerne wrote: November 24th, 2024, 4:51 pm Any workaround to add color ranges ? using [+game_config] doesn't seem to work...
Try it without the [game_config][/game_config] tags.
User avatar
beetlenaut
Developer
Posts: 2867
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Catgirls, the WML side

Post by beetlenaut »

You are trying to do too much at once I think. We don't know which part is not working, so we need to guess. I think the event code gnombat provided should work fine as long as it is in the right place, but verify that by using a different image path function in it (GS for example) to make sure that it is working.
Then use RC with core color palettes to verify that it is doing what you want.
Then use RC with a core palette and one of your color ranges to make sure that the range is right.
Then use PAL with your palette and a core one to make sure your palette exists.

When something doesn't work, you will know where the problem is.

Alternatively, you could just post the whole addon, and someone who was bored will mess with it until it works--probably running through steps like the ones above. We can also make sure the code you posted is in the right place. If correct code is in the wrong place, it will look like it did nothing.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Celtic_Minstrel
Developer
Posts: 2371
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Catgirls, the WML side

Post by Celtic_Minstrel »

Colour ranges don't need to be inside a [game_config] tag if I recall correctly. I think [color_palette] does but I'm not 100% sure that custom palettes are actually supported.

I believe the RC command can also take the full palette definition as its first argument. That is to say, you could copy the list of colours from the palette definition and paste them in place of the word "cyan" in your image mod. That's one other thing you could try in the process of figuring out which piece isn't working.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
gnombat
Posts: 892
Joined: June 10th, 2010, 8:49 pm

Re: Catgirls, the WML side

Post by gnombat »

Celtic_Minstrel wrote: November 24th, 2024, 8:56 pm Colour ranges don't need to be inside a [game_config] tag if I recall correctly. I think [color_palette] does but I'm not 100% sure that custom palettes are actually supported.
I have seen [color_palette] used in UMC.
User avatar
Celtic_Minstrel
Developer
Posts: 2371
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Catgirls, the WML side

Post by Celtic_Minstrel »

Still, dropping the entire palette definition into the RC command is a valid thing to try.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
laerne
Posts: 47
Joined: January 2nd, 2014, 11:49 pm

Re: Catgirls, the WML side

Post by laerne »

Hello.

Moving the [color_range] and [color_palette] outside [game_config] seems to do the trick. The following works.

Code: Select all

image="units/feu-ra/chakram_fighters/chakram_warrior.png~RC(cyan>sunyellow)"
Mary thanks !

I tried to make the event works as well, to have different colors per unit side, but the filters were very buggy (only one unit affected despite the first_time_only=no, new recruited units didn't work...) I will ask again later when the mod is more fleshed out.

As for sharing the mod, I will at some point (likely when I try again to recolor sprites) but it's so bare-bone and messy for now I'd feel bad letting people spend time trying to figure it out. Besides I have to corporately validate open-sourcing anything at work, so it'll take a little time.
User avatar
Ravana
Forum Moderator
Posts: 3314
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Catgirls, the WML side

Post by Ravana »

You give all objects to same unit.
Post Reply