• 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!

"Realistic" shiprepairtime in shipyards

CouchcaptainCharles

COO (Chief Oddity Officer)
Storm Modder
Pirate Legend
There have been -justified- complaints that you ALWAYS spend two days in the shipyard if you open the menu, no matter if you order any work or how extensive that is.

Well, i wrote that rather crude "feature" in connection with the survival mod. I never improved it because other people had announced their own plans for the shipyard interface, and I always TRY not to anticipate or blunder into other people's mods. As Duke Suraknar correctly uses to say: "It's a matter of respect." . So if any of these Shipyard projects should surface one day they shall have priority, but in the meantime i propose following fix for the repairtime:

To delete the current `two-day`-waiting:

1. Find all eight SHIPWRIGHT_dialog.c files, e.g. Oweyn McDorey_dialog.c
(search (F3) for the text " within two days" to find them all)

2. Change the text referring to " within two days" like this:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->  case "shipyard":

   Dialog.snd = "voiceOWMCOWMC006";



   //ccc delete this: d.Text = "Allright, my dock beside the fort is availlable for you. If you want I'll tell my dockmaster to tow your ship in there, and then I can guarantee that all work will be completed within two days." + DLG_TEXT[24];    // ccc Survival



   d.Text = "Allright, my dock beside the fort is availlable for you. If you want I'll tell my dockmaster to tow your ship in there. Only then can I survey the damage and tell you how much time and money it'll take." + DLG_TEXT[24];    // ccc 15oct04 shipyard waiting

   Link.l9 = "DOCK BESIDE THE FORT?? Uhh... I just remember that I have... eeh... another pressing business I must attend to first. Goodbye.";    // ccc<!--c2--></div><!--ec2-->


3. Where the shiprepair interface is being started delete the two command refering to waiting:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->      DialogExit();

     // ccc 15oct04 DELETE: shipyard waiting WaitDate("", 0,0,2,0,0);    //ccc Survival

     setCharacterShipLocation(pchar,"Oxbay_port");    //ccc survival

     // ccc 15oct04 DELETE: shipyard waiting Log_SetStringToLog("You get your ship back two days later."); //ccc survival

     LaunchShipyard(Npchar);<!--c2--></div><!--ec2-->

4. Do the same for the cannon interface:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->      DialogExit();

     // ccc 15oct04 shipyard waiting DELETE: WaitDate("", 0,0,2,0,0);    //ccc Survival

     setCharacterShipLocation(pchar,"Oxbay_port");    //ccc survival

     // ccc 15oct04 shipyard waiting DELETE: Log_SetStringToLog("You get your ship back two days later."); //ccc survival

     LaunchCannons();<!--c2--></div><!--ec2-->


No more waiting for that sleazy chips folk <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
But basically the idea that you have to wait some time is appealing to me. It is very unrealistic that you can have your MOW rebuild in seconds, and IMHO it improves the gameplay if you have worry a little about keeping your crew fed while your ship is beached for refitting (that is of course a matter of taste and playstyle). So I would make a waiting time based on the amount of work the shipwright does for you:

1. The amount of repairwork is equivalent to the money you pay, so that is a good basis for a calculation. I just divided the money by 1000, and took the square root of that so that you don't have to wait weeks for the repair of really big ships. That way you need about three days to rebuild an almost totally destroyed Lugger, and 10 days for a wrecked battleship.
(Now that is of course UNrealistic, but hell, one has to balance realism and gameplay somehow. Again, a matter of taste)

2. We can easily apply the repairdelay at the same spot where you pay the repairbill, in Interfaceshipyard.c . Here for sailrepairs :

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void DoSailRepairToPercent(ref chref,int toPerc)

