• 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 Fetch Quest Errors: Apothecary Ship's Log and Zero Amounts

Talisman

Smuggler
Storm Modder
In the Ships Log :

The entry telling the player that the Apothecary in Bridgetown needs Help ( Fetch Quest ) is blank

PotC_B14Beta4_ShipLog_ApothecaryBLANK.jpg

Attached is an updated - quests_common.c -- to fix this.

I don't know if the Apothecary Fetch Quest works ( have not played it yet ) :read - but at least this fixes the blank Page.

:drunk
 

Attachments

  • quests_common.c
    217 KB · Views: 145
Last edited:
Just checked this - Ships Log page does not show text - tried F11 - ( maybe I have to start a new game to get it to work ) :facepalm

ALSO

Went to the Apothecary to actually do the Fetch quest

He asked me to get him 0 (Zero ) medicines for 0 (Zero) Gold - in both the dialog & Quest book.

I don't know if this is a coding error :shrug - nothing shows in the error logs when Debug is set to 1 for Fetch quests ( at the top of quests_common.c )

PotC_B14Beta4_ApothacaryFetch_1.jpg PotC_B14Beta4_ApothacaryFetch_2.jpg PotC_B14Beta4_ApothecaryFetch_3.jpg

Save attached is just before entering Apothecary.

:drunk
 

Attachments

  • -=Player=- Barbados.7z
    576.8 KB · Views: 109
  • compile.log
    3.3 KB · Views: 125
  • system.log
    896 bytes · Views: 151
Just checked this - Ships Log page does not show text - tried F11 - ( maybe I have to start a new game to get it to work ) :facepalm
Your correction looks good to me. But it wouldn't fix any log entries that have already been made.
It would only fix new ones. Might that explain it?

He asked me to get him 0 (Zero ) medicines for 0 (Zero) Gold - in both the dialog & Quest book.
In that same file, find:
Code:
int amount = makeint((1+rand(GetDifficulty()*(sti(Pchar.rank)))*(60+rand(sti(ctown.economy)*20)))/sti(Goods[choosegood].Weight));
Replace with:
Code:
int amount = makefloat( (1+rand(GetDifficulty()*sti(Pchar.rank))) * (60+rand(GetTownEconomy(ctown)*20)) ) / makefloat(Goods[choosegood].Weight);
This should handle "floating point" multiplications and divisions much better.

It also changes the use of brackets a bit so that the "1+" serves as a "failsafe".
I suspect this was @Levis' intention, but it did something quite different.

This might affect the amount of cargo being requested for ALL fetch quests and I have absolutely no clue what this will do for balancing.
If the cargoes are too big/small, you can probably play around with those "60" and "20" values.

I hope this helps. :doff
 
To clarify, this will not fix existing Fetch Quests, but should avoid quests with zero cargo being generated in the future.

Don't understand what you said. If it won't fix the existing FQ's, it means they will still show zero amounts?

Pieter, I changed the file in my "Modding & testing" copy of the game, copied the save game right before going to Antigua, and nothing changed.
Fix test 1.png Fix test 2.png
I started a new game with Laurens to see if in a new game it works.

PS: Pieter, if you prefer, please move this post to the Fix in progress thread.
 
I mean that new Fetch Quests are generated periodically.
Any quests that were already generated before the fix was added will not be fixed.
Quests generated later should be Ok from now on.
 
As promised, I tested the code change and it worked.

Started a new game with this Portuguese serving the Americans.
luckily the first news at tavern was that of a fetching quest. 60 units as, I think, was intended.
Fetch tradesman Fix test 1.png Fetch tradesman Fix test 2.png Fetch tradesman Fix test 3.png

In the screenshots thread I posted a image of my second fetch quest in the not yet fixed build.
 
As promised, I tested the code change and it worked.
This is a very difficult bug to confirm fixed, because the only way to find out is that the "zero amounts" do NOT happen anymore.
It is random, so they might not happen the first or second time, but maybe the tenth time.

But while I was fixing it, I ran it through console several dozens of times. That is how I saw it should be OK now.
I do wonder if the amounts in the fetch quests will seem OK from now on though.
Some might still end up "too small" or "too large" as I didn't focus on that.
If you could keep an eye on it throughout the game, that'd be very welcome. :doff
 
