• 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 Smuggling Quest looking for info doesn't expire

Levis

Find(Rum) = false;
Staff member
Administrator
Creative Support
Programmer
Storm Modder
When looking for the time at which the patrol is best you can leave the location and go on with your life and the quest will stay in your questbook forever.
 
@DeathDaisy might be a nice bug for you to look at? It's not that hard to make as there is an expiration already for the smuggling, you probably just need to copy the right code here too.
 
Code:
case "Prepare Smuggling":
            //Keep track of how many times we did this
            if(!CheckAttribute(Pchar,"amount_smuggleruns")) Pchar.amount_smuggleruns = 0;
            Pchar.amount_smuggleruns = sti(Pchar.amount_smuggleruns) + 1;
            //Set the contraband stuff
            lockIslandContraband(Islands[GetCharacterCurrentIsland(Pchar)]); //Make sure the contraband wont change
            Pchar.quest.Contraband.islandindex = GetCharacterCurrentIsland(Pchar);
            Pchar.quest.Contraband.active = true;
            Pchar.quest.Contraband.scout = true;
            Pchar.quest.Contraband.tavern = pchar.location; //Added so we know where to spawn the officer when he returns.
            //Levis add smuggling questbook
            Preprocessor_AddQuestData("island",Islands[GetCharacterCurrentIsland(Pchar)].name);
            Preprocessor_AddQuestData("location",locations[FindLocation(Pchar.quest.contraband.CurrentPlace)].name);
            //DeleteQuestHeader("smuggle&number=0"); //we dont have to delete anymore now
            questbookname = "smuggle&number="+Pchar.amount_smuggleruns; //Set a questname
            SetQuestHeader(questbookname);
            AddQuestRecord(questbookname, 1);
            Preprocessor_Remove("island");
            Preprocessor_Remove("location");
            //Give player the book the first time
            if(!CheckAttribute(Pchar,"quest.smuggling_got_book"))
            {
                Lai_QuestDelay("Smugglers First Meeting",0.0);
            }
            PChar.quest.Prepare_Smuggling_Fail.win_condition.l1 = "Timer";
            PChar.quest.Prepare_Smuggling_Fail.win_condition.l1.date.day = GetAddingDataDay(0,0,7);
            PChar.quest.Prepare_Smuggling_Fail.win_condition.l1.date.month = GetAddingDataMonth(0,0,7);
            PChar.quest.Prepare_Smuggling_Fail.win_condition.l1.date.year = GetAddingDataYear(0,0,7);
            PChar.quest.Prepare_Smuggling_Fail.win_condition = "Prepare Smuggling Fail";
        break;
      
        case "Prepare Smuggling Fail": // DeathDaisy: this happens if you fail to get back to the smuggler agent with the patrol times within a week
            questbookname = "smuggle&number="+Pchar.amount_smuggleruns;
            AddQuestRecord(questbookname, 16);
            CloseQuestHeader(questbookname);
            ChangeSmugglerLiking(Pchar, -2); //Add liking
        break;
the timer and new quest case ends the smuggling quest after a week for a small relation hit with the guild. I figured thats long enough that the agent grows tired and the player has probably forgotten or chosen to ignore it
Code:
PChar.quest.Prepare_Smuggling_Fail.over = "yes";
I put this in the smuggler agents dialog when returning so that you dont fail after the timer when you do get back in time
Code:
text.t16=The smugglers tired of waiting for me to procure the patrol times, so the deal is off. I will have to contact them anew if I want to set up a new deal.
I added this to the smuggling quest book, but maybe the one used for missing the meeting could work here too

anyway, tried it out and it seems to work!

EDIT: added a quest_common from after applying the other fetch quest expire things too
 

Attachments

  • quests_common.c
    228.2 KB · Views: 243
  • Smuggler Agent_dialog.c
    11.6 KB · Views: 241
  • smuggle.txt
    2.1 KB · Views: 251
  • quests_common.levisfix1126.c
    229.9 KB · Views: 239
Last edited:
I think by doing it this way you won't be able to do another smuggling run later. Could you test this?
 
I think by doing it this way you won't be able to do another smuggling run later. Could you test this?
it should work, its pretty much the same thing that happens if you dont show up for the trade itself. but Ill try it out! :)

EDIT: youre right, I missed a very important line :eek: adding RemoveSmuggersEtc() should work better I think?
Code:
case "Prepare Smuggling Fail": // DeathDaisy: this happens if you fail to get back to the smuggler agent with the patrol times within a week
            questbookname = "smuggle&number="+Pchar.amount_smuggleruns;
            AddQuestRecord(questbookname, 16);
            CloseQuestHeader(questbookname);
            ChangeSmugglerLiking(Pchar, -2); //Add liking
            RemoveSmugglersFromShore();
        break;
but Ill test it nonetheless!

EDIT2: argh so many steps that go wrong

EDIT3: accidentally discovered another bug which explains why my thing doesnt work: I tried copying the things that happen when you talk to the smuggler and cancel the deal to make the timer work right. turns out that you can choose to cancel the deal, your log updates and says you cancelled the deal. but his dialog node doesnt change so you can talk to him again and tell him you want to go through with the deal. he tells you where and when to meet the smugglers, the quest stays grayed out but updates saying you are to meet the smugglers. havent tried going to the beach after that, but I cant imagine good things follow. probably theres no one there as the RemoveSmugglersFromShore() seems to erase everything.
 
Last edited:
this deserves a new post I think

the dialog node thing was probably a mistake, so I switched that to Diag.CurrentNode = Diag.TempNode and it works as it should

Code:
case "Prepare Smuggling":
            //Keep track of how many times we did this
            if(!CheckAttribute(Pchar,"amount_smuggleruns")) Pchar.amount_smuggleruns = 0;
            Pchar.amount_smuggleruns = sti(Pchar.amount_smuggleruns) + 1;
            //Set the contraband stuff
            lockIslandContraband(Islands[GetCharacterCurrentIsland(Pchar)]); //Make sure the contraband wont change
            Pchar.quest.Contraband.islandindex = GetCharacterCurrentIsland(Pchar);
            Pchar.quest.Contraband.active = true;
            Pchar.quest.Contraband.scout = true;
            Pchar.quest.Contraband.tavern = pchar.location; //Added so we know where to spawn the officer when he returns.
            //Levis add smuggling questbook
            Preprocessor_AddQuestData("island",Islands[GetCharacterCurrentIsland(Pchar)].name);
            Preprocessor_AddQuestData("location",locations[FindLocation(Pchar.quest.contraband.CurrentPlace)].name);
            //DeleteQuestHeader("smuggle&number=0"); //we dont have to delete anymore now
            questbookname = "smuggle&number="+Pchar.amount_smuggleruns; //Set a questname
            SetQuestHeader(questbookname);
            AddQuestRecord(questbookname, 1);
            Preprocessor_Remove("island");
            Preprocessor_Remove("location");
            //Give player the book the first time
            if(!CheckAttribute(Pchar,"quest.smuggling_got_book"))
            {
                Lai_QuestDelay("Smugglers First Meeting",0.0);
            }
            PChar.quest.Prepare_Smuggling_Fail.win_condition.l1 = "Timer";
            PChar.quest.Prepare_Smuggling_Fail.win_condition.l1.date.day = GetAddingDataDay(0,0,7);
            PChar.quest.Prepare_Smuggling_Fail.win_condition.l1.date.month = GetAddingDataMonth(0,0,7);
            PChar.quest.Prepare_Smuggling_Fail.win_condition.l1.date.year = GetAddingDataYear(0,0,7);
            PChar.quest.Prepare_Smuggling_Fail.win_condition = "Prepare Smuggling Fail";
        break;
        
        case "Prepare Smuggling Fail": // DeathDaisy: this happens if you fail to get back to the smuggler agent with the patrol times within a week
            ref ch = characterFromID(PChar.quest.Contraband.contact);
            ch.Dialog.CurrentNode = ch.Dialog.TempNode;
            questbookname = "smuggle&number="+Pchar.amount_smuggleruns;
            AddQuestRecord(questbookname, 16);
            CloseQuestHeader(questbookname);
            ChangeSmugglerLiking(Pchar, -2); //Add liking
            RemoveSmugglersFromShore();
        break;

this is for the expiration and it also seems to work fine now. time expired and when I spoke to the smuggler afterwards I could set up a new deal. tell me if I missed something tho
 

Attachments

  • quests_common.levisfixes1126.c
    230 KB · Views: 197
  • quests_common.c
    228.4 KB · Views: 227
  • Smuggler Agent_dialog.c
    11.6 KB · Views: 237
I don't think you need the "removesmugglersfromshore()" yet, I believe these are added one step later right?
 
I don't think you need the "removesmugglersfromshore()" yet, I believe these are added one step later right?
entirely possible, I used cancel_smuggling as a mold, and that seems to be chaos. the only thing I can see that it would need here is it deletes some attributes other than the smugglers on the beach, but I dunno if thats vital. the cancelling overall seems a bit messy
 
okay, so @DeathDaisy did you test this already? Can we call it fixed?
 
There is a problem with that version of "Smuggler Agent_dialog.c". The end of line characters aren't properly set so I can't view it properly, and WinMerge shows the entire file as being one big block of difference.

@DeathDaisy: can you provide a version of "Smuggler Agent_dialog.c" with standard end of line characters?
 
Last edited:
There is a problem with that version of "Smuggler Agent_dialog.c". The end of line characters aren't properly set so I can't view it properly, and WinMerge shows the entire file as being one big block of difference.

@DeathDaisy: can you provide a version of "Smuggler Agent_dialog.c" with standard end of line characters?
dunno why it does that sometimes.. Ill be back at my computer within the next few hours, but this shd be fixable on my mobile. harder to check if the fix actually did its job here tho, so see if this ver works better! elsewise Ill fix properly it when I get home :onya
 

Attachments

  • Smuggler Agent_dialog.c
    12 KB · Views: 199
Yes, that's certainly more readable.

I'm not sure about this:
Code:
    ref SmugglingIsland
   int n;
   n = GetCharacterCurrentIsland(Pchar);
   if(n < 0) return "none";
   SmugglingIsland = GetIslandByIndex(n);
The 'if(n<0)' probably shouldn't happen - it means you're talking to the agent and you're not on a valid island, in which case how did he get there? But if it does happen, you're bailing out right away - and you're returning string value "none" from inside function 'void ProcessDialogEvent()', which being a "void" type should not be returning any value at all. I'm not sure, but perhaps it might be tidier to have 'if(n < 0) DialogExit();'?

Code:
       case "Ready to go":
           if(getSmugglingState(SmugglingIsland) == 1) PatrolState = DLG_TEXT[78];
           if(getSmugglingState(SmugglingIsland) == 2) PatrolState = DLG_TEXT[79];
           if(getSmugglingState(SmugglingIsland) == 3) PatrolState = DLG_TEXT[80];
           if(getSmugglingState(SmugglingIsland) == 4) PatrolState = DLG_TEXT[81];
Variable "PatrolState" isn't declared here, it's declared in case "Meeting_3". Also, lines 78-81 mean you must have a new version of "Smuggler Agent_dialog.h". (Does the player need to be told the patrol state again? ;))
 
The 'if(n<0)' probably shouldn't happen - it means you're talking to the agent and you're not on a valid island, in which case how did he get there? But if it does happen, you're bailing out right away - and you're returning string value "none" from inside function 'void ProcessDialogEvent()', which being a "void" type should not be returning any value at all. I'm not sure, but perhaps it might be tidier to have 'if(n < 0) DialogExit();'?
Indeed if you do 'return' in a 'void' function, it should just be 'return' without a value following it.
 
Yes, that's certainly more readable.

I'm not sure about this:
Code:
    ref SmugglingIsland
   int n;
   n = GetCharacterCurrentIsland(Pchar);
   if(n < 0) return "none";
   SmugglingIsland = GetIslandByIndex(n);
The 'if(n<0)' probably shouldn't happen - it means you're talking to the agent and you're not on a valid island, in which case how did he get there? But if it does happen, you're bailing out right away - and you're returning string value "none" from inside function 'void ProcessDialogEvent()', which being a "void" type should not be returning any value at all. I'm not sure, but perhaps it might be tidier to have 'if(n < 0) DialogExit();'?
just doing a return migth work. but doing a dialog exit might be better indeed.
Code:
       case "Ready to go":
           if(getSmugglingState(SmugglingIsland) == 1) PatrolState = DLG_TEXT[78];
           if(getSmugglingState(SmugglingIsland) == 2) PatrolState = DLG_TEXT[79];
           if(getSmugglingState(SmugglingIsland) == 3) PatrolState = DLG_TEXT[80];
           if(getSmugglingState(SmugglingIsland) == 4) PatrolState = DLG_TEXT[81];
Variable "PatrolState" isn't declared here, it's declared in case "Meeting_3". Also, lines 78-81 mean you must have a new version of "Smuggler Agent_dialog.h". (Does the player need to be told the patrol state again? ;))

move the "string patrol state" decleration to the top of the file. that should fix this problem.
 
Yes, that's certainly more readable.

I'm not sure about this:
Code:
    ref SmugglingIsland
   int n;
   n = GetCharacterCurrentIsland(Pchar);
   if(n < 0) return "none";
   SmugglingIsland = GetIslandByIndex(n);
The 'if(n<0)' probably shouldn't happen - it means you're talking to the agent and you're not on a valid island, in which case how did he get there? But if it does happen, you're bailing out right away - and you're returning string value "none" from inside function 'void ProcessDialogEvent()', which being a "void" type should not be returning any value at all. I'm not sure, but perhaps it might be tidier to have 'if(n < 0) DialogExit();'?
I think I stole that from somewhere else, so dont know why itd do that. I dont mind changing it :type1
Code:
       case "Ready to go":
           if(getSmugglingState(SmugglingIsland) == 1) PatrolState = DLG_TEXT[78];
           if(getSmugglingState(SmugglingIsland) == 2) PatrolState = DLG_TEXT[79];
           if(getSmugglingState(SmugglingIsland) == 3) PatrolState = DLG_TEXT[80];
           if(getSmugglingState(SmugglingIsland) == 4) PatrolState = DLG_TEXT[81];
Variable "PatrolState" isn't declared here, it's declared in case "Meeting_3". Also, lines 78-81 mean you must have a new version of "Smuggler Agent_dialog.h". (Does the player need to be told the patrol state again? ;))
hm, I have a vague memory that I figured that since Meeting_3 will always run before Ready to go, itd stay declared, but its fuzzy. just moving it to the top will probably be better

as for telling the patrol state twice, if the player is anything like me, theyll have forgotten the patrol state long ago when they talk to the smuggler again after finding the patrol time:p itll be less of a problem when @Levis implement the patrol state in the interface tho :read

speaking of memory, Ill attach the .h file :p

EDIT: ninjad by @Levis :ninja EDIT2: added a hopefully tidier c file too!
 

Attachments

  • Smuggler Agent_dialog.h
    6.2 KB · Views: 203
  • Smuggler Agent_dialog.c
    11.6 KB · Views: 198
Last edited:
I think I stole that from somewhere else, so dont know why itd do that. I dont mind changing it :type1

hm, I have a vague memory that I figured that since Meeting_3 will always run before Ready to go, itd stay declared, but its fuzzy. just moving it to the top will probably be better

as for telling the patrol state twice, if the player is anything like me, theyll have forgotten the patrol state long ago when they talk to the smuggler again after finding the patrol time:p
If a player's memory is that bad then there's no point in the smuggling agent mentioning the patrol state because the player will forget it again about five seconds after leaving the tavern. :p The best place to put it would be in the questbook along with the smuggling time when you've either talked to a soldier or had an officer return from a successful scouting mission. Then it's always there. (Personally I don't pay much attention to the smuggling state, but the time is important. And my memory isn't that great either. So I'm going to be looking back at the questbook a few times anyway.)

speaking of memory, Ill attach the .h file :p
Unfortunately, once again, that version has the wrong end of line characters.
 
If a player's memory is that bad then there's no point in the smuggling agent mentioning the patrol state because the player will forget it again about five seconds after leaving the tavern. :p The best place to put it would be in the questbook along with the smuggling time when you've either talked to a soldier or had an officer return from a successful scouting mission. Then it's always there. (Personally I don't pay much attention to the smuggling state, but the time is important. And my memory isn't that great either. So I'm going to be looking back at the questbook a few times anyway.)


Unfortunately, once again, that version has the wrong end of line characters.
seems my notepad++ saves some documents with unix formatting for some reason :mad::mad: gonna keep an eye out for it.. updated the h again EDIT: and the c too, seems that had the same problem

putting it in the quest book is a very good idea!
 

Attachments

  • Smuggler Agent_dialog.h
    6.2 KB · Views: 208
  • Smuggler Agent_dialog.c
    12 KB · Views: 194
Back
Top