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!
Quick links for Beyond New Horizons
- Download latest version
- Wiki
- FAQ
- Report bugs here
- Bug Tracker on Github
Quick links for Maelstrom
- Download the latest version of Maelstrom
- Download the latest version of ERAS II
- Download the latest version of New Horizons on Maelstrom
Quick links for PotC: New Horizons
- Download latest version
- Wiki
- FAQ
- Report bugs here
Thanks to YOUR votes, GOG.com now sells:
- Sea Dogs
- Sea Dogs: Caribbean Tales
- Sea Dogs: City of Abandoned Ships
Vote now to add Pirates of the Caribbean to the list!
Quick links for AoP2: Gentlemen of Fortune 2
- Downloads and info
- ModDB Profile
- Forums Archive
A Pirate Podcast with Interviews
Music, Comedy and all things Pirate!
- Episode Guide - About - Subscribe -
- Twitter - Facebook - iTunes - Android -
- Youtube - Fill the Coffers -
Are you including my suggestions from post #20 too? Just checking.Now included in this:
Mod Release - Levis' Stuff [Sept 27] | PiratesAhoy!
That was the fix. I've only added the carge type to be set to default also in the reset function (which sounds good to me. if the canons need to be reset it will take the default charge also).Are you including my suggestions from post #20 too? Just checking.![]()
void SetNoneCannonsOnShip(ref ch)
{
//if (!CheckAttribute(ch,"ship.cannons.borts")) return;
aref arship; makearef(arship, ch.Ship);
ch.Ship.Cannons.Borts.cannonf.qty = 0;
ch.Ship.Cannons.Borts.cannonb.qty = 0;
ch.Ship.Cannons.Borts.cannonl.qty = 0;
ch.Ship.Cannons.Borts.cannonr.qty = 0;
ch.Ship.Cannons.Type = CANNON_TYPE_NONECANNON;
ch.ship.cannons.charge.type = DEFAULT_CHARGE;
void SetNoneCannonsOnShip(ref ch)
{
//if (!CheckAttribute(ch,"ship.cannons.borts")) return;
aref arship; makearef(arship, ch.Ship);
ch.Ship.Cannons.Borts.cannonf.qty = 0;
ch.Ship.Cannons.Borts.cannonb.qty = 0;
ch.Ship.Cannons.Borts.cannonl.qty = 0;
ch.Ship.Cannons.Borts.cannonr.qty = 0;
ch.Ship.Cannons.Type = CANNON_TYPE_NONECANNON;
ch.Ship.stats.CannonsQuantity = 0;
Yes, the intention is indeed for that ship never to be armed - in fact, if the player follows the plot, he should not have that ship for very long because he'll soon be getting something much better. The unarmed ship is just to get you from one end of Cuba to the other.So for this specific case (GiveShip2Character) where @Grey Roger wants to set a none armed status on a normally armed vessel (thus where ships_init gives a value to Cannons Quantity) perhaps the wiping of Cannons Quantity could be placed in GiveShip2Character straight after the call to SetNoneCannonsOnShip and not within that call. This would presume the plot line means this ship is never eventually wanted /able to be armed.
GiveShip2Character(PChar,"TartaneWar","Esme",CANNON_TYPE_NONECANNON,SPAIN,false,false);
makearef(arShip, PChar.ship.stats);
arship.CannonsQuantity = 0;
I do think it makes a lot of sense to have zero cannons if the type is NONE.
Without that, it probably all becomes even more complex.![]()
Yes, the intention is indeed for that ship never to be armed - in fact, if the player follows the plot, he should not have that ship for very long because he'll soon be getting something much better. The unarmed ship is just to get you from one end of Cuba to the other.
If it's of any significance, the quest code currently includes this:I don't know what the "Cannons.Borts" attributes do, but the quest itself zeroes the basic "CannonsQuantity" attribute. So this story ought to work regardless of where, or even if, the attribute is zeroed anywhere else.Code:GiveShip2Character(PChar,"TartaneWar","Esme",CANNON_TYPE_NONECANNON,SPAIN,false,false); makearef(arShip, PChar.ship.stats); arship.CannonsQuantity = 0;
Maybe something like:I agree entirely -- so what I think I will need is how to use the target player/companion ship to get its type to create an aref/ref to get at the CannonQuantity from the appropriate entry in ships.init table for any given ship to be reset for correct cannon (max) numbers on gaining cannons regardless as to whether its local CannonsQuantity has been set to zero when NONE was set or not.
I really don't get references still - so I'm blindly copying/adjusting code here - which I suspect will only give me circular references back to the player/companion ship in question and not the underlying model stats. Any hints on the syntax I need anyone?
Similarly I am testing against MaxCaliber to prevent the exploit of overlarge cannons - but since the local MaxCaliber (up to now) has no need to be wiped down, the local one is still there to test.
ref rship = GetShipByType(GetCharacterShipType(ch)); // This should give you a reference to the ships_init.c entry
ch.Ship.Cannons.Type = rship.Cannons.Type; // Check the syntax with the actual ships_init.c file; writing from memory here....
Sounds like adding 'CannonsQuantity = 0;' in the general function is a good idea.Indeed I think it is significant. I presume you had that in place as well as the new cannons.c when reporting it fixed in post #25? If the earlier problem of CANNON_TYPE_NONECANNON not quite doing the job arose because CannonsQuantity was not zero this would (and apparently does) fix that for this case. That gives me further hope that sorting this in the general case may remove some weirdness in cannon transfer too
Looking at "ships_init.c", in which a random ship somewhere down the list has 'refShip.Cannon = CANNON_TYPE_LONG_LBS24;', perhaps:Maybe something like:
Code:ref rship = GetShipByType(GetCharacterShipType(ch)); // This should give you a reference to the ships_init.c entry ch.Ship.Cannons.Type = rship.Cannons.Type; // Check the syntax with the actual ships_init.c file; writing from memory here....
ref rship = GetShipByType(GetCharacterShipType(ch));
ch.Ship.Cannon = rship.Cannon;
No, looking at the contents of "Levis-Fixes_7-10b.zip", the version of "Cannons.c" in there is the same as the first one in post #26, i.e. without the line 'ch.Ship.stats.CannonsQuantity = 0;' and with the line 'ch.ship.cannons.charge.type = DEFAULT_CHARGE;'.Sounds like adding 'CannonsQuantity = 0;' in the general function is a good idea.
In fact, I thought @Levis already did that because I think he said he added my proposed fix as well?![]()
Thanks for checking my syntax! Looks like you're absolutely correct.Looking at "ships_init.c", in which a random ship somewhere down the list has 'refShip.Cannon = CANNON_TYPE_LONG_LBS24;', perhaps:
Disappointing. In that case, I'll definitely recommend @pedrwyth to add that again!No, looking at the contents of "Levis-Fixes_7-10b.zip", the version of "Cannons.c" in there is the same as the first one in post #26, i.e. without the line 'ch.Ship.stats.CannonsQuantity = 0;' and with the line 'ch.ship.cannons.charge.type = DEFAULT_CHARGE;'.
refShip.CannonsQuantity = 32;
ref rship = GetShipByType(GetCharacterShipType(ch));
ch.Ship.CannonsQuantity = rship.CannonsQuantity;
That's how I read it from the sequence of posts tooPossibly because something is going to get upset if there isn't a charge type defined. Recall that what prompted me to start this thread wasn't the minor annoyance of the ship starting out with CANNON_TYPE_NONE and ending up with CANNON_TYPE_something_else; it was the fact that from 23rd September onwards, the ship forgot that it had any food, framerate was very slow, and there were a lot of errors to do with cannons. There was still weirdness even when I changed my line to give the ship 4lb cannons. It does all work now, even if the net effect is that the ship has no cannons, it has 0 of them, and they would be loaded with cannonballs if I were carrying any.![]()
For my story, I don't care if the player is stupid enough to buy cannons for this ship rather than just sail to Santiago and steal the snow brig I've provided for him.Conceptually to transfer to a NONE ship I may well need to get cannonf.qty and cannonb.qty too (since they get zeroed) AND re-run the allocation of the remainder to port and starboard - this gets real messy real quick - I think I need to go away and re-appraise what currently happens on trying to transfer with a ship where I have sold all the cannons v one where (as per this example) the NONE is force set, and CannonQuantity is cleared and a new case where on selling the last cannon I set the NONE attribute (just in case). I might be some time!
If one ship has no cannons at all, then I suppose it makes sense to directly transfer the calibre from the other ship.In general, though, if you're trying to transfer new cannons to a ship which has CANNON_TYPE_NONECANNON, aren't you going to run into the limitation that you're not allowed to increase a ship's calibre by transferring bigger guns to it? If you have 4lb guns and you've just captured something with 6lb guns, you can't upgrade your ship's guns to 6lb by transferring them. So if you have CANNON_TYPE_NONECANNON, you won't be able to transfer guns to your ship. You should, however, be able to add guns at the shipyard.
I don't think that is feasible, because that gets really complicated really fast as @pedrwyth also noticed.On the other hand, if you have no cannons because you either sold them all or they were all knocked out in battle, you should be able to transfer cannons up to the size you last had. You have 4lb guns, or at least you did until they were all destroyed while you were closing to board that ship with 6lb guns. You can't upgrade to 6lb guns but you can transfer guns to your ship - they'll just turn into 4lb guns when you do.
And that's why 0 cannons does not necessarily mean CANNON_TYPE_NONECANNON.![]()
Sorry, I fear I'm not going to get to that any time even remotely soon, if at all....I'm sure @Pieter Boelen can simplify it somewhat.
This is going to be resurrected in the next post-7th January update zip. I want my unarmed ship back!Just tested the different situations.
By using this file everything seems to go well.
Place in:
..\PROGRAM\CANNONS