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

Needs Testing [WIP] cannons disappearing when trying to transfer between ships

Tingyun

Corsair
Storm Modder
Running a test character, captured a pirate brig. Went to transfer cannons screen, clicked to try to trasnfer some of my (great many) cannons from the 1st rate ship I was sailing. Clicked to transfer over, but pirate ship was full of cannons. Exited cannon transfer screen, went back to it, and all my cannons were gone to 0.
Might be related to the other posted bug--my test ship's cannons seem to be giving all types of errors. Maybe because I started a new game and haven't hired anyone or bought anything yet?

This in the error log.

RUNTIME ERROR - file: interface\transfer_cannons.c; line: 327
missed attribute: qty
RUNTIME ERROR - file: interface\transfer_cannons.c; line: 327
no rAP data
RUNTIME ERROR - file: interface\transfer_cannons.c; line: 328
missed attribute: qty
RUNTIME ERROR - file: interface\transfer_cannons.c; line: 328
no rAP data
RUNTIME ERROR - file: interface\transfer_cannons.c; line: 329
missed attribute: qty
RUNTIME ERROR - file: interface\transfer_cannons.c; line: 329
no rAP data
RUNTIME ERROR - file: interface\transfer_cannons.c; line: 330
missed attribute: qty
RUNTIME ERROR - file: interface\transfer_cannons.c; line: 330
no rAP data
 
Last edited:
I doubt it, I had some more problems with cannons. Tought I had everything woring now, but seems there still is a mistake. Will look at it tonight.
@Tingyun do you have a savegame from before you did the transfer so I can replicate it?
 
Here's my test save. The cannons disappearing when trying to swap happened after seizing a ship, and attempting to press the button to transfer to the taken ship (they were then gone when I exited and reopened the cannon inventory swap screen), so there is no save right before then given it was a post-boarding event, but given the power of the test ship (royal man of war tier 1 with 667 crew) so boarding is an instant win situation to replicate.

The cannons are described as 32lbs, FBLR , and are what the ship started with.
 

Attachments

  • cannons.rar
    510.1 KB · Views: 177
@Levis reproduced the bug.

It happens when you go to the cannon transfer screen after boarding when you have a different caliber cannons than the target ship. If you have a different caliber, even if you don't transfer any, when you exit the screen the game gives you a warning about changing your caliber, and when you say you don't want to, it deletes all your cannons.
 
@Tingyun: Do you still have a game version from prior to the Captain update?
I'd be very curious to find out if this bug existed already two weeks ago.
 
hmmm @Pieter Boelen could indeed be unrelated to the captain code
Could you look into it?
 
@Tingyun could you investigate this?
Please check the topic @Pieter Boelen posted. In there you will see what fix we did. Find that piece of code and use trace() commands to see if that piece of code indeed changes the cannons you have.
 
@Levis I don't have the older version (for reference, but I understand you want me to do something else now). I looked over the other topic, and I'm a bit confused how to do this, probably because I still haven't learned to use trace() commands or to understand what is going on.

I will read up on using trace() and give it a try and report back.
 
trace is very simple.
Code:
trace("Hello World");
Will place a line in the compile.log saying
Hello World
You can add variables to it too like:
Code:
int number = 10;
string text = "Hello";
trace(text+" World I have "+number+" problems!");
This will result in a line saying
Hello World I have 10 problems!

So what I'm asking is find the code which I post here:
Fixed - Ships with no cannons have no calibre in a transfer | PiratesAhoy!

find which function is used to get
myCurQty
Before the code I posted you do something like
Code:
trace("Current QTY me="+myCurQty);

Now after the code in that post you calculate the qty again with the same line and then trace it again.
This way we know if this piece of code is causing the quantity to go to 0 or if it's something else.
 
@Levis I apologize, I got through testing everything else, and then tried figuring this out, failed for a bit, and then my wife declared that I need to stop modding. I have spent around 40 hours this past week working on the various projects, fixes, and tests, and she demanded I spend the weekend playing with her.

This one doesn't seem nearly as urgent as the other bugs with captain generation or cannon errors, so I'm going to set this aside for now. If noone else gets to it before next week, I'll learn the tracing and do it sometime then.

I'll still be around to help test with the captain generation and those constant cannon errors and such more pressing issues in the meantime, since she and I are playing the game together, I just can't do any code editing right now. Marriage. :p
 
