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

Fixed New Dialog_func.c - stops Game Starting/Loading

Talisman

Smuggler
Storm Modder
:ahoy

Installed the new Dialog_func.c file from this post:-

Fixed - Reputation and PcharRepPhrase code | PiratesAhoy!

Now the game will not start :shock

when I try to load the engine I get a Crash to desktop with this in the error log

Code:
COMPILE ERROR - file: dialog_func.c; line: 1967
function GenerateQuestShip(args:2) doesnt accept 4 arguments

logs attached ( no compile log generated )

:drunk
 

Attachments

  • error_dialog.log
    111 bytes · Views: 119
  • system_dialog.log
    239 bytes · Views: 130
That version of "Dialog_func.c" does not have my fix to 'PCharRepPhrase' which replaces the hardcoded and incorrect value 41 with the variable 'REPUTATION_NEUTRAL'. Here's the 7th October version with that change reinstated.

The change is needed because 'PCharRepPhrase' chooses between two supplied string arguments depending on whether your reputation is below a certain point. If that point is the hardcoded 41, which is midway between "Neutral" and "Rascal", then you can be borderline "Rascal" and still get the "good" string. Replacing the 41 with 'REPUTATION_NEUTRAL' means that whatever "Neutral" is defined as in "characters.h", you'll get the "bad" string if your reputation is lower than that.
 

Attachments

  • Dialog_func.c
    94 KB · Views: 134
That version of "Dialog_func.c" does not have my fix to 'PCharRepPhrase' which replaces the hardcoded and incorrect value 41 with the variable 'REPUTATION_NEUTRAL'. Here's the 7th October version with that change reinstated.

Yes it does :yes

this code is identical in both the file in this post:-
Fixed - Reputation and PcharRepPhrase code | PiratesAhoy!

and the file posted by @Grey Roger above - lines 680 -692

Code:
string PCharRepPhrase (string Var1, string Var2)
{
   ref pchar = GetMainCharacter();

   if(makeint(pchar.reputation) < REPUTATION_NEUTRAL)
   {
     return Var2;
   }
   else
   {
     return Var1;
   }
}

The only difference between the 2 files is that lines 876 - 1007 are commented out in the file here:
Fixed - Reputation and PcharRepPhrase code | PiratesAhoy!

while they have been deleted completely in the file posted in Post #3 :type1

I have just tried the file in Post #3 and the same thing still happens - game does not load CTD.

@Grey Roger - it is not connected with your PCharRepPhrase changes :no

@ Levis

with the file in post #3 the error log says :-

Code:
COMPILE ERROR - file: dialog_func.c; line: 1835
function GenerateQuestShip(args:2) doesnt accept 4 arguments

which is the same error as before - different line number because lines in-between have been deleted


The problem seems to be here:-

