• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Mod - Change sail colors

Captain_Vane

Landlubber
I was a bit disappointed to find CoAS doesn't have the sail color changer that CT has. At least not anywhere I could find it. I mainly wanted a tanbark color for my schooner and a black sail color. After finding a post showing some old code in the pirate shipyard file for a guide,I decided to add it to my MainHero_dialog.c file.
So, if anyone want's a free and simple way to change their sail colors in CoAS, here's an option.

I'm running the GOF mod, so I would suggest pasting the code into your file.I will attach my file so you can look at it as a guide. Make sure to backup your file first.

Edit: If your trying this in the Eras mod and it doesn't work, try changing
Code:
 pchar.ship.sailscolor
to:
Code:
 pchar.ship.sails.color
The colors could use some work still.Some are duplicates. The reds and tanbark are similar. Some of the others like yellow need help. Tried to give at least 3 shades of each color. Not sure how many there are.If you find a nice color or other improvements,please post it.
This site has some codes to play with >>> Purple color codes - RGB purple colors

To use it, you need to talk to yourself, on shore or in your cabin, then go from shore to ship or from cabin to sea to world map and back to sea.

edit: "Number One" is my imaginary First Officer the developers seem to have forgotten. I am considering that outdoor merchant to sell the dye. Doing it with the self-talk dialog makes testing easier. If anyone can come up with something more fitting, please share.

This works for me with saved games. Use the down arrow to see all options.
If I got this right, it should work for you.

The file to change is "MainHero_dialog.c" in program/dialogs/russian
Make sure to backup your original first.

To install it, first find near the top of your MainHero_dialog.c:

Code:
case "TalkSelf_Main":

then at the bottom of that select case statement find this code.Hopefully this part will be common to all versions:
Code:
 // захват города
            if (GetCharIDXForTownAttack(pchar.location) != -1)
            {
                Link.l6 = DLG_TEXT_BASE[23];
                Link.l6.go = "TalkSelf_TownAttack";
            }
            Link.l10 = RandPhraseSimple(DLG_TEXT_BASE[24], DLG_TEXT_BASE[25]);
            Link.l10.go = "exit";

break;   //<< replace this line with the new code

now copy this new code below, then in the above code ,delete the last "break;" with your mouse and paste this new code right there (the break is included in it) Don't miss the semicolon:

