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

Abandoned Reinit Functionality Updates Ship Stats

Hylie Pistof

Curmudgeon
QA Tester
Storm Modder
Pirate Legend
I've been getting a lot of little bugs today so decided to just dump them in one place
POTC new 2015-07-04 14-59-03-58.jpgThis error happened when I got a smuggling mission, but it completed normally. FIXED

POTC new 2015-07-04 15-02-03-07.jpgShe has a missing name. FIXED

POTC new 2015-07-04 15-03-01-00.jpgThis is after the patch to fix prices and it still looks high. FIXED

POTC new 2015-07-04 15-52-01-48.jpgThis is in the shipyard after 2 battles. These are errors I have not seen before.
 
Last edited by a moderator:
I've been getting a lot of little bugs today so decided to just dump them in one place
This error happened when I got a smuggling mission, but it completed normally.
PROGRAM\smuggling.c find:
Code:
for (int i = 0; i <= 3; i++)
Replace with:
Code:
for (int i = 1; i <= 3; i++)
Indeed shouldn't do any harm. It's just wrong.... :wp

She has a missing name.
Thanks for checking Arabella! I've had some new code in place for her to get her last name to match with the actual Jamaica governor, but that did still need testing.
Do you have a save just prior to that so I can check it?

She has a missing name.

View attachment 21627This is after the patch to fix prices and it still looks high.
Ugh. Indeed! :shock
Uhm..... @Levis....? :rolleyes:

This is in the shipyard after 2 battles. These are errors I have not seen before.
Could you take PROGRAM\INTERFACE\shipyard.c from a previous update (earlier Beta 3.5 or Beta 3.4) and put it back in your game?
Check if that problem remains with the old code or not. Might potentially be a result of the code to improve the interface's performance.
 
Last edited:
@Hylie Pistof could you upload the savegame close before the smuggling deal? I think it's correct now. but I might need some tweaking....
 
This save is at the exit to Port Royal. You will meet the girl and then the smugglers. And a few others..................:guns:


I didn't notice it at first but my Neptunus was reset to default stats. For instance the holds capacity used to be 1945 not 1400. That is why I picked her as she would make a great little smuggler and light trader.
 

Attachments

  • -=Player=- Jamaica.7z
    560.2 KB · Views: 159
I didn't notice it at first but my Neptunus was reset to default stats. For instance the holds capacity used to be 1945 not 1400. That is why I picked her as she would make a great little smuggler and light trader.
Did you press F11/Reinit at any point?
That button now also resets your ship to ensure it matches with any ships_init.c updates you make.
 
:facepalm Of course I did. Many times in fact. As in with every update. :rumgone
In that case: "It's not a bug.... It's a FEATURE!"
If you think this behaviour in the code is not ideal, I'm open for suggestions on better ways to handle it.
This is the code responsible from PROGRAM\Reinit.c:
Code:
    // KK & PB -->
     ShipsInit();
     if(!start)
     {
       string shiptype;
       for (i = 0; i < 4; i++)
       {
         cidx = GetCompanionIndex(pc, i);
         if (cidx < 0) continue;
         ch = GetCharacter(cidx);
         if (CheckAttribute(ch, "ship.stats"))
         {
           shiptype = ch.ship.type;
           if (CheckAttribute(ch.ship.stats, "nation"))   n = sti(ch.ship.stats.nation);
           else                       n = sti(ch.nation);
           makearef(arship, ch.ship);
           DeleteAttribute(arship,"stats");
           if(shiptype != SHIP_CURSED) arSetRandomStatsToShip(arship, GetShipIndex(shiptype), n);
         }
       }
     }
     // KK & PB <--
It is easy enough to remove it again or put some checks around it so it doesn't always happen.
 
there doesn't seem to be a problem in the smugglig code.
Code:
GetCurrentIslandGoodsPrice(FindFirstContrabandGoods(Pchar))

returns the price for ebony. And it returns: 1558
After this there is a multiplier for smuggling.
So I think the problem lies in the good calculation price....

let me look at it more....
 
I think the shipyard interface bug is due to the reinit which caused the ship to reset stats but it does have the upgrade so now it gets confused....
I think we should just add something in the reinit to apply the upgrades again also after the ship is reset. what do you think @Pieter Boelen
 
In that case: "It's not a bug.... It's a FEATURE!"
If you think this behaviour in the code is not ideal, I'm open for suggestions on better ways to handle it.
This is the code responsible from PROGRAM\Reinit.c:
Code:
    // KK & PB -->
     ShipsInit();
     if(!start)
     {
       string shiptype;
       for (i = 0; i < 4; i++)
       {
         cidx = GetCompanionIndex(pc, i);
         if (cidx < 0) continue;
         ch = GetCharacter(cidx);
         if (CheckAttribute(ch, "ship.stats"))
         {
           shiptype = ch.ship.type;
           if (CheckAttribute(ch.ship.stats, "nation"))   n = sti(ch.ship.stats.nation);
           else                       n = sti(ch.nation);
           makearef(arship, ch.ship);
           DeleteAttribute(arship,"stats");
           if(shiptype != SHIP_CURSED) arSetRandomStatsToShip(arship, GetShipIndex(shiptype), n);
         }
       }
     }
     // KK & PB <--
It is easy enough to remove it again or put some checks around it so it doesn't always happen.


Why did you start doing this? This is something brand new and I see no reason for it at all.
 
Why did you start doing this? This is something brand new and I see no reason for it at all.
I announced it on the forum a while back. I even seem to remember you saying you were happy about that change. o_O
It was mainly for your benefit that I added it in the first place so you can easily test changes to ships_init.c .
I'll happily switch it right back off though; it was never a change for me anyway. :no
 
She has a missing name.
Problem solved properly this time.
Note that any characters that you already talked to during the game will already have had their names confused.
That cannot be fixed anymore now, but hopefully it won't be much of an issue. If it is, start a new game.
 
I don't recall anything about this, but I don't recall much anymore anyway. But resetting a ship back to default values with F11 means it can only be used with a generic ship and not a personal ship. Since many of the ships I work on are pretty rare, messing one up could take quite a while to rectify by getting another one of that type.
 
I'm not sure what you mean by generic and personal.
Indeed the upgrades are stripped from the ship, but otherwise she should remain correct as per ships_init.c .
Anyway, if this doesn't help you of all people, then it serves no purpose and we might as well get rid of it again.
 
What I mean is that the ship I had had a larger than normal cargo bay and a smaller than normal crew, and was slower than normal. After hitting F11 I had a small fast ship with a larger crew, which is something I would never buy.

That is the difference between a personal ship and a generic one. This means that is I wanted to modify a ship I would first buy a generic one and not work on my personal ship.
 
Might be the randomization messing things up.
Unless the ship is unique, you'd get a different one every time.
 
Renamed this issue so I'll remember to remove this functionality again.
 
Back
Top