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

Planned Feature Include Cannon Weight and Number in Cargo Capacity

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
At the moment the game doesn't understand that cannons have a weight at all.
Therefore you can have no cannons or a maximum number of super-cannons and it won't make a difference on your cargo capacity.
Obviously that is not at all realistic and doesn't make any sense, so it would be great to do something about that.
Must be possible; we'll just have to figure it out.

That might unlock extra gameplay options, such as deliberately using smaller cannons to increase cargo capacity or selling some of them.
We could even factor in the number of crewmembers you have on board since those should probably have a weight too.

Hopefully @J Norrington can look into the implementation of this.

------------------------------------------------------------------------

Some relevant code stuff:

- The various cannons DO have a "Weight" defined in Cannons_init.c, but as far as I can tell that isn't used anywhere.
I'll add this function in the next modpack update:
Code:
float GetCannonWeight(int nCannonType)
{
   if(nCannonType==CANNON_TYPE_NONECANNON) return 0;
   ref rCannon = GetCannonByType(nCannonType);
   return sti(rCannon.Weight);
}
That can be used to find the cannon weight.

- This function is available to get the number of cannons currently installed on the ship:
Code:
int GetCannonCurQuantity(ref ch)

- PROGRAM\Characters\CharacterUtilite.c contains the relevant code to calculate the used and free amount of cargo space:
Code:
int RecalculateCargoLoad(ref _refCharacter)
{
   // NK 04-16 temp bugfix - if(!CheckAttribute(_refCharacter,"Ship.Cargo.Load")) return 0;
   if(!CheckAttribute(_refCharacter,"Ship")) return 0; // NK ditto; we return 0 _only_ if _ship_ doesn't exist; we continue if ship does but cargo doesn't
   int loadSpace = 0;
   for(int i=0; i<GOODS_QUANTITY; i++)
   {
     loadSpace = loadSpace + GetGoodWeightByType(i,GetCargoGoods(_refCharacter,i));
   }
   _refCharacter.Ship.Cargo.Load = loadSpace;
   return loadSpace;
}

int GetCargoFreeSpace(ref _refCharacter)
{
   // TIH 7-7-06 temp bugfix - if(!CheckAttribute(_refCharacter,"Ship.Cargo.Load")) return 0;
   int freeSpace = GetCargoMaxSpace(_refCharacter) - GetCargoLoad(_refCharacter);
   return freeSpace;
}

int GetCargoMaxSpace(ref _refCharacter)
{
   if( !CheckAttribute(_refCharacter,"Ship.Type") ) return 0;
   int _ShipType = GetCharacterShipType(_refCharacter); // PS
   if( _ShipType==SHIP_NOTUSED )
     return 0;
   aref arship; makearef(arship, _refCharacter.ship); // PRS3
   if(_ShipType == -1) trace("SHIP MISSING: " + _refCharacter.ship.type); // PB: Error checking
   return sti(GetLocalShipAttrib(arship, &ShipsTypes[_ShipType],"Capacity")); // PRS3
}
Those functions will need updating to include cannons and possibly crew.
 
Yes this is a good thing and I hope it gets made properly. I like the idea of reducing crew along with reducing cannons. This something that I sometimes do manually early in a game for monetary reasons. Hehe, In a tight spot one could also toss cannons and crew overboard to lighten the ship and increase speed.
 
Last edited:
In a tight spot one couls also toss cannons and crew overboard to lighten the ship and increase speed.
Might be possible as well. I'm pretty sure tossing cargo current has that same effect.
Though tossing crew and canons would require buttons added. Still, worth keeping in mind. :yes
 
Throwing crew overboard ought to seriously reduce your reputation, not to mention your morale. Do it once too often and the rest of the crew might decide that it's your turn to help lighten the ship!
 
Throwing crew overboard ought to seriously reduce your reputation, not to mention your morale. Do it once too often and the rest of the crew might decide that it's your turn to help lighten the ship!
Yup! I didn't bother to mention that, but indeed very much so! That is quite an evil thing to do.... :wp
 
Evening Gentlemen I did some research on how they added cannon weight to AOP2 it's pretty ingenious actually they made the cannons as sort of phantom goods (goods that you couldn't buy or sell or see but added weight to the cargo hold) think that this is the best way to go as far as the dynamic weight now I just have to find a way to implement it in game by adding my own phantom cannon goods to the game. Is there a tutorial for creating goods anywhere on the forum? Gonna search through the forum but if anyone knows off the top of their heads and can point me in the right direction I'd appreciate it.

