• 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] Generate Quest Ship Logic Error

Now I have another Governors Quest with this message again:
ERROR - Force_GetShipType: unable to find ship, returning a default ship instead
ERROR - Force_GetShipType: Maxclass = 1, Minclass = 3, Per = Golden Age of Piracy, Nat = Pirate, Type = War
 

Attachments

  • compile.log
    102.8 KB · Views: 179
Yup it's a confirmed bug. I hope to fix it this weekend
 
@Levis I might have a chance to play some tomorrow, is it safe to take quests that involve ships right now? Beyond the captain not being quite right, would it mess up the game or not allow completion of the quest or something?

Just wondering whether I should avoid these quests for now, or if they are safe to do despite the error. :)

Thanks so much for the advice!
EDIT: Well now just got a call about work...there goes playing for now. :(
 
Last edited:
I don't imagine this should break anything.
It just doesn't work the way it is meant to.

Actually, it should be quite easy to get this sorted out properly, I think:
- Move the min/max class to the function call itself
- Change all calls to the function to something appropriate; got the governor quests it can just be fixed as 7 and 1
- Move the period check to inside tyke Force Get Ship Type function
- Reverse the code so it doesn't look at the wrong captain's skills anymore at all (no longer needed anyway)
- Change that "pirate" check to use iNation instead of checking the captain nation (should end up being the same anyway)
 
@Levis: I don't have time to check everything, so these are just some short, random comments:

Code:
    case "kill_pirate":
       minclass = 7; //We won't encounter pirates in a dinghy
       maxclass = 2; //Let's just see how this will turn out :).
       GenerateQuestShip("Quest pirate", maxclass, minclass, iNation); // PB: Use Generic Function
There was a desire from some players for Tier 1 ships to show up as well, so you may want to consider changing this to 'maxclass = 1'.

Code:
  if(sti(rCaptain.nation) == PIRATE  && maxclass < MAXPIRATECLASS)       maxclass = MAXPIRATECLASS;
   if(HasSubStr(character_id,"Coastal_Captain") && maxclass < MAXCOASTGUARDCLASS)     maxclass = MAXCOASTGUARDCLASS;
   if(GetCurrentPeriod() <= PERIOD_EARLY_EXPLORERS || GetCurrentPeriod() >= PERIOD_NAPOLEONIC)
   {
     if(iNation == HOLLAND  && maxclass < 3)             maxclass = 3;
     if(iNation == PORTUGAL  && maxclass < 3)             maxclass = 3;
   }
This whole section is now commented out and, as far as I can tell, it is not replicated elsewhere.
These are important to keep though, since ships exceeding those tiers for those nations simply don't exist,
so the game would end up searching for something that isn't there to be found.

I think both the pirate and the Holland/Portugal period check could be included in the 'Force_GetShipType' function itself.
Then at least it would only be in one central spot.

Code:
int GetCoastGuardShipMaxClass()
{
   ref pchar = getMainCharacter();
   ref sIsland = GetIslandByIndex(sti(pchar.quest.Contraband.islandindex));
   int sState = getSmugglingState(sIsland); //state can be between 0 and 4
   //the minclass of the coastguard ships will be 6 so they are a bit challenging. We just substract the smuggling state from 5 to get the max class.
   //this way you have a higher chance of higher ships on a higher state
   return 5-sState;
}
Is the 'MAXCOASTGUARDCLASS' variable still used at all?
 
@Levis: I don't have time to check everything, so these are just some short, random comments:

Code:
    case "kill_pirate":
       minclass = 7; //We won't encounter pirates in a dinghy
       maxclass = 2; //Let's just see how this will turn out :).
       GenerateQuestShip("Quest pirate", maxclass, minclass, iNation); // PB: Use Generic Function
There was a desire from some players for Tier 1 ships to show up as well, so you may want to consider changing this to 'maxclass = 1'.

For now I would like to test it like this just to see how the distribution is. Probably the Tier1 will be a "special case". I was thinking of only enabling that at a certain level (not to high) and have it be a bit more interesting. Those high battle should have some extra care probably. If I can't find the time to do that I will just change it to 1.

Code:
  if(sti(rCaptain.nation) == PIRATE  && maxclass < MAXPIRATECLASS)       maxclass = MAXPIRATECLASS;
   if(HasSubStr(character_id,"Coastal_Captain") && maxclass < MAXCOASTGUARDCLASS)     maxclass = MAXCOASTGUARDCLASS;
   if(GetCurrentPeriod() <= PERIOD_EARLY_EXPLORERS || GetCurrentPeriod() >= PERIOD_NAPOLEONIC)
   {
     if(iNation == HOLLAND  && maxclass < 3)             maxclass = 3;
     if(iNation == PORTUGAL  && maxclass < 3)             maxclass = 3;
   }
This whole section is now commented out and, as far as I can tell, it is not replicated elsewhere.
These are important to keep though, since ships exceeding those tiers for those nations simply don't exist,
so the game would end up searching for something that isn't there to be found.

I think both the pirate and the Holland/Portugal period check could be included in the 'Force_GetShipType' function itself.
Then at least it would only be in one central spot.
Oh right I misread it a bit... I agree it should be in force_getShipType. Will add that in the next update I'm going to make. For now it will just default to something else if this is the case.

Code:
int GetCoastGuardShipMaxClass()
{
   ref pchar = getMainCharacter();
   ref sIsland = GetIslandByIndex(sti(pchar.quest.Contraband.islandindex));
   int sState = getSmugglingState(sIsland); //state can be between 0 and 4
   //the minclass of the coastguard ships will be 6 so they are a bit challenging. We just substract the smuggling state from 5 to get the max class.
   //this way you have a higher chance of higher ships on a higher state
   return 5-sState;
}
Is the 'MAXCOASTGUARDCLASS' variable still used at all?
Nope :aar
 
Oh right I misread it a bit... I agree it should be in force_getShipType. Will add that in the next update I'm going to make. For now it will just default to something else if this is the case.
In that case, the bug from the opening post remains.
Not game breaking, though.
 
Should be fixed in here:
Mod Release - Levis' Stuff [October 2nd] | PiratesAhoy!

For now just put this back in the questship code:
Code:
if(sti(rCaptain.nation) == PIRATE             && maxclass < MAXPIRATECLASS)            maxclass = MAXPIRATECLASS;
    if(HasSubStr(captain_id,"Coastal_Captain") && maxclass < MAXCOASTGUARDCLASS)        maxclass = MAXCOASTGUARDCLASS;
    if(GetCurrentPeriod() <= PERIOD_EARLY_EXPLORERS || GetCurrentPeriod() >= PERIOD_NAPOLEONIC)
    {
        if(iNation == HOLLAND        && maxclass < 3)                        maxclass = 3;
        if(iNation == PORTUGAL       && maxclass < 3)                        maxclass = 3;
    }
    if(minclass > 8)    minclass = 8;

and changed the govenor min/max to this:

Code:
minclass = round( 8.0 * ( 1.0 - ( makefloat(GetRank(pchar, iNation)) / makefloat(GetNationRankQuantity(iNation)) ) ) ); //Depending on your rank you will get less easy challenges
            maxclass = 1; //Let's just see how this will turn out :).
            GenerateQuestShip("Quest pirate", maxclass, minclass, iNation); // PB: Use Generic Function
 
In maximus function file, there is a generation of ship for pirates that places a max class at 3, when pirates only have at most a max class of tier 4.

Suggest either changing to 4, or changing to the internal settings define for max pirate class:
MAXPIRATECLASS

Here is the one to be changed:
GenerateQuestShip("Treasure Pirate", 6, 3, PIRATE); // PB: Use Generic Function //Levis: The pirate you'll encounter wont be the best ever but could be quit challenging untill late game. TODO: Maybe add a loop here so more pirates can be generated if you are really unlucky
 
Maybe you can add that pirates occasionally have real warships from the navy at a certain level or, if you want it independent from level, at a certain time passed ingame (e.g. 1 year)?
 
@Pillat if you'd like that you might make a new build beta and brainstorming post for people to discuss it thoroughly, this bug report is just a housekeeping issue of getting the formula to use the MAXPIRATECLASS define. Just to keep everything ordered so your ideas don't get lost. :)
 
