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

Rescue shipwreck survivors from the waves

CouchcaptainCharles

COO (Chief Oddity Officer)
Storm Modder
Pirate Legend
Another simple mod that adds variation and spice to the naval battles:

After a ship has been sunk a few surviving sailors will drift among the wreckage and salvage. You can rescue them and will be rewarded with a reputation increase. And apart from the humanitarian aspect rescuing survivors may save your ass in battle: the survivors will of course be pressed into your crew to replace your casualties
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/urgh.gif" style="vertical-align:middle" emoid=":urgh" border="0" alt="urgh.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/whippa.gif" style="vertical-align:middle" emoid=":whipa" border="0" alt="whippa.gif" />

What I am most proud of (if I may pat my own shoulder a little <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" /> ) is that I managed that with only a dozen lines of code which I squeezed into a single file, Sea_aiAISeaGoods.c (I like small and simple things <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" /> )

Here's how:
Two sections of code (those between the "// ccc rescue.." comments) must be added. The first is in the AISeaGoods_ShipDead() function which runs if a ship sinks and puts the floating goods that you can salvage into the water.
The modsection floats up to four additional "goods" (used "oil" which like ammo is never used for salvage by the program, has no swim time). Only that these floating "Oil" goods get the model of a sailor ("LoMan", not the little brother of He Man but one of the `low-resolution`-`crew-on`-deck models).
To my amazement he doesn't look awkward in the water, like performing deckduty half submerged, but he actually looks like swimming for his life. (Only that he doesn't move his arms <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/mellow.gif" style="vertical-align:middle" emoid=":|" border="0" alt="mellow.gif" /> Maybe Akella planned something like this but dumped it, like so many other features.. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> ) Sorry, I digress, back to the code:

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

{

    ref rCharacter = GetCharacter(GetEventData());

    ......

 AISeaGoods_AddGood(rCharacter, GetAttributeName(aGood), sModel, fTime * 60.0, iSwimQuantity);

    }



    // ccc rescue survivors

    AISeaGoods.ModelsPath = "LowCharacters";    //path to the crewmodels

    for (i=1; i<5;  i++)    //runs loop four times

    {

 //survivor calculation for tutorial:  iSwimQuantity  = rand(20)  would work, but...

  iSwimQuantity = MakeInt(1 + rand(sqrt(GetMaxCrewQuantity(rCharacter))));    //... this adds more survivors for bigger ships

 AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Man", 1000.0,  iSwimQuantity);    //floats a "fake" salvagegood with a sailormodel

    }

    AISeaGoods.ModelsPath = "SwimGoods";    //reset path to the salvagemodels

    // ccc rescue survivors end

}

.....<!--c2--></div><!--ec2-->
 
The second section is in the function with the beautiful name AISeaGoods_ShipEatGood() . As the name, albeit a bit crudely, suggests this function runs if a ship sails over floating salvage. It checks if the ship still has cargospace, and if it has the floating goods are added to the cargo.
The modsection runs before this process. It checks if the playership sails over one of the new "oil"/survivor goods. If it does, it aborts the "salvage cargo" routine and gives you some crew and reputation instead:

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