For a quick fix, try to revert the cannon transfer interface file to its July state from the latest EXE.
If that solves the problem, at least then we know for sure that was the culprit.
 
@pedrwyth could you maybe help me take a look at this?
Look at post 8 to see what we did before.
 
Just to note I have started to look at this.

Courtesy of @Grey Roger 's Ardent save in another thread :onya I can replicate this easily (Oh the ease and comfort of instant board and god mode).

Here's an example where matched calibre cannons are whisked away if you say NO to a swap (even though you couldn't swap since both ships have a full complement) - they do say a refusal often offends ;)


A full set on each but let's try a swap - can't blame a guy for trying Storm Engine 2 13_10_2016 11_21_41.png

Hmm do I say yes or no Storm Engine 2 13_10_2016 11_21_07.png


Damn wrong choice I guess!! Storm Engine 2 13_10_2016 11_22_30.png

So you can confirm this as bugged

Now to get those traceandlog entries in place and also to check out the previous file just to confirm (or not) whether it is the attempted fix screwing this.
 
Not had much time available to look at this thoroughly enough yet. My initial reaction is that the interface should be reverted to the pre-fix state (ie July) but I need to undertake a much more systematic investigation since there are other problems that crop up - for example the header is cannons dismantling header on normal transfer and one of your companions appears as "unassigned" or occasionally a "dead captain" when you try and transfer between two companion ships until you close the interface. This seems related to the use of a -1 check an equivalent of which saw some discussion/change in the crew interface whilst I was away - so I neeed to consider if the change there could be applied in this case.


For the original report of putting cannons on a ship with none the crux is likely the consistent use of type 31 where no cannons are onboard - just reducing the number to 0 does not do this (it leaves it as zero caliber x cannons)- but the type 31 is used elsewhere as a proxy to skip cannon stuff. However the attempted fix to force a change of type away from 31 on mounting the first cannon does not check against maximum allowed calibre because it skips the yes/no question on exiting the screen where you move the cannons so opens an exploit. Interestingly putting all but one cannon on an empty ship seems to let you go and buy the last one thus setting the caliber (another exploit if you use a small caliber the buy big EDIT no it does seem to charge for the right number of cannons OK ENDEDIT). Ideally type 31 needs to be set once cannons are reduced to a zero total - there is a call available to do this but the transfer cannon interface doesn't always currently check impact on ship totals just arc numbers so I may need to look how this is done in the shipyard inteface (and indeed if individually reducing (negative buying) cannons there down to zero produces the requisite change of cannon type too.

So as oftens seems the case with interfaces a lot going on and not necessarily in a consistent manner from one type of situation to another. Some of these issues have been there since I started with 14 3.4 so I'm taking my time to try and get this right!
 
Last edited:
So as oftens seems the case with interfaces a lot going on and not necessarily in a consistent manner from one type of situation to another. Some of these issues have been there since I started with 14 3.4 so I'm taking my time to try and get this right!
That sounds very wise! :onya

We've gone back and forth on this several times with several quick fixes, none of which actually took care of all the problems.
So I very much appreciate you taking your time. Hopefully once you figure it out, that'll be the last time we ever need to worry about this one! :cheers
 
I've been seeing a lot of this in my "error.log" recently:
Code:
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1509
missed attribute: qty
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1509
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1510
missed attribute: qty
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1510
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1511
missed attribute: qty
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1511
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1512
missed attribute: qty
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 1512
no rAP data
I never got the 7th October update working properly so I'm currently using the 2nd October version. The 7th October versions of those lines are 1528 - 1531:
Code:
     rCharacter.ship.Cannons.Borts.cannonf.curqty = rCharacter.ship.Cannons.Borts.cannonf.qty;
     rCharacter.ship.Cannons.Borts.cannonb.curqty = rCharacter.ship.Cannons.Borts.cannonb.qty;
     rCharacter.ship.Cannons.Borts.cannonl.curqty = rCharacter.ship.Cannons.Borts.cannonl.qty;
     rCharacter.ship.Cannons.Borts.cannonr.curqty = rCharacter.ship.Cannons.Borts.cannonr.qty;
Also, after I captured one particular quest ship, and swapped to it, I saw a flashing barrel icon under the compass, which should have indicated a lack of gunpowder, except that a quick check of the cargo hold showed that the ship did in fact have powder. Trying to compare cannons between this ship and the one from which I was swapping also triggered the disappearing cannon bug.
 
Back
Top