Code:
void SetCoastalEnemy(string model, string sex, string name, string lastname)
{
   ref Pchar = GetMainCharacter();
   ref rCap1 = CharacterFromID("Coastal_Captain01");

   Group_CreateGroup("Coastal_Guards");
THIS LINE--->>>>   GenerateQuestShip("Enemy_Captain01", 7, 1, GetCurrentLocationNation()); // PB: Use Generic Function //Levis: Set class to be between 7 and 1, might need to be changed for better balance
   SetModelFromID(rCap1, model);
   rCap1.name    = name;
   rCap1.lastname = lastname;
   if(sex=="woman")
   {
     rCap1.sex = sex;
     rCap1.ani ="woman";
   }


@Levis - I am using Beta 4-1 16 May since I have not had time to update since then -( the only thing I have installed is the new dialog_func.c file ) if the problem is purely that I am using an "old" version of the game that is not compatible with the new dialog_func.c file - then I can fix that by just moving @Grey Roger 's changes into an older version of the file that works in my game.

I just reported the CTD in case the problem occurs with more up to date versions of the game than mine. :doff


:drunk
 

Attachments

  • error_dialog2.log
    111 bytes · Views: 112
  • system_dialog2.log
    239 bytes · Views: 112
Did you change your quest_common.c from the one in my version?
This is how the first function should look like:
Code:
void GenerateQuestShip(string captain_id, int maxclass, int minclass, int iNation) // KK
{
    //This function will generate a ship and generate the captain on the given captain_id character
    //You should provide a min and max class for the ship. It doesn't matter if these are reverted by accident, it will be caught.

    //Check if the character is an enemy
    bool isEnemy = false;
    if(captain_id == "Quest pirate" ) isEnemy = true;
    if(captain_id == "Convoy pirate") isEnemy = true;

    //Get the captain which is only half setup
    ref rCaptain = characterFromID(captain_id);
   
    //Determine the nation of the ship etc
    if(isEnemy) iNation = LotHostileNation(iNation);
    else        iNation = iNation;
   
    //Extract the nation and fantomtype from it
    string sFantomType = "war";
    if( iNation >= NATIONS_QUANTITY)    iNation = PIRATE;
    if( iNation == PIRATE)                sFantomType = "pirate";

    //Determine the max and minclass of the ship
    int iShipType;
    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;

    //Make the ship
    iShipType = Force_GetShipType(maxclass, minclass, sFantomType, iNation); //Levis: Also make sure the right fantomtype is set for the ship
   
    //Generate the captain
    if(DEBUG_CAPTAIN_CREATION>1) Trace("CAPTAIN CREATION: In function GenerateQuestShip");
    rCaptain = LAi_Create_Captain(rCaptain, sFantomType, iShipType, iNation); //Levis new function to create a captain
   
    // PB: Have these ships always hostile, regardless of flag
    rCaptain.recognized = true;

    if(captain_id == "Quest pirate")    // PB: For Governor Quest Ships only
    {
        //NK edit trademoney
        ref Shiptype = GetShipByType(iShipType);
        aref arship; makearef(arship, rCaptain.ship);
        ref pchar = GetMainCharacter();
        float shipmult = 5.0 * sqrt(intRet(sti(Shiptype.CannonsQuantity),sti(Shiptype.CannonsQuantity),1) * sti(GetLocalShipAttrib(arship, Shiptype, "HP")) * stf(GetLocalShipAttrib(arship, Shiptype, "SpeedRate"))); // PRS3
        float commult = 1.0 + makeint(CalcCharacterSkill(pchar, SKILL_COMMERCE))/20.0;

        int iTradeMoney = makeint(sqrt(sti(rCaptain.rank)) * shipmult * commult/25)*25;
        if(iTradeMoney < 100) iTradeMoney = 100;

        pchar.quest.generate_kill_quest = "begin";
        pchar.quest.generate_kill_quest.money = iTradeMoney;
        pchar.quest.generate_kill_quest.town = GetCurrentTownID();//MAXIMUS
        pchar.quest.generate_kill_quest.destination = Islands[GetCharacterCurrentIsland(Pchar)].id;
        pchar.quest.generate_kill_quest.nation = iNation; // KK // MAXIMUS
        pchar.quest.generate_kill_quest.shipname = rCaptain.Ship.Name;
    }
}
 
@Levis

I am using quest_common.c dated 16/5/2016 - see attached ( I have not made any changes to it) - it is different from yours. :yes

So the problem is as I said above

- I am using Beta 4-1 16 May since I have not had time to update since then -( the only thing I have installed is the new dialog_func.c file ) if the problem is purely that I am using an "old" version of the game that is not compatible with the new dialog_func.c file - then I can fix that by just moving @Grey Roger 's changes into an older version of the file that works in my game.

So I can get round that easily enough - no problem - Thanks for the help.

:type1
 

Attachments

  • quests_common.c
    217 KB · Views: 127
ah, the file posted by @Grey Roger needs my fixes. a certain function is changed. thats why it isn't working for you.
SO either don't install the fix or update or use winmerge to only change what you need
 
Something very odd is going on. I downloaded @Levis' fixes - both the first one released today ("Levis-Fixes_7_10.zip") and the later one ("Levis-Fixes_7-10b.zip"). In both cases, if I extract "Dialog_func.c", it has the old line 'if(makeint(pchar.reputation) < 41)'. The file I posted in #3 in this thread is the one from "Levis-Fixes_7_10.zip", in which I replaced the reputation line.

@Levis: have you in fact replaced the line in 'PCharRepPhrase' with my new one? If yes, how am I getting the old line from your update; if no, how is @Talisman getting the updated line?
 
Back
Top