{

    ref mchref = GetMainCharacter();

    ......

    AddMoneyToCharacter(mchref,-sailRepairCost);



    // ccc 15oct04 shipyard waiting

    WaitDate("", 0,0, 1+makeint(sqrt(sailRepairCost/1000)),0,0);

    PlaySound("ambientshipyardaxe.wav");    //just earcandy :)

    PlaySound("ambientshipyardvehicle.wav");

    Log_SetStringToLog("You get your ship back several days later.");

    // ccc end



    // NK -->

    nStoreMoney += sailRepairCost;

    ........<!--c2--></div><!--ec2-->


3. and here for the hull:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void DoHullRepairToPercent(ref chref,int toPerc)

{

    ref mchref = GetMainCharacter();

    ......

    AddMoneyToCharacter(mchref,-hullRepairCost);



    // ccc 15oct04 shipyard waiting

    WaitDate("", 0,0, 1+makeint(sqrt(hullRepairCost/1000)),0,0);    

    PlaySound("ambientshipyardhammer.wav");

    PlaySound("ambientshipyardsaw.wav");

    Log_SetStringToLog("You get your ship back several days later.");

    // ccc end



    // NK -->

    nStoreMoney += hullRepairCost;

    .......<!--c2--></div><!--ec2-->
 
Speaking of repair and realism, another feature that is not quite to my taste is the "Instant repair" ability. IMHO that is no ability but a cheat: press a button in the midst of a battle and by magic your damage disappears within seconds.
On the other hand it is nice to have a feature that allows you let your own crew do repairs. `Age-of`-sail mariners often had to do that, especially pirates with no access to shipyards. But apart from minor maintanance they couldn't do that while sailing (let alone fighting), but only in a sheltered port or bay.

As I am always trying to import such `Age-of`-Sail "logistical problems" into PotC (surely to the annoyance of more "actionminded" people <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> ) I rewrote the "instant repair" perk so that you can use it only if the "Go ashore" option is availlable, i.e. only if you are at a SAFE anchorage. That can easily be done in Battle_interfaceBattleInterface.c :


<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->bool CheckInstantRepairCondition(ref chref)

{

//boal -->

    //if(!GetCharacterPerkUsing(chref,"InstantRepair")) return false;



//ccc repair at anchorage only->

    if(!bCanEnterToLand)

    {

 Log_SetStringToLog("You need a sheltered anchorage for repairs!");

 return false;

    }

//ccc repair end



    bool    retRepair = GetCharacterPerkUsing(chref,"InstantRepair");

    ......<!--c2--></div><!--ec2-->


You see, there are lots of possibilities to make PotC more longwinded <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="icon_wink.gif" />
 
Charles,
Thanks for all the changes you've done for POTC, much appreciated!
I wrote on another thread about limiting the horizontal traversing of the port and starboard cannons- is there a way to keep the target cursor at 90 degrees to the length of the ship (I practice this anyway in the game, but it would be nice as a realistic feature). This wouldn't be implemented on the Gunboat, since it has swivels.
Another idea is the use of "sweeps"- oars to provide some forward movement. I dislike the inability to not move and close on quarry "when the wind dies". Too bad we don't have the option of sending over a ship's boat to board an adversary!

Yours, Mike
 
Your ideas for the repair are great CCC!!!! I like both a lot and It will add some logic as you said.

IT is too late to include it in the b12??? (tell em no, please... )
 
By the way, where should I pu the code you gave in you first ans second post? I see the file but... do I only have to put it at the bottom of code?

Sorry, I'm more an historian than a codder! hehe
 
Ooooh, "ear candy"! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />

This is wonderful, CCC, thank you! I enjoy watching stuff like this unfold - you just cannot resist the urge to "tinker"! Thank you again! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/bow.gif" style="vertical-align:middle" emoid=":bow" border="0" alt="bow.gif" />
 
<!--`QuoteBegin-MadMike`+--><div class='quotetop'>QUOTE(MadMike)</div><div class='quotemain'><!--QuoteEBegin-->Charles,  
 Thanks for all the changes you've done for POTC, much appreciated!
 I wrote on another thread about limiting the horizontal traversing of the port and starboard cannons- is there a way to keep the target cursor at 90 degrees to the length of the ship (I practice this anyway in the game, but it would be nice as a realistic feature). This wouldn't be implemented on the Gunboat, since it has swivels.  
 Another idea is the use of "sweeps"- oars to provide some forward movement. I dislike the inability to not move and close on quarry "when the wind dies". Too bad we don't have the option of sending over a ship's boat to board an adversary!

Yours, Mike[/quote]
Always a pleasure <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

But I'm afraid I can't help you with the cannons and oars <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> I know a bit about those sections of the code that i rummaged through, but most is still unknown territory for me.
If you know a bit C+ you could try to have a look at AIShip.c or AIcannons.c
 
<!--`QuoteBegin-dHerblay`+--><div class='quotetop'>QUOTE(dHerblay)</div><div class='quotemain'><!--QuoteEBegin-->By the way, where should I pu the code you gave in you first ans second post? I see the file but... do I only have to put it at the bottom of code?
[/quote]
A valid question. A bit background: modders (should) mark the changes they made to the code by comments. A comment is anything that stands behind two slashes, like

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// ccc 15oct04 shipyard waiting<!--c2--></div><!--ec2-->
The program ignores those comments, so you can write anything you want behind those //

My changes are marked by a " // ccc ", either BEHIND the line that has been changed or added, or, if a larger section has been added, by a "// ccc MODNAME..." above and a "// ccc MODNAME... end" below the added section.

I always post a few unchanged lines before and after the modsection, so all you have to do is to find those unchanged lines and copy the marked modsection BETWEEN that original lines.

So to make that change #4 (to start with the shortest one), open the file with a texteditor like Notepad, search with F3 for the unchanged line above:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->         DialogExit();<!--c2--></div><!--ec2-->
There may be several of those commands. but we now work with the one before the "WaitDate" and "LaunchCannons" stuff.
Immediately below that goes the text marked as mod
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->         // ccc 15oct04 shipyard waiting DELETE: WaitDate("", 0,0,2,0,0);            //ccc Survival

        setCharacterShipLocation(pchar,"Oxbay_port");   //ccc survival

        // ccc 15oct04 shipyard waiting DELETE: Log_SetStringToLog("You get your ship back two days later."); //ccc survival<!--c2--></div><!--ec2-->

Which overwrites some older code. After that the code should continue with the next unchanged line:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->         LaunchCannons();<!--c2--></div><!--ec2-->

Change #2 looks a bit more confusing because it overwrites an old mod of mine, hence you will find modmarks in the original file. But the principle is the same: just make sure that the section between the unchanged lines looks exactly like in the post.

I recommend leafing through the tutorials in Verruckt's PotC Wiki to get some background knowledge (see sticky thread) It may all look confusing at the beginning, but if you start with simple tweaks you will soon grow into it. (After all, I started at zero level too)

But in any case: BACK UP YOUR OLD FILES !!
 
Thanks for the help but I'm probably too dumb for that... I'll wait until you put it in some build! hehe
 
Back
Top