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

Mod Release Gentlemen Of Fortune 2.1.5 mod development

Change that to:
Code:
if(findSubStr("xyzzy", "yz", 0) != -1) trace("findSubStr works");
It will probably still complain, but hopefully it will complain about a different line number.

The problem is that function "HasSubStr" doesn't seem to exist in CoAS either. The definition in PoTC is just a single line. The above code has simply replaced the call on "HasSubStr" with a call on "findSubStr", which had better exist otherwise this is going to be very difficult...
I have changed to findsubstr all the "hassubstr" and looks like it solved it. so far the game doesnt have any other issues with AIShips
Yet I am going further to battleinterface, as there are plenty of things to catch.

Thank you!

and see you around
 
Change that to:
Code:
if(findSubStr("xyzzy", "yz", 0) != -1) trace("findSubStr works");
It will probably still complain, but hopefully it will complain about a different line number.

The problem is that function "HasSubStr" doesn't seem to exist in CoAS either. The definition in PoTC is just a single line. The above code has simply replaced the call on "HasSubStr" with a call on "findSubStr", which had better exist otherwise this is going to be very difficult...

SO I launched the game. the game works, but once I am aboard on Dutchman it begins to freeze for 1 second, then unfreeze for 2 secs. that goes in a loop.
Now I got this error.log

RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3338
function 'findSubStr' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
missed attribute: correctimmersion
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3348
no rAP data
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
Invalid string argument
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 3350
function 'findSubStr' stack error
 
What is line 3338? And if those extra lines which I suggested in post #194 are still there, could you post file "compile.log"?

You don't need to copy and paste the whole file. You can attach the file. Use the "Upload a File" button, just to the right of the "Post Reply" button.
 
What is line 3338? And if those extra lines which I suggested in post #194 are still there, could you post file "compile.log"?

You don't need to copy and paste the whole file. You can attach the file. Use the "Upload a File" button, just to the right of the "Post Reply" button.

XD sry mate, no intention to spam.

if(findSubStr(GetAttribute(rCharacter, "ship.type"), "Dutchman") && CheckAttribute(arCharShip, "SubmergeDutchman")) // Submerging Ability - line 3338

and attached compile.log
 

Attachments

  • compile.log
    5.4 KB · Views: 471
The test lines are showing this in "compile.log":
Code:
findSubStr works
GetAttribute test: 36
CheckAttribute false
The first line came from 'if(findSubStr("xyzzy", "yz", 0) != -1) trace("findSubStr works");' and the fact it didn't crash the game with an error message right away means function "findSubStr" does exist.
The third line shows that 'CheckAttribute(arCharShip, "SubmergeDutchman")' is false, so whatever "arCharShip" is, it does not have the attribute "SubmergeDutchman". That's not too surprising; if the game is going berserk right when you board the ship then you haven't had time to submerge it.

The second line is the one which is worrying. That came from 'trace("GetAttribute test: " + GetAttribute(rCharacter, "ship.type"));'. It means that 'GetAttribute(rCharacter, "ship.type")' is returning number 36, not a type of ship. Are you sure you copied the definition of function "GetAttribute" correctly?

In any case, I suspect you're about to suffer again from not having the file "NK.c". This is because if you've copied the whole section about submerging the Dutchman from the PoTC version of "AIShip.c" then you probably have this line somewhere:
Code:
PostEvent("UpdateDutchmanSubmersion", delay, "i", rCharacter);
And the event handler for "UpdateDutchmanSubmersion" is in "NK.c".
 
if(findSubStr(GetAttribute(rCharacter, "ship.type"), "Dutchman") && CheckAttribute(arCharShip, "SubmergeDutchman")) // Submerging Ability - line 3338

A couple things to note:

New Horizons ship.type attributes are strings, so findSubStr will actually be looking for "Dutchman" in a ship.type that actually contains some sort string (e.g. "CursedDutchman"). GOF ship.types are actually integers. Though the game script code is malleable in that respect (i.e. if you set .ship.type = 1, then later assign string str = ship.type, you will get a "1" string), your findSubStr will never find such a "Dutchman" substring for any GOF ship.

Next, findSubStr will return a -1 when it can't find a matching portion, and an if(-1) is always true, which I am sure is not your intent. For an if statement to be determined as false, it must be a zero; anything other than zero, will execute the true block.
 
Well spotted on "findSubStr"! I should have noticed that as well. That line should actually be:
Code:
if(findSubStr(GetAttribute(rCharacter, "ship.type"), "Dutchman", 0) != -1 && CheckAttribute(arCharShip, "SubmergeDutchman"))
Except, of course, that still won't work because 'GetAttribute(rCharacter, "ship.type")' is returning "36" instead of "CursedDutchman". But it would certainly explain why the game is complaining about that line. (And, presumably, a similarly wrong line 3350.)

Is there a function which takes the number and produces the ship's type as a string? Or, for that matter, a function which goes the other way and gives the number for a string such as "CursedDutchman"?
 
Well spotted on "findSubStr"! I should have noticed that as well. That line should actually be:
Code:
if(findSubStr(GetAttribute(rCharacter, "ship.type"), "Dutchman", 0) != -1 && CheckAttribute(arCharShip, "SubmergeDutchman"))
Except, of course, that still won't work because 'GetAttribute(rCharacter, "ship.type")' is returning "36" instead of "CursedDutchman". But it would certainly explain why the game is complaining about that line. (And, presumably, a similarly wrong line 3350.)

Is there a function which takes the number and produces the ship's type as a string? Or, for that matter, a function which goes the other way and gives the number for a string such as "CursedDutchman"?

There is a ship.BaseName, which will contain that string, but it seems simpler and more efficient to just use the ship.type since they are coded with intuitively named constants in ships.h. I would change to this:

if(sti(rCharacter.ship.type) == SHIP_CURSEDDUTCHMAN && CheckAttribute(arCharShip, "SubmergeDutchman"))

Or, if both SHIP_CURSEDDUTCHMAN and SHIP_FLYINGDUTCHMAN are to be eligible:

bool isDutchman = (sti(rCharacter.ship.type) == SHIP_CURSEDDUTCHMAN || sti(rCharacter.ship.type) == SHIP_FLYINGDUTCHMAN);
if(isDutchman && CheckAttribute(arCharShip, "SubmergeDutchman"))

ETA: Upon rereading, I suppose if you want to get technical, change the wording, "constants," to "preprocessors"...but you get the gist, LOL
 
Last edited:
There is a ship.BaseName, which will contain that string, but it seems simpler and more efficient to just use the ship.type since they are coded with intuitively named constants in ships.h. I would change to this:

if(sti(rCharacter.ship.type) == SHIP_CURSEDDUTCHMAN && CheckAttribute(arCharShip, "SubmergeDutchman"))

Or, if both SHIP_CURSEDDUTCHMAN and SHIP_FLYINGDUTCHMAN are to be eligible:

bool isDutchman = (sti(rCharacter.ship.type) == SHIP_CURSEDDUTCHMAN || sti(rCharacter.ship.type) == SHIP_FLYINGDUTCHMAN);
if(isDutchman && CheckAttribute(arCharShip, "SubmergeDutchman"))

ETA: Upon rereading, I suppose if you want to get technical, change the wording, "constants," to "preprocessors"...but you get the gist, LOL
The test lines are showing this in "compile.log":
Code:
findSubStr works
GetAttribute test: 36
CheckAttribute false
The first line came from 'if(findSubStr("xyzzy", "yz", 0) != -1) trace("findSubStr works");' and the fact it didn't crash the game with an error message right away means function "findSubStr" does exist.
The third line shows that 'CheckAttribute(arCharShip, "SubmergeDutchman")' is false, so whatever "arCharShip" is, it does not have the attribute "SubmergeDutchman". That's not too surprising; if the game is going berserk right when you board the ship then you haven't had time to submerge it.

The second line is the one which is worrying. That came from 'trace("GetAttribute test: " + GetAttribute(rCharacter, "ship.type"));'. It means that 'GetAttribute(rCharacter, "ship.type")' is returning number 36, not a type of ship. Are you sure you copied the definition of function "GetAttribute" correctly?

In any case, I suspect you're about to suffer again from not having the file "NK.c". This is because if you've copied the whole section about submerging the Dutchman from the PoTC version of "AIShip.c" then you probably have this line somewhere:
Code:
PostEvent("UpdateDutchmanSubmersion", delay, "i", rCharacter);
And the event handler for "UpdateDutchmanSubmersion" is in "NK.c".


I actually have the NK.c file ported for AOP2, yet inside is only the code for Submerge and Emerge events. but reading the last several comments left me speechless, since I understood that I know 1% of the C++ hahaha
 
Last edited:
I actually have the NK.c file ported for AOP2, yet inside is only the code for Submerge and Emerge events. but reading the last several comments left me speechless, since I understood that I know 1% of the C++ hahaha
Aim for 2% next week and you'll be fine! :cheers
 
I actually have the NK.c file ported for AOP2, yet inside is only the code for Submerge and Emerge events. but reading the last several comments left me speechless, since I understood that I know 1% of the C++ hahaha

Needed a slight change from what I suggested...you need "realship" instead.

Make sure seadogs.c has this:

#include "NK.c"

Attached are two files: NK.c and AIShip.c

I put this in console.c, loaded a game in GOF 2.1.5, pressed F4, went to sea and it worked:

Code:
ref pchar = GetMainCharacter();
pchar.Ship.Type = GenerateShip(SHIP_FLYINGDUTCHMAN, 0);
pchar.Ship.SubmergeDutchman = true;
Log_SetStringToLog("Executed Console");

You will still have some problems. GOF has no particle effect, dutchman_submerge. Also, the particle system is different in POTC than for COAS, and they are incompatible. Also missing a sound, take_prey.wav, but that is easy to copy over.
 

Attachments

  • NK.c
    18.2 KB · Views: 458
  • AIShip.c
    145.9 KB · Views: 462
I actually have the NK.c file ported for AOP2, yet inside is only the code for Submerge and Emerge events. but reading the last several comments left me speechless, since I understood that I know 1% of the C++ hahaha
The important bit is, remove this line:
Code:
if(findSubStr(GetAttribute(rCharacter, "ship.type"), "Dutchman") && CheckAttribute(arCharShip, "SubmergeDutchman"))
And replace it with what @ChezJfrey wrote:
Code:
bool isDutchman = (sti(rCharacter.ship.type) == SHIP_CURSEDDUTCHMAN || sti(rCharacter.ship.type) == SHIP_FLYINGDUTCHMAN);
if(isDutchman && CheckAttribute(arCharShip, "SubmergeDutchman"))
That ought to set up the condition so that both the cursed and uncursed Flying Dutchman can submerge, meaning you can dive whether you're Davy Jones or Will Turner.

You can also remove these lines:
Code:
if(findSubStr("xyzzy", "yz", 0) != -1) trace("findSubStr works");
trace("GetAttribute test: " + GetAttribute(rCharacter, "ship.type"));
if(CheckAttribute(arCharShip, "SubmergeDutchman")) trace("CheckAttribute true");
else trace("CheckAttribute false");
They were to help figure out what was going wrong earlier and should no longer be needed.

Edit: or alternatively, just use the files which @ChezJfrey was posting while I was typing that. xD
 
@Grey Roger

Turned out the internal compiler was a bit finicky about the statement:

bool isDutchman = (sti(rCharacter.ship.type) == SHIP_CURSEDDUTCHMAN || sti(rCharacter.ship.type) == SHIP_FLYINGDUTCHMAN);

Complained of missing ")" and though that is technically correct, I had to remove the outer parens:

bool isDutchman = sti(rCharacter.ship.type) == SHIP_CURSEDDUTCHMAN || sti(rCharacter.ship.type) == SHIP_FLYINGDUTCHMAN;

Also, rCharacter.ship.type is different in GOF (had forgotten that difference, until I debugged/traced the incorrect results); in COAS, that is actually an index for a "realship" array that is a new construct in the COAS scripts, and was was needed was a ref to that object index (using the ship.type value). They were small changes, but rather than confuse the OP with more code posted in this thread that has been going different places/back-forth, it just seemed simpler to attach the files and OP can just look at those same areas of code we've been discussing to see what was done.
 
The Mod option (along with the RTBL) keeps resiting to default. Is there any fix for that?
Do you mean that your settings keep changing back?
All I can think of is Windows Security Stupidity because of "Program Files"; that has been known to cause stuff like that at times.
You could try reinstalling the game to a different folder that is less prone to excessive security...
 
I am testing the Mod individually. So far the Retroactive Perk mode works for only Dynamo and NOT for Tree of Life. Tested it first without taking the perks from rank 1 and then taking them at rank 1. Dynamo works fine for Retroactive mod (testing with all P.I.R.A.T.E.S at 10). Taking the tree of life at Rank 1 gives max health at 530 whereas taking them at the end after maxing all skills to 100 gives max health at 480.

Quick question: Is max Ranking always 51 ? Or can it increase after maxing all the skills (like destroying fort gives 600+ experience)?

P.S: The new compass and the default compass both lacks the cannon range ui. So zooming in/out with E and F key is useless (unless this is intentionally done for realism).

The default RTBL mod settings can be set in mod_on_off file. (ignore this line, just rambling on my noob discovery hehe)
 
Last edited:
Ahoy,

I can confirm what Anubis said about tree of life, same in my new game.
Also i think that realistic cannon reloading option affects only player, not the enemy ships. I was board to board with MERCHANT barque, with same caliber cannons(8pounders) she was able to fire 2,5 times faster than me.
Crew on both mine and the merchant ship was similiar, something like 80% so it was not the case. I can't be sure about captain skills and crew experience but as I said it was merchant not a warship. Difficulty level is impossible if that matters.
After turning off the option i was firing with smiliar rate as the bounty hunter ship
 
Hi @Gunnar,
I'm not sure if there's still anyone around on this forum who does anything with Gentlemen of Fortune.
The most recent person I remember hasn't been seen in over a month either...
 
Back
Top