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

Unconfirmed Bug Bug in function 'SetBaseShipData'

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
In "PROGRAM\Characters\CharacterUtilite.c", function 'SetBaseShipData' contains this:
Code:
     if(!CheckAttribute(refShip,"stats")) {
//KB - Tuning ships - changed call to SetRandomStatsToShip
       SetRandomStatsToShip(GetCharacterIndex(refCharacter.id), nShipType, sti(refCharacter.nation)); // PRS3
//KB - orig SetRandomStatsToShip(refShip, nShipType, sti(refCharacter.nation)); // PRS3
     }
     refBaseShip = GetShipByType(nShipType);

     refShip.HP = GetLocalShipAttrib(refShip, refBaseShip, "HP");
     refShip.SP = GetLocalShipAttrib(refShip, refBaseShip, "SP");

     if (nShipType != SHIP_FORT) // PB: Don't overwrite this for forts
     {
       refShip.Pos.x = 0;
       refShip.Pos.z = 0;
     }
     refShip.Ang = "";
     refShip.Cannons.Borts = "";
     if (USE_REAL_CANNONS)
       refShip.Cannons.Charge.Type = GOOD_BALLS; // KNB
     else
       refShip.Cannons.Charge.Type = GOOD_BOMBS;
     if(!CheckAttribute(refShip,"Cannons.Type")) { refShip.Cannons.Type = MakeInt(GetLocalShipAttrib(refShip, refBaseShip, "Cannon")); }

     if(!CheckAttribute(refShip,"Crew.Morale"))   { refShip.Crew.Morale = 45;   }
     if(!CheckAttribute(refShip,"Crew.Quantity")) { refShip.Crew.Quantity = GetLocalShipAttrib(refShip, refBaseShip, "MaxCrew"); }
This seems to set the ship's stats modified by the character's nation, then set the ship's HP and crew unmodified by nation. The effect of that, in the original code to give you Anacleto's ship in "Tales of a Sea Hawk", is that I got a Dutch version of a "Pinnace1" because I was flying a Dutch flag at the time. Dutch ships get 90% MaxCrew. So my MaxCrew was a little over 90 and my actual crew was a little over 100.

I got round this by using a different method to give you Anacleto's ship, but there may still be problems anywhere else this function is used.
 
Set Random Stats should take care of the nation specific stuff, if I recall.
Not sure why that is being overridden afterwards. :shock
 
@Grey Roger: Something you could try is to replace this:
Code:
refShip.HP = GetLocalShipAttrib(refShip, refBaseShip, "HP");
With this:
Code:
if (!CheckAttribute(refShip,"HP"))
{
refShip.HP = GetLocalShipAttrib(refShip, refBaseShip, "HP");
}
Do you reckon that makes sense? Something similar to that appears to already be in place for "Crew.Quantity".
 
The problem I encountered was with "Crew.Quantity". ;)

I was flying a Dutch flag, so the function tried to set my ship to Dutch standards, which includes 90% maximum crew. That line takes no account of nation modifiers, so I ended up with 100% crew and 90% MaxCrew.
 
Ideally 'SetRandomStatsToShip' should set the "Crew.Quantity" attributes.
Then the 'GetLocalShipAttrib' call for that should be skipped, because it was already set.

Apparently that isn't happening then. Big question: Why?
Might have to look at the 'SetRandomStatsToShip' function itself.
 
any progress on this?
 
Back
Top