@Hylie Pistof I agree balancing the economy is going to be a bit tricky you need to be in that sweet spot between challenging but not becoming to horrible of a grind early on and not becoming too easy later on I have a few ideas as far as to make the game more challenging later on that I have yet to implement but may if needed.

#1. Limit amounts in trade quests, have a certain max limit of goods you can transport be put in place. (stops bigger warships from cashing in on trade good missions)

#2. Cut the amount of prize money for looting towns by 50% (Again stops bigger warships from cashing in too much)

#3. Adjust the negative relations for taking a town higher so that the punitive squadrons are sent after you quicker also change the ships of punitive squadrons making them bigger and tougher (Oh you just decided to sack Port Royale Eh? Well his majesty has just authorized two first rates, two 74's and two frigates to hunt you down....Cheerio! :D)
 
I've never noticed that the punitive squadrons actually work.

As for phantom goods, I'm not sure if that is needed if the cannons themselves already have a weight defined, which they do.
Can you post the relevant code excerpts from AoP for reference?
 
@Pieter Boelen I believe Punitive Squadrons trigger after a certain negative relation is met but I'll test it out tonight, It would be a bummer if it doesn't work. As far as the code it was added to the bottom of init.Goods under Program/Store don't know if it was added by the GOF modders I can only assume so. Yes the cannons do have weight values in POTC Cannons.Init but the values themselves don't change anything or impact cargo weight.

Here's the code:

////////////////////////////////////////////////////// ïóøêè ýòî òîâàð - boal 27/07/06
Goods[GOOD_CANNON_4].Name = "Cannon_4";
Goods[GOOD_CANNON_4].CannonIdx = CANNON_TYPE_CANNON_LBS4;
Goods[GOOD_CANNON_4].Cost = Cannon[CANNON_TYPE_CANNON_LBS4].Cost;
Goods[GOOD_CANNON_4].Weight = Cannon[CANNON_TYPE_CANNON_LBS4].Weight;
Goods[GOOD_CANNON_4].FireRange = Cannon[CANNON_TYPE_CANNON_LBS4].FireRange;
Goods[GOOD_CANNON_4].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS4].DamageMultiply;
Goods[GOOD_CANNON_4].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS4]));
Goods[GOOD_CANNON_4].Units = 1;
Goods[GOOD_CANNON_4].AfraidWater = 0;
Goods[GOOD_CANNON_4].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_4].canbecontraband = 0;

Goods[GOOD_CANNON_8].Name = "Cannon_8";
Goods[GOOD_CANNON_8].CannonIdx = CANNON_TYPE_CANNON_LBS8;
Goods[GOOD_CANNON_8].Cost = Cannon[CANNON_TYPE_CANNON_LBS8].Cost;
Goods[GOOD_CANNON_8].Weight = Cannon[CANNON_TYPE_CANNON_LBS8].Weight;
Goods[GOOD_CANNON_8].FireRange = Cannon[CANNON_TYPE_CANNON_LBS8].FireRange;
Goods[GOOD_CANNON_8].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS8].DamageMultiply;
Goods[GOOD_CANNON_8].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS8]));
Goods[GOOD_CANNON_8].Units = 1;
Goods[GOOD_CANNON_8].AfraidWater = 0;
Goods[GOOD_CANNON_8].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_8].canbecontraband = 0;

Goods[GOOD_CANNON_12].Name = "Cannon_12";
Goods[GOOD_CANNON_12].CannonIdx = CANNON_TYPE_CANNON_LBS12;
Goods[GOOD_CANNON_12].Cost = Cannon[CANNON_TYPE_CANNON_LBS12].Cost;
Goods[GOOD_CANNON_12].Weight = Cannon[CANNON_TYPE_CANNON_LBS12].Weight;
Goods[GOOD_CANNON_12].FireRange = Cannon[CANNON_TYPE_CANNON_LBS12].FireRange;
Goods[GOOD_CANNON_12].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS12].DamageMultiply;
Goods[GOOD_CANNON_12].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS12]));
Goods[GOOD_CANNON_12].Units = 1;
Goods[GOOD_CANNON_12].AfraidWater = 0;
Goods[GOOD_CANNON_12].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_12].canbecontraband = 0;