{

    ......

    string sGoodName = LanguageConvertString(iSeaSectionLang, "seg_" + sGood);



    // ccc rescue survivors

    if (sGood=="Oil" && iCharacterIndex == GetMainCharacterIndex() )    //runs only for "fake" salvage and the player

    {

 AddCharacterCrew(rCharacter,iQuantity);    //adds crew

 Log_SetStringToLog(iQuantity + " survivors rescued");    //screenmessage

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

 ChangeCharacterReputation(rCharacter, 1);    //rescuer deserves praise :)

 return false;    //aborts the function so that no "oil" goods are added

    }

    // ccc rescue survivors end



    if (iMaxGoodAllow == 0)

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

If another ship runs over the survivors they are being swallowed up, so you must hurry if you want to press... eh.. rescue them.


That's all <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Though I made another little change to AISeaGoods_AddGood, which actually positions the salvagemodels on the waves. That change spreads the salvage over a larger area. That prevents the goods and survivors from being swallowed by the sinking ship and makes collecting them more challenging.

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void AISeaGoods_AddGood(ref rCharacter, string sGood, string sModel, float fTime, int iQuantity)

{

    .......

    // calculate random position

 float fAng = stf(rCharacter.Ship.Ang.y);

 float x = (frnd() - 0.5) * 50.0;  // ccc rescue original 20.0; spreads salvage wider

 float z = (frnd() - 0.5) * 90.0;  // ccc rescue  original 40.0

 RotateAroundY(&x, &z, cos(fAng), sin(fAng));

    ......<!--c2--></div><!--ec2-->
 
Nice!
(x10, since it's about the tenth neat thing you've posted in a week... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> )

Why the "oil" though? Why not "crew"?
 
That's GREAT, 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" /> have added it to the CVS for Build 12, thank you! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/bow.gif" style="vertical-align:middle" emoid=":bow" border="0" alt="bow.gif" />
 
Yar! CCC,ye come up wid some really kool ideas mate,I luv dis new mod <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#>/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" />
 
this is some good stuff, but somehow when i put the code in, i made some mistake and when i sink a ship from boarding her she will dump trremendous amounts of cargo, especially wheat and it seems she also drops hundreds of crew into the sea, so i must of done something wrong -any help?
 
Boocha, this is already in the Build 11.99e, I think... (If you're using that version) <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid=":keith" border="0" alt="keith.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" /> Boocha, where ya been keeping yerself, matey? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" />

Build 12 is almost ready to release, and the rescue code is in it - all set and stable so you won't have to worry about it... It is, as Drunken says, in the beta download of 11.99e, so you can get that until Build 12 "goes gold"... <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-boocha`+--><div class='quotetop'>QUOTE(boocha)</div><div class='quotemain'><!--QuoteEBegin-->this is some good stuff, but somehow when i put the code in, i made some mistake and when i sink a ship from boarding her she will dump trremendous amounts of cargo, especially wheat and it seems she also drops hundreds of crew into the sea, so i must of done something wrong -any help?[/quote]

Hundreds? OMG! <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" />

The Rescue mod should "only" set up to four bodies into the water. With each salvaged body you rescue up to 15 sailors.

The limit of four is in the header of this loop<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->   // ccc rescue survivors

  AISeaGoods.ModelsPath = "LowCharacters";   //path to the crewmodels

  for (i=1; i<5;  i++)            //runs loop four times

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



There is another spectacular mod involving debris and bodies, as Catilina has revealed in the Build11.99e thread:

<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->The "flying people" addition is by Maximus over at Ellabye Island, brought to our attention by Skull, and clarified by NK -  

quote:  
--------------------------------------------------------------------------------
Originally posted by NathanKell:  
open particles.ini  
find block [geo]  
replace all below it until next block starts with:  


code:  
--------------------------------------------------------------------------------
[geo]  
   randomnum = 2  
   file = particlespalka01  
   file = particlespalka02  
   file = particlespalka03  
   file = particlespalka04  
   file = particlespalka05  
   file = LowCharactersLo_man  
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

This is already set in Build 11.99 - but you might change the randomnum (higher) to get a larger number of flying items (including people).<!--QuoteEnd--></div><!--QuoteEEnd-->

But those flying sailors (Dutchmen ? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" /> ) are beyond rescue after being blasted about <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/william.gif" style="vertical-align:middle" emoid=":will" border="0" alt="william.gif" />
 
This is a great addition to the game, thanks, CCC!<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->But those flying sailors (Dutchmen ?  ) are beyond rescue after being blasted about  <!--QuoteEnd--></div><!--QuoteEEnd-->Well, after all, we want CREW, not meat! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/ohmy.gif" style="vertical-align:middle" emoid=":eek:" border="0" alt="ohmy.gif" />
 
De sharks need tew fill der belly's as well <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.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" />
 
great thanks to hear it all, again great werk thar captain and miss catalina, well i been sick 'n werk has me pretty busy from time to time -like im never knowing how long i got till the next project starts so i havent been keepin up really 'n my beer tolerance has really dropped one day we can get this game online, 'n i'll sit n have a mug with you all over at Ines' place
 
Keep up the good work mates...

<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" />
 
Good work, CCC !
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" />
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid=":keith" border="0" alt="keith.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" /> Inez, nice to see you back in these fair waters! <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#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" />
 
I'm loving this mod in v12, but...

Is there an easy way for me to make each floating body equal to one survivor? I love fishing the sailors out of the drink, but it seems weird to pick up a single swimmer and have it register as six or seven survivors; it would be nice to have each floater show up as a solitary survivor. Just a personal preference, but I'd appreciate being able to alter it in the code.

Thanks!
 
Change this line
iSwimQuantity = MakeInt(1 + rand(sqrt(GetMaxCrewQuantity(rCharacter))));
to
iSwimQuantity = 1;

That should do it, I think.
 
Absolutely correct, Nathan <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" />

Trustworthy, you are absolutely right that it looks more sensible if every swimmer "yields" only one survivor. I have considered that too first, but that way you would get so few survivors that it would not really help you compensate your crewlosses in battle.

So I chose the solution that has more effect on the gameplay instead of the one that looks better.

Anyway, it's great that you are willing to make your own version. After all, that's what I always hope for if i post all those boring codesections here <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" />
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" /> CCC any way to make it so if there are 20 crewmen on board when the ship sinks then a percent of them are survivors like maybe 15 survive and you get 15 little floaters in the waters? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid=":keith" border="0" alt="keith.gif" />
 
Back
Top