Code:
///**********************************************************************************************************************
///            Start of Sail Color Code
///            Charles_Vane  (BJI)  1/7/2019
///**********************************************************************************************************************
///

      
             link.l11 = "Number One, I want you to go find dye to color our sails with.";
            link.l11.go = "TalkSelf_change_sail_color";

        break;  ///  <<<---- this is from original code

        case "TalkSelf_change_sail_color":
            NextDiag.TempNode = "First time";
            dialog.Text = "So, what color ye be wantin' capt'n";
            Link.l1 = "Make it tanbark Number One!";
            Link.l1.go = "sail_color_tanbark";

            Link.l2 = "Make them dark Number One!";
            Link.l2.go = "sail_color_black";

            Link.l3 = "Make it blue Number One!";
            Link.l3.go = "sail_color_blue";

            Link.l4 = "Make it red Number One!";
            Link.l4.go = "sail_color_red";

            Link.l5 = "Make it green Number One!";
            Link.l5.go = "sail_color_green";

            Link.l6 = "Make it orange Number One";
            Link.l6.go = "sail_color_orange";

            Link.l7 = "I'm feelin' purple today Number One!";
            Link.l7.go = "sail_color_purple";

            Link.l8 = "What do you think of yellow Number One?";
            Link.l8.go = "sail_color_yellow";

            Link.l9 = "Let's have white sails again Number One!";
            Link.l9.go = "sail_color_white";


        break;


        case "sail_color_tanbark":
             Dialog.Text = "Aye,Aye Captain.You want light, medium or dark tanbark?";
             Link.l1 = "dark, Number One!";
             Link.l1.go = "set_tanbark_dark";
             Link.l2 = "medium, Number One!";
             Link.l2.go = "set_tanbark_med";
             Link.l3 = "light, Number One!";
             Link.l3.go = "set_tanbark_light";
             Link.l4 = "Extra dark, Number One!";
             Link.l4.go = "set_tanbark_exdark";

        break;

    ///SailsColors[8].color = argb(255, 180, 40, 60);
    ///SailsColors[9].color = argb(255, 125, 25, 25);
    ///SailsColors[10].color = argb(255, 90, 25, 25);
    ///dark reddish argb(255,180, 40, 60);
    /// very light brownish  pchar.ship.sailscolor =  argb(255, 200, 170, 170);
        case "set_tanbark_exdark":
            pchar.ship.sailscolor =  argb(255, 95, 35, 45); /// 90, 25, 25);
            DialogExit_Self();
        break;
             // pchar.ship.sailscolor =   argb(255, 95, 35, 35);// argb(255, 225, 180, 100);  ///255, 220, 200
        case "set_tanbark_dark":
            pchar.ship.sailscolor =  argb(255, 125, 35, 45); /// 90, 25, 25);
            DialogExit_Self();
        break;
        case "set_tanbark_med":
            pchar.ship.sailscolor =  argb(255, 155, 55, 0);
            //pchar.ship.sailscolor =  argb(255, 190, 75, 75); //150, 75, 75
            DialogExit_Self();
        break;
        case "set_tanbark_light":
            pchar.ship.sailscolor =  argb(255, 220, 100, 80);  /// 190, 50, 60  .. 180, 40, 60 ..  220, 100, 100);
            DialogExit_Self();
        break;
        ///finished
        case "sail_color_black":
             Dialog.Text = "Aye,Aye Captain.You want light, medium or dark Black?";
             Link.l1 = "Make it light grey, Number One!";
             Link.l1.go = "set_black_light";
             Link.l2 = "Make it medium grey, Number One!";
             Link.l2.go = "set_black_med";
             Link.l3 = "Paint it black, Number One!";
             Link.l3.go = "set_black_dark";
        break;

        case "set_black_dark":
             pchar.ship.sailscolor =  argb(155, 55, 55, 55);
             DialogExit_Self();
        break;

        case "set_black_med":
              pchar.ship.sailscolor =  argb(155, 100, 100, 100);
               DialogExit_Self();
        break;

        case "set_black_light":
             pchar.ship.sailscolor =  argb(155, 160, 160, 160);
              DialogExit_Self();
        break;


        case "sail_color_blue":
             Dialog.Text = "Aye,Aye Captain.You want light, medium or dark blue?";
             Link.l1 = "Dark Number One!";
             Link.l1.go = "set_blue_dark";
             Link.l2 = "Medium Number One!";
             Link.l2.go = "set_blue_med";
             Link.l3 = "Light Number One!";
             Link.l3.go = "set_blue_light";

        break;

        case "set_blue_dark":
              pchar.ship.sailscolor =  argb(255, 40, 40, 125); ///good!
             DialogExit_Self();
        break;
        case "set_blue_med":
               pchar.ship.sailscolor =  argb(255, 100, 150, 200);  /// 34, 34, 125); ///med to light
               DialogExit_Self();
        break;
        case "set_blue_light":
              pchar.ship.sailscolor =  argb(255,153, 204, 255); //pchar.ship.sailscolor =  argb(255,160, 160, 255);
              DialogExit_Self();
        break;

       /// RED
        case "sail_color_red":  ///";
             Dialog.Text = "Aye,Aye Captain.You want light, medium or dark red?";
             Link.l1 = "Dark Number One!";
             Link.l1.go = "set_red_dark";
             Link.l2 = "Medium Number One!";
             Link.l2.go = "set_red_med";
             Link.l3 = "I'm feelin' like a woman today.Make it pink Number One!";
             Link.l3.go = "sail_color_pink";
             Link.l4 = "How about salmon Number One!";
             Link.l4.go = "set_red_salmon";
             Link.l5 = "How about cerise Number One!";
             Link.l5.go = "set_red_cerise";
             Link.l6 = "Bright red Number One!";
             Link.l6.go = "set_red_bright";


        break;

///salmon 253 171 158
///cerise  222 49 99
///ruby   224  17  95
        case "set_red_dark":
             pchar.ship.sailscolor =  argb(255, 100, 15, 15);
             DialogExit_Self();
        break;
        case "set_red_med":
               pchar.ship.sailscolor =  argb(255,  200, 10, 10); //134, 34, 95) ;//170, 70, 70);
               DialogExit_Self();
        break;
        case "set_red_salmon":
              pchar.ship.sailscolor =  argb(255, 255, 171, 150);  ///blue purple med //pchar.ship.sailscolor =  argb(255,160, 160, 255);
              DialogExit_Self();
        break;

        case "set_red_cerise":
               pchar.ship.sailscolor =  argb(255, 222, 49, 99);  ///bluish purple
              DialogExit_Self();
        break;

        case "set_red_bright":
               pchar.ship.sailscolor =  argb(255, 255, 50, 50); ///argb(255, 200, 25, 25); //brite red
              DialogExit_Self();
        break;



        case "sail_color_pink": /// argb(255, 200, 125, 125); //pink   // pchar.ship.sailscolor =  argb(255, 255, 153, 153);
             Dialog.Text = "Arrrgghh....PLEASE,PLEASE NOT PINK!!";  //Aye,Whatever my Lady Captain desires";
             Link.l1 = "You heard me. That's an order!Move it or you'll be swabbin' the decks!!";
             pchar.ship.sailscolor =  argb(255, 255, 155, 155); ///bright
            /// pchar.ship.sailscolor =  argb(255, 253, 155, 153);
             Link.l1.go = "exit";
             Link.l2 = "Never mind then, I'll pick another color you crybaby";
             Link.l2.go = "TalkSelf_change_sail_color";
        break;