Goods[GOOD_CANNON_16].Name = "Cannon_16";
Goods[GOOD_CANNON_16].CannonIdx = CANNON_TYPE_CANNON_LBS16;
Goods[GOOD_CANNON_16].Cost = Cannon[CANNON_TYPE_CANNON_LBS16].Cost;
Goods[GOOD_CANNON_16].Weight = Cannon[CANNON_TYPE_CANNON_LBS16].Weight;
Goods[GOOD_CANNON_16].Units = 1;
Goods[GOOD_CANNON_16].AfraidWater = 0;
Goods[GOOD_CANNON_16].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_16].canbecontraband = 0;
Goods[GOOD_CANNON_16].FireRange = Cannon[CANNON_TYPE_CANNON_LBS16].FireRange;
Goods[GOOD_CANNON_16].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS16].DamageMultiply;
Goods[GOOD_CANNON_16].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS16]));

Goods[GOOD_CANNON_20].Name = "Cannon_20";
Goods[GOOD_CANNON_20].CannonIdx = CANNON_TYPE_CANNON_LBS20;
Goods[GOOD_CANNON_20].Cost = Cannon[CANNON_TYPE_CANNON_LBS20].Cost;
Goods[GOOD_CANNON_20].Weight = Cannon[CANNON_TYPE_CANNON_LBS20].Weight;
Goods[GOOD_CANNON_20].FireRange = Cannon[CANNON_TYPE_CANNON_LBS20].FireRange;
Goods[GOOD_CANNON_20].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS20].DamageMultiply;
Goods[GOOD_CANNON_20].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS20]));
Goods[GOOD_CANNON_20].Units = 1;
Goods[GOOD_CANNON_20].AfraidWater = 0;
Goods[GOOD_CANNON_20].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_20].canbecontraband = 0;

Goods[GOOD_CANNON_24].Name = "Cannon_24";
Goods[GOOD_CANNON_24].CannonIdx = CANNON_TYPE_CANNON_LBS24;
Goods[GOOD_CANNON_24].Cost = Cannon[CANNON_TYPE_CANNON_LBS24].Cost;
Goods[GOOD_CANNON_24].Weight = Cannon[CANNON_TYPE_CANNON_LBS24].Weight;
Goods[GOOD_CANNON_24].Units = 1;
Goods[GOOD_CANNON_24].AfraidWater = 0;
Goods[GOOD_CANNON_24].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_24].canbecontraband = 0;
Goods[GOOD_CANNON_24].FireRange = Cannon[CANNON_TYPE_CANNON_LBS24].FireRange;
Goods[GOOD_CANNON_24].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS24].DamageMultiply;
Goods[GOOD_CANNON_24].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS24]));

Goods[GOOD_CANNON_28].Name = "Cannon_28";
Goods[GOOD_CANNON_28].CannonIdx = CANNON_TYPE_CANNON_LBS28;
Goods[GOOD_CANNON_28].Cost = Cannon[CANNON_TYPE_CANNON_LBS28].Cost;
Goods[GOOD_CANNON_28].Weight = Cannon[CANNON_TYPE_CANNON_LBS28].Weight;
Goods[GOOD_CANNON_28].FireRange = Cannon[CANNON_TYPE_CANNON_LBS28].FireRange;
Goods[GOOD_CANNON_28].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS28].DamageMultiply;
Goods[GOOD_CANNON_28].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS28]));
Goods[GOOD_CANNON_28].Units = 1;
Goods[GOOD_CANNON_28].AfraidWater = 0;
Goods[GOOD_CANNON_28].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_28].canbecontraband = 0;

Goods[GOOD_CANNON_32].Name = "Cannon_32";
Goods[GOOD_CANNON_32].CannonIdx = CANNON_TYPE_CANNON_LBS32;
Goods[GOOD_CANNON_32].Cost = Cannon[CANNON_TYPE_CANNON_LBS32].Cost;
Goods[GOOD_CANNON_32].Weight = Cannon[CANNON_TYPE_CANNON_LBS32].Weight;
Goods[GOOD_CANNON_32].Units = 1;
Goods[GOOD_CANNON_32].AfraidWater = 0;
Goods[GOOD_CANNON_32].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_32].canbecontraband = 0;
Goods[GOOD_CANNON_32].FireRange = Cannon[CANNON_TYPE_CANNON_LBS32].FireRange;
Goods[GOOD_CANNON_32].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS32].DamageMultiply;
Goods[GOOD_CANNON_32].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS32]));

Goods[GOOD_CANNON_36].Name = "Cannon_36";
Goods[GOOD_CANNON_36].CannonIdx = CANNON_TYPE_CANNON_LBS36;
Goods[GOOD_CANNON_36].Cost = Cannon[CANNON_TYPE_CANNON_LBS36].Cost;
Goods[GOOD_CANNON_36].Weight = Cannon[CANNON_TYPE_CANNON_LBS36].Weight;
Goods[GOOD_CANNON_36].FireRange = Cannon[CANNON_TYPE_CANNON_LBS36].FireRange;
Goods[GOOD_CANNON_36].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS36].DamageMultiply;
Goods[GOOD_CANNON_36].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS36]));
Goods[GOOD_CANNON_36].Units = 1;
Goods[GOOD_CANNON_36].AfraidWater = 0;
Goods[GOOD_CANNON_36].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_36].canbecontraband = 0;

Goods[GOOD_CANNON_42].Name = "Cannon_42";
Goods[GOOD_CANNON_42].CannonIdx = CANNON_TYPE_CANNON_LBS42;
Goods[GOOD_CANNON_42].Cost = Cannon[CANNON_TYPE_CANNON_LBS42].Cost;
Goods[GOOD_CANNON_42].Weight = Cannon[CANNON_TYPE_CANNON_LBS42].Weight;
Goods[GOOD_CANNON_42].Units = 1;
Goods[GOOD_CANNON_42].AfraidWater = 0;
Goods[GOOD_CANNON_42].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_42].canbecontraband = 0;
Goods[GOOD_CANNON_42].FireRange = Cannon[CANNON_TYPE_CANNON_LBS42].FireRange;
Goods[GOOD_CANNON_42].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS42].DamageMultiply;
Goods[GOOD_CANNON_42].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS42]));

Goods[GOOD_CANNON_48].Name = "Cannon_48";
Goods[GOOD_CANNON_48].CannonIdx = CANNON_TYPE_CANNON_LBS48;
Goods[GOOD_CANNON_48].Cost = Cannon[CANNON_TYPE_CANNON_LBS48].Cost;
Goods[GOOD_CANNON_48].Weight = Cannon[CANNON_TYPE_CANNON_LBS48].Weight;
Goods[GOOD_CANNON_48].FireRange = Cannon[CANNON_TYPE_CANNON_LBS48].FireRange;
Goods[GOOD_CANNON_48].DamageMultiply = Cannon[CANNON_TYPE_CANNON_LBS48].DamageMultiply;
Goods[GOOD_CANNON_48].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CANNON_LBS48]));
Goods[GOOD_CANNON_48].Units = 1;
Goods[GOOD_CANNON_48].AfraidWater = 0;
Goods[GOOD_CANNON_48].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CANNON_48].canbecontraband = 0;

Goods[GOOD_CULVERINE_4].Name = "Culverine_4";
Goods[GOOD_CULVERINE_4].CannonIdx = CANNON_TYPE_CULVERINE_LBS4;
Goods[GOOD_CULVERINE_4].Cost = Cannon[CANNON_TYPE_CULVERINE_LBS4].Cost;
Goods[GOOD_CULVERINE_4].Weight = Cannon[CANNON_TYPE_CULVERINE_LBS4].Weight;
Goods[GOOD_CULVERINE_4].Units = 1;
Goods[GOOD_CULVERINE_4].AfraidWater = 0;
Goods[GOOD_CULVERINE_4].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CULVERINE_4].canbecontraband = 0;
Goods[GOOD_CULVERINE_4].FireRange = Cannon[CANNON_TYPE_CULVERINE_LBS4].FireRange;
Goods[GOOD_CULVERINE_4].DamageMultiply = Cannon[CANNON_TYPE_CULVERINE_LBS4].DamageMultiply;
Goods[GOOD_CULVERINE_4].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CULVERINE_LBS4]));