@Pieter Boelen, today I thought about this problem and came up with an idea. Wouldn't it be better if the amount of goods asked was attached to the player's level? Would it be possible to set it up in a way that the amount asked would be 6x player level number, on landlubber difficulty, 8x level number on mariner, 10x on sea dog and 12x on swashbuckler? I think that would bring up reasonable quantities and make it balanced. What do you think?
 
@Pieter Boelen, today I thought about this problem and came up with an idea. Wouldn't it be better if the amount of goods asked was attached to the player's level? Would it be possible to set it up in a way that the amount asked would be 6x player level number, on landlubber difficulty, 8x level number on mariner, 10x on sea dog and 12x on swashbuckler? I think that would bring up reasonable quantities and make it balanced. What do you think?
Feel free to play around with the formula for it. See post #5 above.

I personally just care about having this silly bug fixed.
Improvements and balancing, I'd leave to you guys. :doff
 
@Pieter Boelen, today I thought about this problem and came up with an idea. Wouldn't it be better if the amount of goods asked was attached to the player's level? Would it be possible to set it up in a way that the amount asked would be 6x player level number, on landlubber difficulty, 8x level number on mariner, 10x on sea dog and 12x on swashbuckler? I think that would bring up reasonable quantities and make it balanced. What do you think?


The type of goods that the player is asked to fetch is attached to the players level. :yes

This is something you may want to take into consideration.

The code for the fetch quests is in quests_common.c

see here

Code:
    //Go on to check for the goods
     int goodoptions[5];
     option = 0;
     switch(choose)
     {
     case "dockyard":
       goodoptions[option] = GOOD_SANDAL; option++;
       goodoptions[option] = GOOD_LINEN; option++;
       if(sti(Pchar.rank)>15)
       {
         goodoptions[option] = GOOD_MAHOGANY; option++;
       }
       if(sti(Pchar.rank)>30)
       {
         goodoptions[option] = GOOD_EBONY; option++;
       }
     break;
     case "tailor":
       goodoptions[option]= GOOD_LEATHER; option++;
       goodoptions[option]= GOOD_COTTON; option++;
       if(sti(Pchar.rank)>12)
       {
         goodoptions[option]= GOOD_CLOTHES; option++;
       }
       if(sti(Pchar.rank)>35)
       {
         goodoptions[option]= GOOD_SILK; option++;
       }
     break;
     
     case "blacksmith":
       goodoptions[option]= GOOD_OIL; option++;
       if(sti(Pchar.rank)>20)
       {
         goodoptions[option]= GOOD_SILVER; option++;
       }
       if(sti(Pchar.rank)>40)
       {
         goodoptions[option]= GOOD_GOLD; option++;
       }
     break;
     
     case "gunsmith":
       if(ENABLE_AMMOMOD) goodoptions[option]= GOOD_GUNPOWDER; option++;
       goodoptions[option]= GOOD_SILVER; option++;
       if(sti(Pchar.rank)>25)
       {
         goodoptions[option]= GOOD_EBONY; option++;
       }
     break;
     
     case "apothecary":
       goodoptions[option]= GOOD_TREATMENT; option++;
     break;
     }
     int choosegood = goodoptions[rand((option-1))];
//     int amount = makeint((1+rand(GetDifficulty()*(sti(Pchar.rank)))*(60+rand(sti(ctown.economy)*20)))/sti(Goods[choosegood].Weight));  // TALISMAN Line replaced as per P Boelen
     int amount = makefloat( (1+rand(GetDifficulty()*sti(Pchar.rank))) * (60+rand(GetTownEconomy(ctown)*20)) ) / makefloat(Goods[choosegood].Weight);  //TALISMAN - new line as per P Boelen
     if(DEBUG_FETCH_QUEST) trace("FETCH QUEST: made cargo for type: "+choose+" good: "+Goods[choosegood].name+" amount: "+amount);
     if(!CheckAttribute(tisland,"cargonum")) tisland.cargonum = 0;
     int cargonum = tisland.cargonum;
     cargoid = "cargo_"+cargonum;
     tisland.cargos.(cargoid).good = choosegood;
     tisland.cargos.(cargoid).amount = amount;
     tisland.cargos.(cargoid).town = ctown.id;
     tisland.cargos.(cargoid).requester = choose;
     tisland.cargonum = sti(tisland.cargonum)+1;
   }
   return cargoid;


:checklist
 
Back
Top