///
        case "sail_color_green":
             Dialog.Text = "Aye,Aye Captain.You want light, medium or dark green?";

             Link.l1 = "Dark Number One!";
             Link.l1.go = "set_green_dark";
             Link.l2 = "Medium Number One!";
             Link.l2.go = "set_green_med";
             Link.l3 = "Light Number One!";
             Link.l3.go = "set_green_light";
             Link.l3 = "I feel like chartuse Number One!";
             Link.l3.go = "set_green_chartuse";

        break;


        case "set_green_dark":
              pchar.ship.sailscolor =  argb(255, 34, 125, 34);
               /// pchar.ship.sailscolor =  argb(255,95, 95, 0);
             DialogExit_Self();
        break;
        case "set_green_med":
               //  pchar.ship.sailscolor =  argb(255, 70, 170, 70);
               //pchar.ship.sailscolor =  argb(255, 155, 155, 50);
                pchar.ship.sailscolor =  argb(255, 95, 95, 0);///nice med  green
               DialogExit_Self();
        break;
        case "set_green_light":
               pchar.ship.sailscolor =  argb(255,255, 255, 153);
              // pchar.ship.sailscolor =  argb(255,153, 255, 200);//very light green
              // pchar.ship.sailscolor =  argb(255,195, 195, 100);///light green
              DialogExit_Self();
        break;
        case "set_green_chartuse":
             Dialog.Text = "Umm....WTF Captain, were Pirates, we don't do no effin' chartuse! How about a nice lime green?";
             Link.l1 = "Uhh... yea...sorry, that's what I meant, a lime green!";
             Link.l1.go = "set_green_lime";
             Link.l2 = "Never mind then,make it a manly dark green";
             Link.l2.go = "set_green_dark";

        break;
        case "set_green_lime":
               pchar.ship.sailscolor =  argb(255, 153, 255, 153);
              DialogExit_Self();
        break;



        case "sail_color_orange":
             Dialog.Text = "Aye,Aye Captain.You want light, medium or dark orange?";
             Link.l1 = "Dark Number One!";
             Link.l1.go = "set_orange_dark";
             Link.l2 = "Medium Number One!";
             Link.l2.go = "set_orange_med";
             Link.l3 = "Light Number One!";
             Link.l3.go = "set_orange_light";

        break;

        case "set_orange_dark" :
             pchar.ship.sailscolor =  argb(255, 150, 64, 0);
             DialogExit_Self();
        break;
        case "set_orange_med" :
             pchar.ship.sailscolor =  argb(255,  255, 95, 0);
             DialogExit_Self();
        break;
        case "set_orange_light" :
             pchar.ship.sailscolor =  argb(255, 249, 166, 2);
             DialogExit_Self();
        break;



        case "sail_color_purple":
             Dialog.Text = "Aye,Aye Captain.You want light, medium or dark purple?";
             Link.l1 = "Dark Number One!";
             Link.l1.go = "set_purple_dark";
             Link.l2 = "Medium Number One!";
             Link.l2.go = "set_purple_med";
             Link.l3 = "Light Number One!";
             Link.l3.go = "set_purple_light";
             ///fuchsia

        break;

        case "set_purple_dark" :
             pchar.ship.sailscolor =  argb(255, 80, 0, 80);
             DialogExit_Self();
        break;
        case "set_purple_med" :
              pchar.ship.sailscolor =  argb(255, 170, 0, 170);
               // argb(255, 222, 49, 99);  ///bluish purple
             DialogExit_Self();
        break;
        case "set_purple_light" :
             pchar.ship.sailscolor =  argb(255,255, 80, 255); //255, 0, 255
             DialogExit_Self();
        break;


        case "sail_color_yellow":
             Dialog.Text = "Aye,Aye Captain.You want light, medium or dark yellow?";
             Link.l1 = "Dark Number One!";
             Link.l1.go = "set_yellow_dark";
             Link.l2 = "Medium Number One!";  //argb(255, 200, 170, 20);
             Link.l2.go = "set_yellow_med";
             Link.l3 = "Light Number One!";
             Link.l3.go = "set_yellow_light";

        break;


        case "set_yellow_dark" :
             //pchar.ship.sailscolor =  argb(255,95, 85, 50); ///
             pchar.ship.sailscolor =  argb(255, 255, 255, 0);///nice med  green
             DialogExit_Self();
        break;
        case "set_yellow_med" :
             pchar.ship.sailscolor =  argb(255, 255, 255, 50); ///
             DialogExit_Self();
        break;
        case "set_yellow_light" :
              pchar.ship.sailscolor =  argb(255,255, 255, 100);   /// good light yellow
              ///83, 80, 10); 255, 255, 153
             DialogExit_Self();
        break;

      case "sail_color_white":
             Dialog.Text = "Aye,Aye Captain.Would that be bright or dirty white?";  //Whatever my Lady Captain desires";
             Link.l1 = "Bright, if you please,Number One";
             Link.l1.go = "set_white_bright";
             Link.l2 = "Dirty, if you please,Number One";
             Link.l2.go = "set_white_dirty";

        break;

        case "set_white_bright":
              pchar.ship.sailscolor =  argb(255,  255, 255, 255);
              DialogExit_Self();
        break;

        case "set_white_dirty":
              pchar.ship.sailscolor =  argb(200,  220, 220, 220);
              DialogExit_Self();
        break;