Goods[GOOD_CULVERINE_8].Name = "Culverine_8";
Goods[GOOD_CULVERINE_8].CannonIdx = CANNON_TYPE_CULVERINE_LBS8;
Goods[GOOD_CULVERINE_8].Cost = Cannon[CANNON_TYPE_CULVERINE_LBS8].Cost;
Goods[GOOD_CULVERINE_8].Weight = Cannon[CANNON_TYPE_CULVERINE_LBS8].Weight;
Goods[GOOD_CULVERINE_8].Units = 1;
Goods[GOOD_CULVERINE_8].AfraidWater = 0;
Goods[GOOD_CULVERINE_8].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CULVERINE_8].canbecontraband = 0;
Goods[GOOD_CULVERINE_8].FireRange = Cannon[CANNON_TYPE_CULVERINE_LBS8].FireRange;
Goods[GOOD_CULVERINE_8].DamageMultiply = Cannon[CANNON_TYPE_CULVERINE_LBS8].DamageMultiply;
Goods[GOOD_CULVERINE_8].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CULVERINE_LBS8]));

Goods[GOOD_CULVERINE_12].Name = "Culverine_12";
Goods[GOOD_CULVERINE_12].CannonIdx = CANNON_TYPE_CULVERINE_LBS12;
Goods[GOOD_CULVERINE_12].Cost = Cannon[CANNON_TYPE_CULVERINE_LBS12].Cost;
Goods[GOOD_CULVERINE_12].Weight = Cannon[CANNON_TYPE_CULVERINE_LBS12].Weight;
Goods[GOOD_CULVERINE_12].Units = 1;
Goods[GOOD_CULVERINE_12].AfraidWater = 0;
Goods[GOOD_CULVERINE_12].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CULVERINE_12].canbecontraband = 0;
Goods[GOOD_CULVERINE_12].FireRange = Cannon[CANNON_TYPE_CULVERINE_LBS12].FireRange;
Goods[GOOD_CULVERINE_12].DamageMultiply = Cannon[CANNON_TYPE_CULVERINE_LBS12].DamageMultiply;
Goods[GOOD_CULVERINE_12].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CULVERINE_LBS12]));

Goods[GOOD_CULVERINE_16].Name = "Culverine_16";
Goods[GOOD_CULVERINE_16].CannonIdx = CANNON_TYPE_CULVERINE_LBS16;
Goods[GOOD_CULVERINE_16].Cost = Cannon[CANNON_TYPE_CULVERINE_LBS16].Cost;
Goods[GOOD_CULVERINE_16].Weight = Cannon[CANNON_TYPE_CULVERINE_LBS16].Weight;
Goods[GOOD_CULVERINE_16].Units = 1;
Goods[GOOD_CULVERINE_16].AfraidWater = 0;
Goods[GOOD_CULVERINE_16].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CULVERINE_16].canbecontraband = 0;
Goods[GOOD_CULVERINE_16].FireRange = Cannon[CANNON_TYPE_CULVERINE_LBS16].FireRange;
Goods[GOOD_CULVERINE_16].DamageMultiply = Cannon[CANNON_TYPE_CULVERINE_LBS16].DamageMultiply;
Goods[GOOD_CULVERINE_16].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CULVERINE_LBS16]));

Goods[GOOD_CULVERINE_20].Name = "Culverine_20";
Goods[GOOD_CULVERINE_20].CannonIdx = CANNON_TYPE_CULVERINE_LBS20;
Goods[GOOD_CULVERINE_20].Cost = Cannon[CANNON_TYPE_CULVERINE_LBS20].Cost;
Goods[GOOD_CULVERINE_20].Weight = Cannon[CANNON_TYPE_CULVERINE_LBS20].Weight;
Goods[GOOD_CULVERINE_20].Units = 1;
Goods[GOOD_CULVERINE_20].AfraidWater = 0;
Goods[GOOD_CULVERINE_20].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CULVERINE_20].canbecontraband = 0;
Goods[GOOD_CULVERINE_20].FireRange = Cannon[CANNON_TYPE_CULVERINE_LBS20].FireRange;
Goods[GOOD_CULVERINE_20].DamageMultiply = Cannon[CANNON_TYPE_CULVERINE_LBS20].DamageMultiply;
Goods[GOOD_CULVERINE_20].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CULVERINE_LBS20]));

