In AIShip, there is a ship generation function that uses the player's ship tier, and caps the AI ship generated at 1 bigger or smaller than that.
When I was debugging perks and staring at compile logs, I noticed that ships were being generated within this +1 -1 tier range, so very possibly it was this function (or another like it). This was just sitting in town, not starting quests, so I'm assuming it was some normal ship. Or was it instead some quest ship that I wasn't aware of? I hadn't started any quests, but maybe one was around from some means I am unaware of.
Or maybe make it somehow dependent on the GetShipCap() setting from internal settings, like elsewhere? This one seems to bypass that setting, which seems odd.
Here is the lines I am speaking of, and the full code below:
rCharacter.ship.type = GetShipID(Force_GetShipType(GetCharacterShipClass(GetMainCharacter()) - 1, GetCharacterShipClass(GetMainCharacter()) +1, ftype, sti(rCharacter.nation)));
When I was debugging perks and staring at compile logs, I noticed that ships were being generated within this +1 -1 tier range, so very possibly it was this function (or another like it). This was just sitting in town, not starting quests, so I'm assuming it was some normal ship. Or was it instead some quest ship that I wasn't aware of? I hadn't started any quests, but maybe one was around from some means I am unaware of.
Or maybe make it somehow dependent on the GetShipCap() setting from internal settings, like elsewhere? This one seems to bypass that setting, which seems odd.
Here is the lines I am speaking of, and the full code below:
rCharacter.ship.type = GetShipID(Force_GetShipType(GetCharacterShipClass(GetMainCharacter()) - 1, GetCharacterShipClass(GetMainCharacter()) +1, ftype, sti(rCharacter.nation)));
Code:
void Ship_Add2Sea(int iCharacterIndex, bool bFromCoast, string sFantomType)
{
if (iCharacterIndex<0) return;
ref rCharacter = GetCharacter(iCharacterIndex);
if (CharacterIsDead(rCharacter))
{
TraceAndLog("Ship_Add2Sea ERROR: Please post your compile.log file at piratesahoy.net!");
Trace("Trying to log in dead captain:");
DumpAttributes(rCharacter);
return;
}
aref arCharacter; makearef(arCharacter, Characters[sti(rCharacter.
index)]);
DeleteAttribute(arCharacter,"skillsnatmult"); // NK PRS3 04-09-15 as lookup to speed up national skill mult
DeleteAttribute(arCharacter,"ship.changedammo"); // NK 04-09-15 clears "we already changed ammo this round" attribute
DeleteAttribute(arCharacter,"ship.lasttgt"); // NK 04-09-16 clears "we last fired on this char idx" attribute
DeleteAttribute(arCharacter,"ship.attackpcharset"); // NK 04-09-16 clears "we're already set to attack pchar" attribute
DeleteAttribute(arCharacter,"seatime"); // NK 04-09-16 deletes seatime tree
DeleteAttribute(arCharacter,"surrendered"); // NK surrender 05-04-20
DeleteAttribute(arCharacter,"oldnation");
// KK -->
DeleteAttribute(arCharacter, "nation.known");
DeleteAttribute(arCharacter, "unknownShip");
// <-- KK
if (iCharacterIndex == GetMainCharacterIndex()) { // NK 04-09-16 clears timer attribute, -21 for updatetime
rCharacter.seatime = 0;
rCharacter.lastupdateseatime = 0;
}
//trace("starting sa2s for " + rCharacter.id + " and prev numships " + iNumShips+ ", did delete attr");
int iShipType = GetCharacterShipType(rCharacter); // PS
if (iShipType < 0 || iShipType >= SHIP_TYPES_QUANTITY_WITH_FORT)
{
Trace("Character.id = " + rCharacter.id + ", have invalid ship type = " + iShipType + ", and try load to sea");
//return; // NK 04-09-12 fix so you never crash on bad ship type. -->
if(!LAi_IsDead(rCharacter))
{
if(DEBUG_CAPTAIN_CREATION>1) Trace("CAPTAIN CREATION: Resetting stuff for "+rCharacter.id+" because it isn't dead");
if(sti(rCharacter.nation) == PIRATE) rCharacter.fantomtype = "pirate"; //SCREWFACE : PIRATE is a nation - type is "pirate";
string ftype = "war"; if(CheckAttribute(rCharacter,"fantomtype")) ftype = rCharacter.fantomtype;
rCharacter.ship.type = GetShipID(Force_GetShipType(GetCharacterShipClass(GetMainCharacter()) - 1, GetCharacterShipClass(GetMainCharacter()) +1, ftype, sti(rCharacter.nation)));
iShipType = GetCharacterShipType(rCharacter);
LAi_Create_Officer(0, rCharacter); // NK
Fantom_SetRandomMoney(rCharacter, ftype);
Fantom_SetCannons(rCharacter, ftype);
Fantom_SetSails(rCharacter, ftype);
}
// NK <--
}
Last edited: