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

"Fight fire with fiiire..." : Firedrill for your c

CouchcaptainCharles

COO (Chief Oddity Officer)
Storm Modder
Pirate Legend
I like the feature that some bombhits start fires on ships, but IMHO the developers have (again) failed to exploit all the gameplay possibilities that this offers.

In the Age of Sail fire was one of the most feared disasters. On a wooden ship with tarred rigging fire was difficult to contain and often meant the loss of vessel, stores AND lifeboats.

To reflect this a little more in PotC I increased the damage and especially the burntime of the fires, which is fairly easy. One just has to add two factors in Sea_aiAIShip.c, one for the burntime here

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->float Ship_GetTotalFireTime(ref rCharacter)

{

    int iRepairSkill = MakeInt(stf(rCharacter.TmpSkill.Repair) * 10.0);

    return MakeFloat(5 + 3 * (10 - iRepairSkill)) *10;  // ccc added " *10 " for longer firetime

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

and one for the damage here

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

{

    ....

    int iSClass = GetCharacterShipClass(rOurCharacter);

    

    float fHP = (8 - iSClass) * (0.5 + frnd() * 0.5) * 2;    // ccc added " *2 " for more firedamage



    int iTime = 1000 + rand(500);

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

The size of the factors is of course a matter of taste. As above they mean that if you manage to set a ship ablaze it will die slowly, like a mammoth bleeding to death from a caveman's spear(s). That has quite an effect on battletactics: it allows you to destroy superior ships by means of `hit-and`-run bombattacks.

Of course your own ship will suffer the same damage from fire, and it would be very frustrating to watch helplessly as your ship slowly smolders away. So I added the "firedrill" feature that allows the player to extinguish fires on his own ship.

To activate that I "abused" the "Use potion" / "C" key that the legendary AlexusB has made for us (much thanks again <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> ) As it was hitting "c" at sea would also consume a potion, but it would be wasted without effect in shipview mode. So I think it makes sense and doesn't diminish AB's mod if in seaview mode I let the "C" key heal the ship instead of nothing <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

That can be done in seadogs.c . I inserted a section into AB's mod which remains otherwise untouched:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// boal -->

    switch(ControlName)

    {

 case "BOAL_UsePotion":

     ref mch = GetMainCharacter();



     // ccc firedrill

   if( bSeaActive && !bAbordageStarted ) // checks if you are in sailing mode

     {

   mch.firedrill = 1;  // adds attribute to player as "marker" that firedrill is ordered

     }

     else

     // ccc firedrill end, original potionuse mod continues



     {

   aref arItm;

   int itmIdx;

   itmIdx = FindPotionFromChr(mch, &arItm, 0);<!--c2--></div><!--ec2-->


It looks of course much better if we add some effects and make the "shipdefense" perk a requirement:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// boal -->

    switch(ControlName)

    {

 case "BOAL_UsePotion":

     ref mch = GetMainCharacter();



     // ccc firedrill

   if( bSeaActive && !bAbordageStarted ) // checks if you are in sailing mode

     {

   Log_SetStringToLog("All hands execute fire drill ! NOW !!"); // just a screenmessage

   if(CheckOfficersPerk(mch,"BasicBattleState"))    // starts firedrill only if you have shipdefense ability

   {

   mch.firedrill = 1;  // adds attribute to player as "marker" that firedrill is ordered

   PlaySound("clear_for_action");    // just soundeffect

   PlaySound("objectsabordageabordage_loosing.wav");

   }

   else

   {

   Log_SetStringToLog("?? Captain, what's a firedrawl ?");    // just a screenmessage

   Log_SetStringToLog("Your crew seems to lack SHIPDEFENSE ability...");    // just a screenmessage

   PlaySound("voiceEng_m_a_022.wav");    // just soundeffect

   }

     }

     else

     // ccc firedrill end, original potionuse mod continues



     {

   aref arItm;

   int itmIdx;

   itmIdx = FindPotionFromChr(mch, &arItm, 0);<!--c2--></div><!--ec2-->
 
That was the code for ORDERING firedrill. To execute it we must make a few additions to the Ship_FireDamage() function in AIShip.c :

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

{

    int iOurCharacterIndex = GetEventData();

    .......

 fTotalFireTime = fTotalFireTime - MakeFloat(iTime) / 1000.0;

    }



    // ccc firedrill

       if(CheckAttribute(rOurCharacter,"firedrill"))  //checks marker if "C" key has been hit

    {

     fTotalFireTime = 0.0;    // for code below

     DeleteParticles();    // stops firegraphics, albeit ALL :(  

     InitParticles();    // reinits firegraphics

  PostEvent(SHIP_FIRE_DAMAGE, iTime, "lllf", iOurCharacterIndex, iBallCharacterIndex, iFirePlaceIndex, 0.0);

 // Stopps application of firedamagecode for THIS particular fireplace

         }

    // ccc firedrill end



    if (fTotalFireTime > 0.0)

    {

 PostEvent(SHIP_FIRE_DAMAGE, iTime, "lllf", iOurCharacterIndex, iBallCharacterIndex, iFirePlaceIndex, fTotalFireTime);

    }

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

That stops the fires allright. But in order to make it look like a fullfledged gameplay feature it needs to be expanded a little. First, it should come at a cost and a risk, otherwise it would be boring or cheatlike. The player should be forced to take a decision with strings attached: if he wants to stop his ship from smoldering away he must withdraw the whole crew from their battlestations, dump the guncharges and cut the sails away to contain the fire. That leaves him at a momentary disadvantage in a battle, so he'd better choose the right tactical moment to order the firedrill.

And in order to visualize the firefighting a couple of graphics and soundeffects create a cacophony of waterspouts, smoke, yells and orders. That gives the impression of going through real desperate emergency drills, so it's small wonder that a few hands may get burnt in the effort (no risk, no gameplayfun <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> )

So the full mo(d)nty looks like this:

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

{

    int iOurCharacterIndex = GetEventData();

    ........

 fTotalFireTime = fTotalFireTime - MakeFloat(iTime) / 1000.0;

    }



// ccc firedrill

     //get ship coords for graphic effects

     float fX, fY, fZ;

     fX = 0; fY = 0; fZ = 0;

     fX=stf(rOurCharacter.Ship.pos.x);

     fY=stf(rOurCharacter.Ship.pos.y);

     fZ=stf(rOurCharacter.Ship.pos.z);

     

       if(CheckAttribute(rOurCharacter,"firedrill"))  //checks marker if "C" key has been hit

     {

       DeleteAttribute(rOurCharacter,"firedrill"); // so that only ONE fireplace is doused

       Ship_SetSailState(iOurCharacterIndex, 0.0); // smoldering sails jettisoned

       Ship_ChangeCharge(rOurCharacter, sti(rOurCharacter.Ship.Cannons.Charge.Type));    // cartridges jettisoned

       int casualties = makeint(sti(rOurCharacter.Ship.Crew.Quantity)* rand(5)/100 );    // a few firefighters may die

       rOurCharacter.Ship.Crew.Quantity = sti(rOurCharacter.Ship.Crew.Quantity)- casualties;    //well, nothing in a game should be for free

     

     fTotalFireTime = 0.0;    // for code below

     DeleteParticles();    // stops firegraphics, albeit ALL :(  

     InitParticles();    // reinits firegraphics

  PostEvent(SHIP_FIRE_DAMAGE, iTime, "lllf", iOurCharacterIndex, iBallCharacterIndex, iFirePlaceIndex, 0.0);

 // Stopps application of firedamagecode for THIS particular fireplace



 // Soundeffects, nice graphics for firefighting and messages

     PlaySound("objectsshipchargeship_bow.wav");

     PlaySound("ambientshipyardaxe.wav");

   

 CreateParticleSystemX("ball_splash",`fx-2`, fy+5, fz, 3.0, 7.0, 0.0, 0);

 CreateParticleSystemX("ball_splash",fx+2, fy+6, fz, 0.0, 7.0, 3.0, 0);

 CreateParticleSystemX("ball_splash",fx, fy+7, fz+2, -2.0, 8.0, 0.0, 0);

 CreateParticleSystemX("ball_splash",fx, fy+5, `fz-2`, 0.0, 9.0, -3.0, 0);

 CreateParticleSystemX("gunfire",`fx-3`, fy+3, `fz-1`, 6.0, 4.0, 0.0, 0);

 CreateParticleSystemX("gunfire",fx+3, fy+4, fz+1, 0.0, 4.0, 7.0, 0);

 CreateParticleSystemX("gunfire",`fx-1`, fy+5, fz+3, -6.0, 5.0, 0.0, 0);

 CreateParticleSystemX("gunfire",fx+1, fy+3, `fz-3`, 0.0, 5.0, -7.0, 0);



           Log_SetStringToLog("Sails and cartridges jettisoned.");

  Log_SetStringToLog("ONE fire doused! "+ sti(casualties) +" men burnt..");

 

         }

// ccc firedrill end



    if (fTotalFireTime > 0.0)

    {

 PostEvent(SHIP_FIRE_DAMAGE, iTime, "lllf", iOurCharacterIndex, iBallCharacterIndex, iFirePlaceIndex, fTotalFireTime);



   if(sti(rOurCharacter.Index) == GetMainCharacterIndex()) {Log_SetStringToLog("This fire still burning! C!");}    //ccc firedrill

   CreateParticleSystem("blast_inv", fx, fy, fz, 0.0, 0.0, 0.0, 0);  // ccc some smoke if fireparticle was deleted above

    }

}<!--c2--></div><!--ec2-->
 
One thing remains to be done. As I said, hitting "C" attaches the markerattribute "firedrill" to the playercharacter. As long as this is there every fire is being doused. So we must delete that attribute somewhere so that you must go through the firedrill anew for every fire. The place to do that is where the bombhit starts the fire, in the Ship_ActivateFirePlace() function:

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

{

    aref    arShipObject = GetEventData();

    .....

    SendMessage(arShipObject, "llsslf", MSG_SHIP_ACTIVATE_FIRE_PLACE, iFirePlaceIndex, "ship_smoke", "ship_fire", iSoundID, fFireTime);



    // ccc firedrill

    if(sti(arCharacter.Index) == GetMainCharacterIndex())     // so this runs only for the player

   {

    Log_SetStringToLog("Fire! Press C to order firedrill to all hands!");  // infomessage

   DeleteAttribute(arCharacter,"firedrill");      // deletes the markerattribute that starts firedrill

   PlaySound("objectsshipcharge_Abandon3.wav"); // soundeffect

    }

    // ccc firedrill end

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

There is one thing in this mod that I am not really happy with. I "extinguish" the graphic effects for the fire in a rather crude way:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->      DeleteParticles();    // stops firegraphics, albeit ALL :(  

     InitParticles();    // reinits firegraphics<!--c2--></div><!--ec2-->

That stops and reinitializes ALL particles (i.e. fire, explosions, smoke, waterspouts) on ALL ships. Doesn't affect the gameplay, but it irks me that i haven't found a more elegant solution.
The problem is that this line

SendMessage(arShipObject, "llsslf", MSG_SHIP_ACTIVATE_FIRE_PLACE, iFirePlaceIndex, "ship_smoke", "ship_fire", iSoundID, fFireTime);

starts a fire which burns on and on for a given time, "iFireTime", and it keeps burning even if the code for Ship_FireDamage() has been stopped. I tried to cancel that out by sending the same message with "iFireTime" = 0 , but the error log keeps telling me that it "can't get EventData for arShipObject" anymore.
Does anyone know a solution for that, or can anyone explain in general how all those PostEvent, GetEventData and SendMessage commands work together?
 
CCC have not tried it but i sounds really good.
Hope it will be included in build 12.
 
Perhaps this firedrill can have an effect on your ships fire rate and response to changing sails as well?
So if you are pressing "C" to put the fire out you can't reload as quickly and when you change your sails they are delayed even more.

IIRC some one worked out some code that makes reload time longer if you change your sails, but I can't remember who did it <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/bow.gif" style="vertical-align:middle" emoid=":bow" border="0" alt="bow.gif" /> BRILLIANT! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" /> Have an ale! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/beer2.gif" style="vertical-align:middle" emoid=":beer" border="0" alt="beer2.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />

Mad Jack is ALMOST finished with the Build 12 installer... I wonder if we can sneak this one in...
 
Awsome CCC,Definetly great idear fer this Mod.hope ye can get it werk'n tew yer satisfaction,would add more realism tew de game fer sure mate . Is it possible tew maybe use de fireship ability icon fer yer mod since de original code an use is Pfffft.<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
<!--`QuoteBegin-CatalinaThePirate`+--><div class='quotetop'>QUOTE(CatalinaThePirate)</div><div class='quotemain'><!--QuoteEBegin-->
Mad Jack is ALMOST finished with the Build 12 installer...  I wonder if we can sneak this one in...[/quote]

No worries! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sailr.gif" style="vertical-align:middle" emoid=":sail" border="0" alt="sailr.gif" /> It all depends on the hard freeze date of adding code, final testing and problem resolutions, and the scheduled release date if the final product. I'll be able to make updates as needed now that the base is established. I'd <b>kill</b> to see the firedrill mod included! I've never stuck with a game as long as I have this. Incredible work, and brilliant creativity, these modders! Drinks all around!! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/buds.gif" style="vertical-align:middle" emoid=":drunk" border="0" alt="buds.gif" />
 
Aye Mad Jack,fer sure de game be more fun, Realy luv de new look O' de start up screen,nice graphic werk,looks tew be Catalina touch <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Well, we made a freeze date, Mad Jack... It's a question of whether we want to "break" that freeze date and squeeze this one in...

And yes, that is my startup screen graphic, Skull, thanks! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/oops3.gif" style="vertical-align:middle" emoid=":eek:ops2" border="0" alt="oops3.gif" /> Kieron `re-designed` the page, and asked me to fiddle something up for the graphic... I built it off of my PA desktop wallpaper image of the Oxbay invasion.
 
It be jest a little squeeze, please,it'd be great tew get it in de game <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" /> We'll never get this thing finished! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />

I don't mind... And for a "hot topic", this is really very cool, CCC... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
<!--`QuoteBegin-CatalinaThePirate`+--><div class='quotetop'>QUOTE(CatalinaThePirate)</div><div class='quotemain'><!--QuoteEBegin--><img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" /> We'll never get this thing finished!   <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />  

[/quote]
You may be right there, especially as more of such silly stuff is to come <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_eek.gif" style="vertical-align:middle" emoid=":shock:" border="0" alt="icon_eek.gif" /> <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" />
I am in no position as to tell you what to do regarding Build12. But I think it may be better to finish what you already have, test it thoroughly and release it. Otherwise you may get lost in neverending updates. A little later you will probably want to publish a patch or bugfixed version 12.1 anyway, so anything that surfaces till then can go into that (or Build13 <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> )
Better to make a smaller but smother Build12 release. After that an update or Build13 would be easier, just a repetition of already tested procedures.

Whatever you do, feel free to use my tweaks in any way and at any time you want. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_praise.gif" style="vertical-align:middle" emoid=":bow" border="0" alt="icon_praise.gif" />
 
I think that CCC is right, call time on new submissions to the Build now and the only new code added should be to fix any showstopping bugs.

then after release work on any other minor bugfixes and also allow submissions of any new content and at a later stage release a Build 12.1
 
Yes, you're right Sirus... We made a pact to STOP adding new stuff. Besides, there is an easy way to add things later, according to how we've utilized the CVS server...

Besides, I think some of the stuff CCC is posting needs to be tested and tweaked, so... We can wait.
 
Back
Top