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

splash splash splash

Is this more than it usually was? In theory the numbers should be the same. Note that the amount of survivors depends on the MAXIMUM crew number, not on the CURRENT crew number. Bit weird actually. Also there is a rand() function in there, so the amount of survivors of the same ship sinking can be different each time you test. Still, on average a big ship should produce more survivors than a small one.
 
<!--quoteo(post=219389:date=Oct 29 2007, 05:00 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE(Pieter Boelen @ Oct 29 2007, 05:00 AM) [snapback]219389[/snapback]</div><div class='quotemain'><!--quotec-->Is this more than it usually was?<!--QuoteEnd--></div><!--QuoteEEnd-->

Yes. I don't remember seeing more than 3 or 4 from such small ships.

I'm getting 10, 12, 13. It's just too easy.
 
That suggests to me that the division by four is not taking effect at all. Try this:<!--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
         {
            //survivor calculation for tutorial:  iSwimQuantity  = rand(20)  would work, but...
            iSwimQuantity = MakeInt(1 + rand(sqrt(GetMaxCrewQuantity(rCharacter))));   //... this adds more survivors for bigger ships
            //floats a "fake" salvagegood with a sailormodel
            AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Man", 1000.0, MakeInt(sti(iSwimQuantity)/4));
            AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma2", 1000.0, MakeInt(sti(iSwimQuantity)/4));
            AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma3", 1000.0, MakeInt(sti(iSwimQuantity)/4));
            AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma4", 1000.0, MakeInt(sti(iSwimQuantity)/4));
         }
         AISeaGoods.ModelsPath = "SwimGoods";   //reset path to the salvagemodels
         // ccc rescue survivors end<!--c2--></div><!--ec2-->The change is the addition of sti() around the iSwimQuantity in the division code. The sti function converts strings to integers and will hopefully enable the division to work the way it should.
 
Why am I stupid? This whole thing can be done SO much easier! <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" /><!--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
         {
            //survivor calculation for tutorial:  iSwimQuantity  = rand(20)  would work, but...
            iSwimQuantity = MakeInt(1 + 0.25 * rand(sqrt(GetMaxCrewQuantity(rCharacter))));   //... this adds more survivors for bigger ships
            //floats a "fake" salvagegood with a sailormodel
            AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Man", 1000.0, iSwimQuantity);
            AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma2", 1000.0, iSwimQuantity);
            AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma3", 1000.0, iSwimQuantity);
            AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma4", 1000.0, iSwimQuantity);
         }
         AISeaGoods.ModelsPath = "SwimGoods";   //reset path to the salvagemodels
         // ccc rescue survivors end<!--c2--></div><!--ec2-->The AISeaGoods_AddGood() lines have been reset to what they originally were. The iSwimQuantity line has a * 0.25 multiplier added to make the value four times smaller. This is countered again by the four generate crewmember lines.

The unfortunate thing with this code is that the number of survivors generated is always a factor 4, so it's either 4, 8, 12, 16, etc. survivors. It should be possible to add values inbetween, but this will only make the code more complicated and therefore would create a bigger chance for trouble. Perhaps it is best left as this. That being said, I do think we should use the ACTUAL crew number rather than the MAXIMUM crew number. It really bothers me when survivors are generated for a ship that had 0 crew left at the time of the sinking. <img src="style_emoticons/<#EMO_DIR#>/wacko.gif" style="vertical-align:middle" emoid=":wacko:" border="0" alt="wacko.gif" />
 
Alas, it doesn't seem to work. <img src="style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />

I got 10 (perhaps more as I flew past them picking up some) swimmers off a War Tartane!
 
Not even the * 0.25 multiplier worked? That's pretty weird. I had really expected that to work. <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" />
Perhaps you can send a PM to CouchcaptainCharles then. It was his code originally. I can try to think up more options, but I'm a bit lost right now. <img src="style_emoticons/<#EMO_DIR#>/wacko.gif" style="vertical-align:middle" emoid=":wacko:" border="0" alt="wacko.gif" />
 
Yeah, will do. <img src="style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />
 
there is a minimum of 16 sailors on that loop and we cant get it to go below that for 1 reason. We have a minumum of 4 sailors within the loop and the loop always runs 4 times (due to for (i=1; i<5; i++))

Try changing the i< number to see it you get different results. We've doubled the number of sailors inside the loop so I'm tempted to go with i<3 which should run it twice.
 
But we decrease the number of sailors by a quarter, then add four lines for them. Shouldn't the amount remain the same?
I am thinking perhaps we should rewrite the code to make the AMOUNT of loops be dependent on the amount of sailors aboard the ship when sinking. This rather than having four loops, each adding a random amount of sailors. <img src="style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />
 
<!--quoteo(post=219528:date=Oct 30 2007, 01:10 PM:name=fudge dragon)--><div class='quotetop'>QUOTE(fudge dragon @ Oct 30 2007, 01:10 PM) [snapback]219528[/snapback]</div><div class='quotemain'><!--quotec-->Try changing the i< number to see it you get different results. We've doubled the number of sailors inside the loop so I'm tempted to go with i<3 which should run it twice.<!--QuoteEnd--></div><!--QuoteEEnd-->
<img src="style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" /> fudge dragon
I tried that number and got 5 and 13 on two boarding/sinking actions.

So I went one lower, to i<2 so it should run only once, right.

Boarded/ sunk 5 ships and got:
3 from a Brig,
4 from a Lugger,
1 from a Fleut,
2 from a Galleon,
4 from a Packet Brig,
...all less than 4 and all models different, of course.


Pieter, the only thing that troubles me this way is that only 1 to 4 from a Galleon seems cheep, but then again, I really don't remember how many you could expect from a Galleon before.

Haven't heard from CCC yet.

Oh, one other thing, perhaps the flyers should be limited to one model ... and a toggle put on that part of the mod, as it is too ridiculous <img src="style_emoticons/<#EMO_DIR#>/24.gif" style="vertical-align:middle" emoid=":rofl" border="0" alt="24.gif" />
 
a limit to one model wouldn't look right either. would it be possible to only make them part of critical hit debris?
 
How about something like this?<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->        // ccc rescue survivors
         AISeaGoods.ModelsPath = "LowCharacters";   //path to the crewmodels
         //survivor calculation for tutorial:  iSwimQuantity  = rand(20)  would work, but...
         iSwimQuantity = MakeInt(1 + rand(sqrt(GetMaxCrewQuantity(rCharacter))));   //... this adds more survivors for bigger ships
         for (i=1; i<iSwimQuantity;  i++)            //runs loop for each sailor
         {
            //floats a "fake" salvagegood with a sailormodel
            switch(rand(3))
            {
                case 0: AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Man", 1000.0, 1); break;
                case 1: AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma2", 1000.0, 1); break;
                case 2: AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma3", 1000.0, 1); break;
                case 3: AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma4", 1000.0, 1); break;
            }
         }
         AISeaGoods.ModelsPath = "SwimGoods";   //reset path to the salvagemodels
         // ccc rescue survivors end<!--c2--></div><!--ec2-->The iSwimQuantity defines the number of loops and in each loop one sailor model is added. The sailor model is a random one chosen from four options. I wrote this code at school and don't even have the game here, so this is 100% untested.

I suppose a toggle should be added on the flying crewmembers mod. I think a couple of them on critical hits would be good. <img src="style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" />
 
so that would be a toggle for 1: no flyers, 2: only during critical hits, and 3: asterix and obelix style?
 
LOL. It would be the coolest if there would only be flying crewmembers when the crew number would actually be decreased. It is so odd to see more crewmembers flying around than there were aboard the ship in the first place. The same goes for more swimming sailors than there were aboard the ship. That is why I would also suggest replacing <i>GetMaxCrewQuantity(rCharacter)</i> with <i>GetCrewQuantity(rCharacter)</i>. That should make the numbers a lot more accurate. So a ship with hardly any crew left will not generate as many survivors as the same ship sinking with still the full crew compliment aboard.
 
<!--quoteo(post=219605:date=Oct 31 2007, 05:03 AM:name=morgan terror)--><div class='quotetop'>QUOTE(morgan terror @ Oct 31 2007, 05:03 AM) [snapback]219605[/snapback]</div><div class='quotemain'><!--quotec-->a limit to one model wouldn't look right either.<!--QuoteEnd--></div><!--QuoteEEnd-->

Most of the time you only see them as silhouettes and from a distance, so one model might be OK.

<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->would it be possible to only make them part of critical hit debris?<!--QuoteEnd--></div><!--QuoteEEnd-->
That would be best! <img src="style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />
That would also be work for a coder. <img src="style_emoticons/<#EMO_DIR#>/type_1.gif" style="vertical-align:middle" emoid=":nk" border="0" alt="type_1.gif" />
 
<!--quoteo(post=219661:date=Oct 31 2007, 02:48 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE(Pieter Boelen @ Oct 31 2007, 02:48 PM) [snapback]219661[/snapback]</div><div class='quotemain'><!--quotec-->LOL. It would be the coolest if there would only be flying crewmembers when the crew number would actually be decreased. It is so odd to see more crewmembers flying around than there were aboard the ship in the first place.<!--QuoteEnd--></div><!--QuoteEEnd-->
But that is the fun of it <img src="style_emoticons/<#EMO_DIR#>/24.gif" style="vertical-align:middle" emoid=":rofl" border="0" alt="24.gif" /> <!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->The same goes for more swimming sailors than there were aboard the ship. That is why I would also suggest replacing <i>GetMaxCrewQuantity(rCharacter)</i> with <i>GetCrewQuantity(rCharacter)</i>. That should make the numbers a lot more accurate. So a ship with hardly any crew left will not generate as many survivors as the same ship sinking with still the full crew compliment aboard.<!--QuoteEnd--></div><!--QuoteEEnd-->
On thing I forgot, and we are not taking into account, is that each swimmer picked up, represents a different amount of survivors. It is not a one to one relation.
So you can see only one to four swimmers and pick up any number of survivors from four to who knows, 20, 35, whatever code allows. <img src="style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />

You say with the code you recently posted:<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->The sailor model is a random one chosen from four options<!--QuoteEnd--></div><!--QuoteEEnd-->
This would likely repeat models, and skip others, for each sinking.
I like the idea of having 1 to 4 swimmers, each one being a different model, as I'm seeing now.
 
Something I was also thinking about is that you shouldn't be able to pick up sailors if you already have a full crew compliment. Also the reputation increase might be a bit excessive. Perhaps a rand() is called for here?

<!--quoteo(post=219669:date=Oct 31 2007, 09:52 PM:name=Petros)--><div class='quotetop'>QUOTE(Petros @ Oct 31 2007, 09:52 PM) [snapback]219669[/snapback]</div><div class='quotemain'><!--quotec-->This would likely repeat models, and skip others, for each sinking.<!--QuoteEnd--></div><!--QuoteEEnd-->That would indeed happen, yes. I thought that would be the most realistic option, especially since there might be more sailors than four in the water and it would be somewhat odd to have the sailors come in batches of four. But perhaps it is better to handle it differently. According to you, what would be the perfect way for this to work?
 
<!--quoteo(post=219679:date=Oct 31 2007, 04:51 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE(Pieter Boelen @ Oct 31 2007, 04:51 PM) [snapback]219679[/snapback]</div><div class='quotemain'><!--quotec-->Something I was also thinking about is that you shouldn't be able to pick up sailors if you already have a full crew compliment. Also the reputation increase might be a bit excessive. Perhaps a rand() is called for here?<!--QuoteEnd--></div><!--QuoteEEnd-->
I don't think it's excessive.
Actually, you only get one point for each pick-up.
That is the same as giving gold to a beggar, or refusing to pick someone's pocket.

Also, try picking one up using a poor close-hauled, craft like a caravel or galleon when the survivors are upwind.
Talk about unrealistic. In real life, you could throw a line or send out a boat, use oars, anything!

<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><!--quoteo(post=219669:date=Oct 31 2007, 09:52 PM:name=Petros)--><div class='quotetop'>QUOTE(Petros @ Oct 31 2007, 09:52 PM) [snapback]219669[/snapback]</div><div class='quotemain'><!--quotec-->This would likely repeat models, and skip others, for each sinking.<!--QuoteEnd--></div><!--QuoteEEnd-->That would indeed happen, yes. I thought that would be the most realistic option, especially since there might be more sailors than four in the water and it would be somewhat odd to have the sailors come in batches of four. But perhaps it is better to handle it differently. According to you, what would be the perfect way for this to work?
<!--QuoteEnd--></div><!--QuoteEEnd-->
The code I'm using now produces from one to five swimmers.<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->           // ccc rescue survivors
               AISeaGoods.ModelsPath = "LowCharacters";   //path to the crewmodels
               for (i=1; i<2;  i++)            //runs loop two 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_AddGood(rCharacter, "Oil", "Lo_Ma2", 1000.0,  iSwimQuantity);    //    Petros added 4 more swimmer models
            AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma3", 1000.0,  iSwimQuantity);    //    Ditto
                 AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma4", 1000.0,  iSwimQuantity);    //    Ditto
            AISeaGoods_AddGood(rCharacter, "Oil", "Lo_Ma5", 1000.0,  iSwimQuantity);    //    Ditto
          }
               AISeaGoods.ModelsPath = "SwimGoods";   //reset path to the salvagemodels
               // ccc rescue survivors end<!--c2--></div><!--ec2-->
It runs the process only once but produces a normal number of other floating cargo.

However, I'm not sure if the amount of cargo represented by each model, is as it was when the loop ran 4 times.
I notice that the swimmers, each represent very few survivors.
Still waiting to hear from CCC on any other ideas.

I'm planning to do a re-skin to add a fifth swimmer, so that the range can be from one to five.
 
Are you happy with this code as-is then? The code for picking up survivors is in PROGRAM\CCCdirectsail.c (provided you use the DirectSail mod, which you should!):<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->        // Default: original rescue survivors code from AISeaGoods.c
        if (sti(rCharacter.index) == GetMainCharacterIndex() )   //runs only for the player
        {
            AddCharacterCrew(rCharacter,iQuantity);   //adds crew
            Log_SetStringToLog(iQuantity + " " + LanguageConvertString(tmpLangFileID,"survivors rescued"));   //screenmessage
            PlaySound("objects\abordage\abordage_loosing.wav");   //soundeffect
            ChangeCharacterReputation(rCharacter, 1);   //rescuer deserves praise :)
        }
        // ccc rescue survivors end<!--c2--></div><!--ec2-->
Not sure where the "iQuantity" value comes from though. <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
iQuantity comes from the AISeaGoods_ShipEatGood() function in PROGRAM\SEA_AI\AISeaGoods.c. It is taken by iQuantity = GetEventData() so it gets it's information from elsewhere, but I don't know where from. However, we can add an additional line to change the number of iQuantity in the case of the survivors. How do you think a good value could be calculated?
 
Back
Top