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

WIP Improvements to Smuggling.

@DeathDaisy cant test it myself now but could you try this?
call this trough the console:
Code:
 NPChar = characterFromID(PChar.quest.Contraband.officerID);
           ChangeCharacterAddressGroup(NPChar,"none","",""); //We don't have to see him anymore

does that make the character dissapair?
nay, it gives "ERROR - Missing Character ID: error". I was thinking maybe that was the problem in quest_common too, but it doesnt give any errors and the officer does go to the door, so it obv knows who the character is
NEVERMIND I GOOFED. give me another minute to try again

alright, tried again. it doesnt give any errors, but the officer still doesnt disappear
 
hmmm....weird.
if @Grey Roger or @Jack Rackham don't have any other ideas please make a bug tracker issue for it and I will look at it later.
 
Could it be that you have

after

?

And/or that you have to use

to get rid of him. (As he was an officer)

it happens both
Code:
 RemovePassenger(PChar, NPChar);
           NPChar.StoredFellow = True;
           if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" as officer");
           LAi_SetActorType(NPChar);
           LAi_ActorRunToLocation(characterFromID(PChar.quest.Contraband.officerID),"reload","reload1", "none", "", "", "",40.0);

I think it's because of the storedfellow. this is used to make sure the officer information isn't removed (it could be a random officer). but this might prevent it from being removed?
 
Could it be that you have

after

?
shouldnt be.. I moved it there as a test, the bug existed before :( but can try it nonetheless

And/or that you have to use

to get rid of him. (As he was an officer)
it happens both
Code:
 RemovePassenger(PChar, NPChar);
           NPChar.StoredFellow = True;
           if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" as officer");
           LAi_SetActorType(NPChar);
           LAi_ActorRunToLocation(characterFromID(PChar.quest.Contraband.officerID),"reload","reload1", "none", "", "", "",40.0);

I think it's because of the storedfellow. this is used to make sure the officer information isn't removed (it could be a random officer). but this might prevent it from being removed?
dont know quite how those funcs work. what would be an alternative to make sure they arent lost in time and space?

EDIT: moving LAi_SetOfficerType(NPChar); first again made it so they dont stop at the door, they run there then they turn around and follow me around again until I leave
 
Last edited:
shouldnt be.. I moved it there as a test, the bug existed before :( but can try it nonetheless



dont know quite how those funcs work. what would be an alternative to make sure they arent lost in time and space?

EDIT: moving LAi_SetOfficerType(NPChar); first again made it so they dont stop at the door, they run there then they turn around and follow me around again until I leave
Could you comment out the line NPChar.StoredfFewllow = true and try it again?
 
Could you run the scenario again and then post "compile.log"? And, if it exists, "error.log".
 
Another problem. After I've done a smuggling run, there's a message in "error.log":
Code:
RUNTIME ERROR - file: smuggling.c; line: 1263
Invalid function code in DelEventHandler
Line 1263 is this:
Code:
DelEventHandler("PauseCoastGuardCheck","PauseCoastGuardCheck");
There's no other mention of "PauseCoastGuardCheck". My version of "smuggling.c" is dated 15/11/2017 - is there a later version which uses "PauseCoastGuardCheck"?
 
Another problem. After I've done a smuggling run, there's a message in "error.log":
Code:
RUNTIME ERROR - file: smuggling.c; line: 1263
Invalid function code in DelEventHandler
Line 1263 is this:
Code:
DelEventHandler("PauseCoastGuardCheck","PauseCoastGuardCheck");
There's no other mention of "PauseCoastGuardCheck". My version of "smuggling.c" is dated 15/11/2017 - is there a later version which uses "PauseCoastGuardCheck"?
I tink @DeathDaisy forgot to remove that ;).
 
Could you run the scenario again and then post "compile.log"? And, if it exists, "error.log".
yeah no problem! attaching the compile.log, no error log to be seen
Another problem. After I've done a smuggling run, there's a message in "error.log":
Code:
RUNTIME ERROR - file: smuggling.c; line: 1263
Invalid function code in DelEventHandler
Line 1263 is this:
Code:
DelEventHandler("PauseCoastGuardCheck","PauseCoastGuardCheck");
There's no other mention of "PauseCoastGuardCheck". My version of "smuggling.c" is dated 15/11/2017 - is there a later version which uses "PauseCoastGuardCheck"?
I tink @DeathDaisy forgot to remove that ;).
yeah :oops: I used that function before to pause the coast guard check during conversation. Ive since removed the function but forgot that part :eek:
 

Attachments

  • compile.log
    27.5 KB · Views: 146