///**********************************************************************************************************************
///            End of Sail Color Code
///**********************************************************************************************************************


examples:

Screen Shot 01-07-19 at 10.38 PM 003.JPG Screen Shot 01-07-19 at 10.38 PM 005.JPG Screen Shot 01-07-19 at 10.39 PM 004.JPG Screen Shot 01-07-19 at 10.38 PM 007.JPG Screen Shot 01-07-19 at 10.40 PM 006.JPG Screen Shot 01-07-19 at 10.39 PM.JPG Screen Shot 01-07-19 at 10.40 PM.JPG Screen Shot 01-07-19 at 10.38 PM 002.JPG

P.S.
I left some misc colors commented in the code on purpose.

P.P.S.
The first number is for alpha,If you notice where I set the color to black, I tried to add a little transparency (an experiment, I guess). I don't really notice a big change there, so I might try lowering mine a bit more
Changing it back to 255 will remove the transparency.
I also did that to my dirty white, figuring the sail is worn out and letting light through more.
 

Attachments

  • MainHero_dialog.c
    24.3 KB · Views: 192
Last edited:
Wow, that's cool!

I didn't even know CoAS could change sail colours to anything under the sun using only code.
That's a really nice feature they added. :woot
 
From what i know from modding TEHO, COAS and TEHO handle sail color by applying a filter over the white sail texture.
So if i have a ship with silk sails and i recolor my sails to black for example, the texture used will be the same but with a dark filter to make it look black.
Meaning that you can have a few base sail textures but these textures can be recolored to any color using code, without making new texture files.
 
From what i know from modding TEHO, COAS and TEHO handle sail color by applying a filter over the white sail texture.
So if i have a ship with silk sails and i recolor my sails to black for example, the texture used will be the same but with a dark filter to make it look black.
Meaning that you can have a few base sail textures but these textures can be recolored to any color using code, without making new texture files.
That's pretty brilliant, that is! :onya
 
I'd like to add a way to apply it to ships in your fleet, but it's going to take a while. Maybe someone more experienced will beat me to it.
 
I'd like to add a way to apply it to ships in your fleet, but it's going to take a while. Maybe someone more experienced will beat me to it.
This post I wrote for PotC two weeks ago probably applies to CoAS too:
Instead of 'PChar', use:
Code:
ch = GetCharacter(GetCompanionIndex(PChar, i));
Replace 'i' with the companion number you want.
Maybe that can speed you on your way?
 
thanks Pieter, I found this code in an interface file,looks the same.Might be able to set a unique color for each ship.

Code:
int m = 0;
    for(int i = 0; i < COMPANION_MAX; i++)
    {
        cn = GetCompanionIndex(pchar, i);
        if(cn != -1)
        {
            iShipType = sti(characters[cn].ship.type);
            if(iShipType != SHIP_NOTUSED)
            {
                attributeName = "pic" + (m+1);
                iShipType = sti(RealShips[iShipType].basetype);
                shipName = ShipsTypes[iShipType].Name;

                GameInterface.SHIPS_SCROLL.(attributeName).character = cn;
                GameInterface.SHIPS_SCROLL.(attributeName).str1 = "#"+ xiStr("Class_") +ShipsTypes[iShipType].Class;
                GameInterface.SHIPS_SCROLL.(attributeName).str4 = shipName;
               //.......
                m++;
            }

Now I need to put a fleet together.
 
very nice work..there is a mod if you want it at the ship yard as well i keep it on a thumb drive cuzz it was hard to find in the fourms..wish i could think of who did it so credit could be given..think i will be useing both=)
 

Attachments

  • Mod GOF.rar
    5.1 MB · Views: 191
I got this working as a quickie solution, but I only have 2 ships to test it on right now, so it needs testing with more ships. Remember,if at sea, you need to go from sea to map and back.

right under this code

Code:
///**********************************************************************************************************************
///            Start of Sail Color Code
///            Charles_Vane  (BJI)  1/7/2019
///**********************************************************************************************************************

             link.l11 = "Number One, I want you to go find dye to color our sails with.";
            link.l11.go = "TalkSelf_change_sail_color";


add

Code:
            link.l12 = "Let's make all ships in the fleet have the same color sails.";
            link.l12.go = "change_all_sail_color";


then under the break, add this code:


Code:
        case "change_all_sail_color":
           // NextDiag.TempNode = "First time"; //not sure if needed
            // dialog.Text = "Aye,Aye Capt'n";

        int cn = -1;
        int iShipType = SHIP_NOTUSED;
        //int iShipType =0;
        for(int i = 0; i < COMPANION_MAX; i++)
        {
           cn = GetCompanionIndex(pchar, i);
            if(cn != -1)
            {
                iShipType = sti(characters[cn].ship.type);
                if(iShipType != SHIP_NOTUSED)
                {
                characters[cn].ship.sailscolor  =  pchar.ship.sailscolor;

                }
            }
        }

           DialogExit_Self();
        break;

it should now look like this at the top:

Code:
///**********************************************************************************************************************
///            Start of Sail Color Code
///            Charles_Vane  (BJI)  1/7/2019
///**********************************************************************************************************************
///https://www.rapidtables.com/web/color/purple-color.html    has some codes to play with

             //Dialog.Text = "Let's hoist the new sails"
             link.l11 = "Number One, I want you to go find dye to color our sails with.";
            link.l11.go = "TalkSelf_change_sail_color";

            link.l12 = "Let's make all ships in my fleet have the same color sails.";
            link.l12.go = "change_all_sail_color";



        break;  ///  <<<---- this is from original code

        case "change_all_sail_color":
            //NextDiag.TempNode = "First time";
            // dialog.Text = "Aye,Aye Capt'n";

        int cn = -1;
        int iShipType = SHIP_NOTUSED;
        //int iShipType =0;
        for(int i = 0; i < COMPANION_MAX; i++)
        {
           cn = GetCompanionIndex(pchar, i);
            if(cn != -1)
            {
                iShipType = sti(characters[cn].ship.type);
                if(iShipType != SHIP_NOTUSED)
                {
                characters[cn].ship.sailscolor  =  pchar.ship.sailscolor;

                }
            }
        }

           DialogExit_Self();
        break;
 
dont forget in resource/textures/ships/gerald..are creast you can put on sails if you want to try and add them think there like 6 are so to start with i got like 32 in mine if you get it worked out i can send you my folder with..i would love to use this on the fly changeing sails=)
 
here's an update.

First I want to point out the above post "Different colored sails for each nation" which has a lot of code related to this.
I found the line I needed in battle_interface.c, in the function:
Code:
void SetRandGeraldSail(ref chr, int nation)
so here is a preliminary test for anyone to play with. It only seems to work with larger ships at this time. I tested it with the Barbarossa and Jack Aubrey characters.

to use it,
add these 2 lines like before, just above the "break;"

Code:
            link.l13 = "Let's try an emblem.";
            link.l13.go = "change_sail_emblem";


then after the break

Code:
        case "change_sail_emblem":          


              pchar.Features.GeraldSails = true;   ///probably not needed

              pchar.ShipSails.gerald_name = "Ships\Gerald\eng_2.tga";  ///put your texture here

              DialogExit_Self();

        break;


I changed color to light blue and this is the result:

barbarrosa.jpg gerald_blue.jpg
 

Attachments

  • gerald_blue.jpg
    gerald_blue.jpg
    210.5 KB · Views: 327
  • barbarrosa.jpg
    barbarrosa.jpg
    292.3 KB · Views: 326
Back
Top