Goods[GOOD_CULVERINE_24].Name = "Culverine_24";
Goods[GOOD_CULVERINE_24].CannonIdx = CANNON_TYPE_CULVERINE_LBS24;
Goods[GOOD_CULVERINE_24].Cost = Cannon[CANNON_TYPE_CULVERINE_LBS24].Cost;
Goods[GOOD_CULVERINE_24].Weight = Cannon[CANNON_TYPE_CULVERINE_LBS24].Weight;
Goods[GOOD_CULVERINE_24].Units = 1;
Goods[GOOD_CULVERINE_24].AfraidWater = 0;
Goods[GOOD_CULVERINE_24].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CULVERINE_24].canbecontraband = 0;
Goods[GOOD_CULVERINE_24].FireRange = Cannon[CANNON_TYPE_CULVERINE_LBS24].FireRange;
Goods[GOOD_CULVERINE_24].DamageMultiply = Cannon[CANNON_TYPE_CULVERINE_LBS24].DamageMultiply;
Goods[GOOD_CULVERINE_24].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CULVERINE_LBS24]));

Goods[GOOD_CULVERINE_28].Name = "Culverine_28";
Goods[GOOD_CULVERINE_28].CannonIdx = CANNON_TYPE_CULVERINE_LBS28;
Goods[GOOD_CULVERINE_28].Cost = Cannon[CANNON_TYPE_CULVERINE_LBS28].Cost;
Goods[GOOD_CULVERINE_28].Weight = Cannon[CANNON_TYPE_CULVERINE_LBS28].Weight;
Goods[GOOD_CULVERINE_28].Units = 1;
Goods[GOOD_CULVERINE_28].AfraidWater = 0;
Goods[GOOD_CULVERINE_28].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CULVERINE_28].canbecontraband = 0;
Goods[GOOD_CULVERINE_28].FireRange = Cannon[CANNON_TYPE_CULVERINE_LBS28].FireRange;
Goods[GOOD_CULVERINE_28].DamageMultiply = Cannon[CANNON_TYPE_CULVERINE_LBS28].DamageMultiply;
Goods[GOOD_CULVERINE_28].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CULVERINE_LBS28]));

Goods[GOOD_CULVERINE_32].Name = "Culverine_32";
Goods[GOOD_CULVERINE_32].CannonIdx = CANNON_TYPE_CULVERINE_LBS32;
Goods[GOOD_CULVERINE_32].Cost = Cannon[CANNON_TYPE_CULVERINE_LBS32].Cost;
Goods[GOOD_CULVERINE_32].Weight = Cannon[CANNON_TYPE_CULVERINE_LBS32].Weight;
Goods[GOOD_CULVERINE_32].Units = 1;
Goods[GOOD_CULVERINE_32].AfraidWater = 0;
Goods[GOOD_CULVERINE_32].type = TRADE_TYPE_CANNONS;
Goods[GOOD_CULVERINE_32].canbecontraband = 0;
Goods[GOOD_CULVERINE_32].FireRange = Cannon[CANNON_TYPE_CULVERINE_LBS32].FireRange;
Goods[GOOD_CULVERINE_32].DamageMultiply = Cannon[CANNON_TYPE_CULVERINE_LBS32].DamageMultiply;
Goods[GOOD_CULVERINE_32].ReloadTime = sti(GetCannonReloadTime(&Cannon[CANNON_TYPE_CULVERINE_LBS32]));
}
 
@Pieter Boelen This code was also in Cannons.C in the AOP2 directory

int GetCannonGoodsIdxByType(int iCannon)
{
int i;

for (i = 0; i< GOODS_QUANTITY; i++)
{
if (CheckAttribute(&Goods, "CannonIdx"))
{
if (sti(Goods.CannonIdx) == iCannon) return i;
}
}
return -1;
}
 
@Pieter Boelen I believe Punitive Squadrons trigger after a certain negative relation is met but I'll test it out tonight, It would be a bummer if it doesn't work.
I know there is code for them; has been since the original game. They should appear if you fail to pay a loan. But I don't think that feature ever worked.

Goods under Program/Store don't know if it was added by the GOF modders I can only assume so.
I doubt the modders added that. There were a lot of good things already a part of the original CoAS game itself, though the way everything was handled there wasn't always the most flexible.
But hey, at least it worked. Has to count for something!