Here's the end of that log:
Code:
Free Random Officer IDX is 1486 and he has id  Enc_Officer_0
Template <follow> -> path not found chr.id = Enc_Officer_0
Quest name LandEnc_OfficerHired FOUND in CommonQuestComplete
Quest name LandEnc_OfficerJoined FOUND in CommonQuestComplete
SMUGGLING removed Enc_Officer_0 as officer
Quest name Send Officer to scout FOUND in CommonQuestComplete
SMUGGLING removed Enc_Officer_0 from location
SMUGGLING timer set 1 day later
Quest name Send Officer Gone FOUND in CommonQuestComplete
Did you just hire some random officer so you could use him as an expendable scout? Because if not, why is it calling the code to hire an officer?

In any case, it certainly does call "Send Officer Gone".

If the character is still an officer and that 'LAi_SetOfficerType(NPChar);' line is still there, he may not disappear. Try commenting that out, and also add this:
Code:
RemoveOfficersIndex(pchar, GetCharacterIndex(NPChar.id));
That, not 'RemovePassenger', is what stops him from being an active officer. 'RemovePassenger' removes him from the passengers list on your ship, so it wouldn't do any harm to do that as well - it prevents the player from sneakily adding the scout back as an officer before the 1 day delay is up.
 
Here's the end of that log:
Code:
Free Random Officer IDX is 1486 and he has id  Enc_Officer_0
Template <follow> -> path not found chr.id = Enc_Officer_0
Quest name LandEnc_OfficerHired FOUND in CommonQuestComplete
Quest name LandEnc_OfficerJoined FOUND in CommonQuestComplete
SMUGGLING removed Enc_Officer_0 as officer
Quest name Send Officer to scout FOUND in CommonQuestComplete
SMUGGLING removed Enc_Officer_0 from location
SMUGGLING timer set 1 day later
Quest name Send Officer Gone FOUND in CommonQuestComplete
Did you just hire some random officer so you could use him as an expendable scout? Because if not, why is it calling the code to hire an officer?

In any case, it certainly does call "Send Officer Gone".

If the character is still an officer and that 'LAi_SetOfficerType(NPChar);' line is still there, he may not disappear. Try commenting that out, and also add this:
Code:
RemoveOfficersIndex(pchar, GetCharacterIndex(NPChar.id));
That, not 'RemovePassenger', is what stops him from being an active officer. 'RemovePassenger' removes him from the passengers list on your ship, so it wouldn't do any harm to do that as well - it prevents the player from sneakily adding the scout back as an officer before the 1 day delay is up.
I did indeed just hire a random officer just before :p