Last edited:
It MUST use the #define. That particular one is not optional.
Pirates don't have any valid ship types defined higher than that so if the game tries to find any, it will fail and you'll get one of those failsafe default ships.
Which is intended to not ever happen.
 
@ANSEL Did you do any ship hunting quests? I believe we can call this fixed right?
 
I thought we wanted to put that Holland/Portugal/Pirate check inside 'Force_GetShipType' instead?
That should be quite easy to do, right?
 
@ANSEL Did you do any ship hunting quests? I believe we can call this fixed right?
Yesterday I saw that "Force_GetShipType" message again, in the pirate leaders quest.
Playing as a pirate I stumbled over this:
ItemLogic -> randItem draw: no model for item Pirate_Fort.smugglingbook2?
 
Yesterday I saw that "Force_GetShipType" message again, in the pirate leaders quest.
If you see it again, could you please post your compile.log file?
That will contain some details about the exact circumstances.

Playing as a pirate I stumbled over this:
ItemLogic -> randItem draw: no model for item Pirate_Fort.smugglingbook2?
I think that's not a problem. Just the game code being "a bit too proactive".
It makes an attempt to render a 3D model that doesn't exist.
 
In maximus function file, there is a generation of ship for pirates that places a max class at 3, when pirates only have at most a max class of tier 4.

Suggest either changing to 4, or changing to the internal settings define for max pirate class:
MAXPIRATECLASS

Here is the one to be changed:
GenerateQuestShip("Treasure Pirate", 6, 3, PIRATE); // PB: Use Generic Function //Levis: The pirate you'll encounter wont be the best ever but could be quit challenging untill late game. TODO: Maybe add a loop here so more pirates can be generated if you are really unlucky
This is probably the reason for the messages @ANSEL sees
 
Back
Top