Yes the cannons do have weight values in POTC Cannons.Init but the values themselves don't change anything or impact cargo weight.
Indeed they don't; we need to add that one way or another.

@Pieter Boelen it seems to me that it may be a simpler way to implement cannon weight into the game by altering this than creating a code from scratch but there are more ways than one to skin a cat. The only problem I can foresee with this is making the goods themselves phantom or at least not discardable, sellable, or transferrable sort of like quest items.
I'm not sure in what way it would be simpler. If anything, my first impression is that it would make things more complicated.
Reason being is that you're doubling up code, with cannons having a copy as goods. Then you need to put in exceptions so that those goods aren't used like regular ones.
And then you still need the extra code for buying/selling cannons to add/remove goods, which is something that we need to do one wa or another.
Plus "crew" would need to become a good as well if we want to go that route. Though admittedly that would unlock the "dump" functionality for them as that is already in place for goods.
I haven't given this a tremendous amount of thought, so it can go either way.

I may try what I have in mind today or tomorrow, just to see if it works. Perhaps I'm wrong and it becomes a can of worms (which we can close very quickly again, of course!).
But with a bit of luck, it will show promise and we'll have something to build on.
 
GetCannonWeight function was rewritten for easier use:
Code:
float GetCannonWeight(ref rChar)
{
   int nCannonType = GetCaracterShipCannonsType(rChar);
   if(nCannonType==CANNON_TYPE_NONECANNON) return 0;
   ref rCannon = GetCannonByType(nCannonType);
   return stf(rCannon.Weight);
}
Following change made in CharacterUtilite.c:
Code:
int RecalculateCargoLoad(ref _refCharacter)
{
   // NK 04-16 temp bugfix - if(!CheckAttribute(_refCharacter,"Ship.Cargo.Load")) return 0;
   if(!CheckAttribute(_refCharacter,"Ship")) return 0; // NK ditto; we return 0 _only_ if _ship_ doesn't exist; we continue if ship does but cargo doesn't
   int loadSpace = 0;
   for(int i=0; i<GOODS_QUANTITY; i++)
   {
     loadSpace = loadSpace + GetGoodWeightByType(i,GetCargoGoods(_refCharacter,i));
   }
   // PB: Cannons and Crew -->
   loadSpace = loadSpace + GetCannonCurQuantity(_refCharacter) * GetCannonWeight(_refCharacter));
   loadSpace = loadSpace + GetTotalCrewQuantity(_refCharacter));
   // PB: Cannons and Crew <--
   _refCharacter.Ship.Cargo.Load = loadSpace;
   return loadSpace;
}
This combined already seems to have the desired effect. So we're DONE!

No, not quite. That would've been too easy.
To prevent needless calculations, the cargo load is stored and only recalculated if necessary.
At the moment hiring/firing crew and installing/removing cannons isn't considered to be something that requires recalculating the cargo.
Therefore that need to be added for all instances where any changes occur to crew and cannon quantity and type.

To make things even more complicated, there also need to be checks added in these instances so that you can't exceed your maximum cargo capacity.

So while the concept is clearly proven to work, this change involves a lot of changes to be made.
I hope @J Norrington is up to the task! It will require some substantial logical thinking and therefore should be pretty good to learn some more programming.
Cut it down into "bite-size" tasks and tackle one at a time; that should make this quite possible. :onya
 
For the testing purposes, I will keep this in place and add the following to PROGRAM\console.c:
Code:
      for (i = 0; i <= GetCompanionQuantity(PChar); i++)
       {
         ch = GetCharacter(GetCompanionIndex(pchar, sti(i)));
         RecalculateCargoLoad(ch);
       }
That should update your cargo load whenever you press F12 so you can do this manually after any crew/cannon transactions.
 
This copied here for reference:
perhaps linking negative weight to penalty in speed then it's up to the player to decide when they overload?
Going overload would basically mean you put more stuff in your ship than can physically fit in there. That makes no sense and shouldn't be possible.
If you do try it, you should get Wasa situations with your ship just randomly capsizing/sinking.
It should simply be impossible to do, but that requires coding in the limitations. That particular feature was put in there by me in about 5-10 minutes.
While the concept has been proven, it needs a lot more development because something like that isn't going to be simple.
I like the idea of capsizing when overloaded. :pirateraft
At the moment you can only overload by being full on cargo and then installing more/larger cannons and/or adding more crew.
That is actually possible, but really shouldn't be. Overloading with actual cargo shouldn't be possible even now.

Ideally I wouldn't want overloading that way to be possible. But if you guys say "I don't care, user error!" then perhaps capsizing might be a simpler "solution" than actually preventing it.
Of course it should be more obvious to the player though. Right now I can only see it in the F2>Carho Hold menu.
 
This system is working fine for me so far,but I haven't been in any battles to lose cannons or crew. Right now the only ways that I can think of to overload your ship would be to come into port with a shot up ship loaded with booty and go to the shipyard first to get it repaired. But then going to the store would take care of it. Or you could go to the store first and fill your holds and then stop at the shipyard on the way out. In that case the capsizing feature would be a good thing as I see it. Sploosh! :popcorn: We would be inundated by Cherries complaining about capsized ships. :razz
 
Method for maximum over-up on your cargo:
1. Fire all crew you can
2. Remove all cannons you have
3. Completely fill up your cargo hold
4. Fill up your crew
5. Install the largest cannons that will fit on your ship
6. Press F12 to update the cargo values shown in F2>Cargo Hold

I strongly suspect that is going to be pretty bad.... :wp

At the moment, I am thinking the following things need doing:

- Define weight for crewmembers; right now they all count as "1" which might be a bit much.

- Since we probably won't be able to cover everything soon, make the ship capsize if the loaded cargo exceeds the cargo capacity at sea.
Does anyone have any thoughts on when/how often this check should be done?

- When opening "Hire Crew" interface, calculate the amount of crew you can fit based on your free cargo space.
Ensure this cannot be exceeded and add a warning message to go with it.
Recalculate cargo load.

- Do the same thing for installing cannons + Add a note for each type of cannon how much it weighs per cannon.
Recalculate cargo load.

- Think of all other instances where crew and cannons are added/removed and add a "Recalculate cargo load" there too.
 
Does this mean anyone who goes to Vanderdecken and loads up on stupidly oversized cannon is guaranteed to leave Isla de Muerte upside down? xD

The obvious place to put a check for capsizing is when you first board your ship and switch to sea mode. Most of the rest of the time while you're at sea, you're losing cargo (food and rum consumed, ammunition fired, crew killed, sailcloth and planks used for repairs), so if you haven't already capsized then you're safe.

The next place for a "Recalculate cargo load" is after looting or transferring. Cargo, cannons and crew can be moved between ships. It's going to be embarrassing but amusing if you loot an enemy ship, help yourself to his stock of gold, watch the enemy ship sink, then capsize. xD

There will also need to be a check on NPC ships to make sure they're not overloaded. You don't want to board an enemy ship, it surrenders, you leave its crew and cargo where they are, and that's when the game realises the ship is overloaded and capsizes...
 
Does this mean anyone who goes to Vanderdecken and loads up on stupidly oversized cannon is guaranteed to leave Isla de Muerte upside down? xD
Maybe. If you show up there with too much cargo in your hold, that could definitely happen.
Also easily avoided by NOT giving those cannons their appropriate weight. IF we decide we need to go that route....

The obvious place to put a check for capsizing is when you first board your ship and switch to sea mode. Most of the rest of the time while you're at sea, you're losing cargo (food and rum consumed, ammunition fired, crew killed, sailcloth and planks used for repairs), so if you haven't already capsized then you're safe.
DirectSail and boarding enemy ships could give you extra crew.
And if you go to sea with one cannon and then steal them from other ships....? But indeed, that is unlikely.

Should capsizing occur always even if you are 1 over capacity? That would certainly be the simplest.
We'd have the genuine Wasa-effect in the game! :rofl

The next place for a "Recalculate cargo load" is after looting or transferring. Cargo, cannons and crew can be moved between ships. It's going to be embarrassing but amusing if you loot an enemy ship, help yourself to his stock of gold, watch the enemy ship sink, then capsize. xD
Adding cargo already has a check on over-up so I think you can't trigger it by cargo alone.
Crew and cannons though.....

There will also need to be a check on NPC ships to make sure they're not overloaded. You don't want to board an enemy ship, it surrenders, you leave its crew and cargo where they are, and that's when the game realises the ship is overloaded and capsizes...
I am hoping that playtesting on the current version will indicate if that happens or not.
 
Back
Top