still the same thing :( walks up to the door, then just stands there. got an error.log this time; it doesnt seem related to the refusal to disappear at the door, but I lost the first officer I sent and its maybe related to that?

it makes no seeeense :modding
 

Attachments

  • compile.log
    28.5 KB · Views: 161
  • error.log
    593 bytes · Views: 158
Fair enough, that explains where the references to "LandEnc_OfficerHired" and "LandEnc_OfficerJoined" came from in the first "compile.log". Nothing to worry about there, then. (And it was originally my suggestion to hire an expendable officer as a scout. :p)

Also from the first "compile.log":
Code:
no sex found
That message comes from "PROGRAM\LandEncounters\LEnc_login.c", function "LEnc_LoginSelectModel". Someone isn't getting any sex. That doesn't mean a shortage of nocturnal activity, it means the "sex" attribute hasn't been assigned, so the function assigns the attribute with value "". In the second attempt, someone still isn't getting any sex, but this one wasn't detected by "LEnc_LoginSelectModel" so the attribute still isn't assigned. The error messages all point to "Loc_ai\LAi_events.c", line 3556, which is:
Code:
WriteLocatorGlobal(corpse.location, "box", newLocName, TranslateString("","body_of_"+corpse.sex)+" "+GetMySimpleName(corpse), sti(corpse.index), stf(corpse.deathx), stf(corpse.deathy), stf(corpse.deathz), true);
So someone has just been killed and the game doesn't know where to put the body or what sex it is. I haven't seen the lack of sex before but errors about "deathx", "deathy" and "deathz" are routine in my games - they appear after a battle, and the battle seemed to have played out to conclusion without any problems, so I just ignore those messages.

Meanwhile, did you try adding the "RemoveOfficersIndex" line and commenting out the "LAi_SetOfficerType" line?
 
Fair enough, that explains where the references to "LandEnc_OfficerHired" and "LandEnc_OfficerJoined" came from in the first "compile.log". Nothing to worry about there, then. (And it was originally my suggestion to hire an expendable officer as a scout. :p)

Also from the first "compile.log":
Code:
no sex found
That message comes from "PROGRAM\LandEncounters\LEnc_login.c", function "LEnc_LoginSelectModel". Someone isn't getting any sex. That doesn't mean a shortage of nocturnal activity, it means the "sex" attribute hasn't been assigned, so the function assigns the attribute with value "". In the second attempt, someone still isn't getting any sex, but this one wasn't detected by "LEnc_LoginSelectModel" so the attribute still isn't assigned. The error messages all point to "Loc_ai\LAi_events.c", line 3556, which is:
Code:
WriteLocatorGlobal(corpse.location, "box", newLocName, TranslateString("","body_of_"+corpse.sex)+" "+GetMySimpleName(corpse), sti(corpse.index), stf(corpse.deathx), stf(corpse.deathy), stf(corpse.deathz), true);
So someone has just been killed and the game doesn't know where to put the body or what sex it is. I haven't seen the lack of sex before but errors about "deathx", "deathy" and "deathz" are routine in my games - they appear after a battle, and the battle seemed to have played out to conclusion without any problems, so I just ignore those messages.

Meanwhile, did you try adding the "RemoveOfficersIndex" line and commenting out the "LAi_SetOfficerType" line?
yeah, Im getting the "no sex found" all the time (heu heu), mostly in taverns it seems, so dunno what thats about

but yes, those latest logs were after adding the removeofficersindex and commenting out the other one
 
Something I've occasionally had to do when writing quests; when something just plain refuses to work and I can't figure out why, sometimes it's easier just to say "stuff it" and try a different approach. So, while I haven't given up trying to make this officer disappear after reaching the door, here's plan B just in case.

Have case "Send Officer Gone" triggered by you leaving the room. Meanwhile, the officer doesn't go to the door. He goes to the bar and stays there. He's getting a good drink before going on what could be a one-way mission. And now you don't need to worry about making him disappear before you've left the building. xD
 
Something I've occasionally had to do when writing quests; when something just plain refuses to work and I can't figure out why, sometimes it's easier just to say "stuff it" and try a different approach. So, while I haven't given up trying to make this officer disappear after reaching the door, here's plan B just in case.

Have case "Send Officer Gone" triggered by you leaving the room. Meanwhile, the officer doesn't go to the door. He goes to the bar and stays there. He's getting a good drink before going on what could be a one-way mission. And now you don't need to worry about making him disappear before you've left the building. xD
at this point that solution made my day xD
would something like this work?
Code:
case "Send Officer to scout":
            //Levis add smuggling questbook
            Preprocessor_AddQuestData("location",locations[FindLocation(Pchar.quest.contraband.CurrentPlace)].name);
            questbookname = "smuggle&number="+Pchar.amount_smuggleruns; //Set a questname
            AddQuestRecord(questbookname, 11);
            Preprocessor_Remove("location");
            Pchar.quest.Contraband.scout.done = true;
            //In 1 day he has to return
            NPChar = characterFromID(PChar.quest.Contraband.officerID);
            RemovePassenger(PChar, NPChar);
            NPChar.StoredFellow = True;
            if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" as officer");
            LAi_SetActorType(NPChar);
            RemoveOfficersIndex(pchar, GetCharacterIndex(NPChar.id));
            //LAi_ActorGoToLocation(NPChar,"reload","reload1", "none", "", "", "Send Officer Gone",10);
            PChar.quest.Send_Officer_Gone.win_condition.l1 = "ExitFromLocation";
            PChar.quest.Send_Officer_Gone.win_condition.l1.location = PChar.location;
            PChar.quest.Send_Officer_Gone.win_condition.l2 = "Timer";
            PChar.quest.Send_Officer_Gone.win_condition.l2.date.hour = GetAddingTimeDay(1,0);
            PChar.quest.Send_Officer_Gone.win_condition = "Send Officer Gone";
        break;

        case "Send Officer Gone":
            NPChar = characterFromID(PChar.quest.Contraband.officerID);
            //LAi_SetOfficerType(NPChar);
            ChangeCharacterAddressGroup(NPChar,"none","",""); //We don't have to see him anymore
            if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" from location");
            PChar.quest.Contraband_Scouting.win_condition.l1 = "Timer";
            PChar.quest.Contraband_Scouting.win_condition.l1.date.day = GetAddingDataDay(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition.l1.date.month = GetAddingDataMonth(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition.l1.date.year = GetAddingDataYear(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition = "Send Officer time expired";
            if(DEBUG_SMUGGLING>0)trace("SMUGGLING timer set 1 day later ");
        break;

I think, but not 100% sure, that LAi_SetActorType(NPChar); makes them wander around, so either it triggers when you leave the location or after 15 ingame minutes (EDIT: the timer cant take minutes) 1 ingame hour if you decide to wait around the bar room/other location for an entire day for some reason. :p
 
at this point that solution made my day xD
would something like this work?
Code:
case "Send Officer to scout":
            //Levis add smuggling questbook
            Preprocessor_AddQuestData("location",locations[FindLocation(Pchar.quest.contraband.CurrentPlace)].name);
            questbookname = "smuggle&number="+Pchar.amount_smuggleruns; //Set a questname
            AddQuestRecord(questbookname, 11);
            Preprocessor_Remove("location");
            Pchar.quest.Contraband.scout.done = true;
            //In 1 day he has to return
            NPChar = characterFromID(PChar.quest.Contraband.officerID);
            RemovePassenger(PChar, NPChar);
            NPChar.StoredFellow = True;
            if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" as officer");
            LAi_SetActorType(NPChar);
            RemoveOfficersIndex(pchar, GetCharacterIndex(NPChar.id));
            //LAi_ActorGoToLocation(NPChar,"reload","reload1", "none", "", "", "Send Officer Gone",10);
            PChar.quest.Send_Officer_Gone.win_condition.l1 = "ExitFromLocation";
            PChar.quest.Send_Officer_Gone.win_condition.l1.location = PChar.location;
            PChar.quest.Send_Officer_Gone.win_condition.l2 = "Timer";
            PChar.quest.Send_Officer_Gone.win_condition.l2.date.hour = GetAddingTimeDay(0,15);
            PChar.quest.Send_Officer_Gone.win_condition = "Send Officer Gone";
        break;

        case "Send Officer Gone":
            NPChar = characterFromID(PChar.quest.Contraband.officerID);
            //LAi_SetOfficerType(NPChar);
            ChangeCharacterAddressGroup(NPChar,"none","",""); //We don't have to see him anymore
            if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" from location");
            PChar.quest.Contraband_Scouting.win_condition.l1 = "Timer";
            PChar.quest.Contraband_Scouting.win_condition.l1.date.day = GetAddingDataDay(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition.l1.date.month = GetAddingDataMonth(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition.l1.date.year = GetAddingDataYear(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition = "Send Officer time expired";
            if(DEBUG_SMUGGLING>0)trace("SMUGGLING timer set 1 day later ");
        break;

I think, but not 100% sure, that LAi_SetActorType(NPChar); makes them wander around, so either it triggers when you leave the location or after 15 ingame minutes if you decide to wait around the bar room/other location for an entire day for some reason. :p
almost I think.
It's possible the Send Officer Gone will be triggered twice because of the backup questcase. So I would add a check if the next questcase is set already. In that case the Contraband_Scouting.win_conditions doesn't have to be set.
I don't know if this is removed once the Send Officer time expired is called. if so you can just check for this attribute to exist.
 
almost I think.
It's possible the Send Officer Gone will be triggered twice because of the backup questcase. So I would add a check if the next questcase is set already. In that case the Contraband_Scouting.win_conditions doesn't have to be set.
I don't know if this is removed once the Send Officer time expired is called. if so you can just check for this attribute to exist.
hm, how do I do that? can I do an either/or win condition? isnt the "send officer to scout" quest already won and over if either of the things happen, or does two win conditions mean both have to be true?
 
hm, how do I do that? can I do an either/or win condition? isnt the "send officer to scout" quest already won and over if either of the things happen, or does two win conditions mean both have to be true?
Checked it realy quick. Best way imo would be:
in
Code:
case "Send Officer time expired":
add a line which says:
Code:
DeleteAttribute(Pchar,"quest.Contraband.scout.done");
Then move (so remove it where it is now) the line
Code:
Pchar.quest.Contraband.scout.done = true;
to the questcase below like this:
Code:
case "Send Officer Gone":
           NPChar = characterFromID(PChar.quest.Contraband.officerID);
           //LAi_SetOfficerType(NPChar);
           ChangeCharacterAddressGroup(NPChar,"none","",""); //We don't have to see him anymore
           if(CheckAttribute(Pchar,"quest.Contraband.scout.done"))
           {
                if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" from location");
                Pchar.quest.Contraband.scout.done = true;
                PChar.quest.Contraband_Scouting.win_condition.l1 = "Timer";
                PChar.quest.Contraband_Scouting.win_condition.l1.date.day = GetAddingDataDay(0, 0, 1);
                PChar.quest.Contraband_Scouting.win_condition.l1.date.month = GetAddingDataMonth(0, 0, 1);
                PChar.quest.Contraband_Scouting.win_condition.l1.date.year = GetAddingDataYear(0, 0, 1);
                PChar.quest.Contraband_Scouting.win_condition = "Send Officer time expired";
                if(DEBUG_SMUGGLING>0)trace("SMUGGLING timer set 1 day later ");
           }
       break;
 
Back
Top