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

Fix in Progress Sell prices cheaper than usual on any stores

HellSailor

Privateer
Storm Modder
Once i wanted to sell goods in a pirate store (or french store, don't know very well) and i had the option to sell my products but at lower prices, and i did it, because i was hostile to them. Now i have discovered that in ANY store i go to sell, that discount of selling remains the same even on friendly islands. Is that a bug? And if it's a bug, how can i fix it so the prices get restored?
 
The game is set up so that it is likely that at some point one will become desperate to buy and sell cargo, and then that option to sell things cheaper looks attractive.

Is it a bug to have that discount everywhere? One would think so, but it will take a coder to look into it.
 
Yes it is a trap that many fall into. This situation happens when the player builds his fleet up too fast so that when the economy goes bad he can not support his fleet. It has been some time since I last got into that situation and have forgotten that it applies to all merchants.
 
Damn... It should not be like that... i think it is another bug, that should be reviewed. Maybe i have to start all again...

Anyway, if someone who's coder can take a look, it will be at least noticed for the next patches.

Also, i could make a full list of bugs and things that are not completely finished on the mod. That would help you more easy?

PD: There isn't any walkthrough for the Devlin Opera but i decided to take a look, but i see that there are some errors and the quests can't be continued. Is that supposed to happen, because it is an unfinished main quest?
 
Yes that should be a one time only thing, not an every time thing. There is a similar situation where one can trade with Pirates which works properly.

The Devlin Opera is very unfinished and should be considered a free play only quest. That is how I play it, by going free play before I ever get off the waterfront.
 
Okay,
  • So the economic status of the nations change from time to time.
  • And the prices of goods is not always cheaper than when you first bought them.
  • When the economic status of the nation(s) improve, some goods can be sold at a higher price in some stores.
  • And prices of goods sold to hostile nations' stores are expected to be cheaper and or w/o a profit but increases your relation to that nation(s).
*Am I getting this right? :confused:
 
1. Yes, the fortunes of the colonies rises and falls due to Lady Luck. If a colony gets hit by Pirates, a slave revolt, and a hurricane and is destitute and can even fail.

2. The cost of goods depends mostly on how much or how little there is, unless a colony gets desperate and starts selling goods at very low prices.

3. The better off colonies generally have higher prices for goods. For instance prices are a little higher at Havana than at Santiago.

4. No. If you can persuade a hostile merchant to deal with you at all, then the prices will be lower. But that has no bearing on relations.
 
This is still an issue. The cheaper goods option once used is retained for all merchants to the end of the game. This should not happen in my opinion. If you take the option to sell at "lower prices" it should only apply to that one merchant for that one time. I have found that this bug makes it worthless exercise to trade with any nation afterwards.
 
Well I presume it's the

Code:
if(tradeLow==false)

modifier which I have seen checks scattered through the code (and indeed not knowing WHAT triggered its activation have even added a check for it in getting rid of cargo in the shipyard for example). I presumed it was some form of behaviour that was meant to persist (and have seen it active in some saved games posted for other "bugs").

A quick fix should be to console
Code:
tradeLow=false;
if you have used it

Indeed when testing anything I have worked on that contained it I would use the opposite in console just to see that branch of code didn't break something.

Hopefully it should be simple to search for where it is set (true) and from there an appropriate place to turn it false again (say on leaving the store interface) unless anyone knows of a wider context where it is meant to persist - this thread is fairly clear it should be a one off.
EDIT It is set in each individual storekeeper file but it's turning it off that we need so as I said probably on leaving the store interface - just need to check how the store dialogue works next time through ENDEDIT
After that, understanding it is a one time deal could allow some code simplification elsewhere I should think.
 
Last edited:
@pedrwyth: The purpose of this variable is that if you have Commerce > 5, you can trade with ANY hostile merchant, but for worse prices.
Of course once the transaction has completed, it should be reset. Apparently that isn't happening. :facepalm
 
From "Thomas O'Reily_dialog.c":
Code:
         if(sti(PChar.Skill.Commerce)>=5)
         {
           Link.l2 = LanguageConvertString(tmpLangFileID,"low_trade_1");
           Link.l2.go = "low_price";
         }
Does that mean it only triggers if your own skill, unmodified by items or books, is 5 or better? It certainly doesn't take account of your quartermaster's skill because Thomas O'Reily has refused to serve me and not given that option when I've had a quartermaster with Commerce 5.
 
To reset after the transaction it looks like in any merchant dialogue file you need to add a "tradeLow=false in
Code:
case "trade_low":
            Diag.TempNode = "First time";
            DialogExit();
            tradeLow = true;
            PChar.storekeeper.Idx = sti(NPChar.index);//MAXIMUS
            LaunchStore(GetCurrentStore(NPChar.location));
            tradeLow = false: <--------------- PW line added to clear modifier on leaving store interface
        break;

I have not tested this is the right place though and it does leave the question of under what conditions you get the dialogue ie if(sti(PChar.Skill.Commerce)>=5) probably does not take into account changes to skills systems
 
Does that mean it only triggers if your own skill, unmodified by items or books, is 5 or better?
It indeed means exactly that.

Truth be told, using 'PChar.Skill' is quite bad practice I reckon. Better to use the proper function calls.

To reset after the transaction it looks like in any merchant dialogue file you need to add a "tradeLow=false in
Does 'tradeLow = false' then execute before or after the 'LaunchStore' interface is closed again?
I'm not entirely sure myself. Otherwise, perhaps that line would be needed in the trade.c interface file?
 
Does 'tradeLow = false' then execute before the 'LaunchStore' interface is closed again? Otherwise, perhaps that line would be needed in the trade.c interface file?

It is indeed actioned too soon and I struggled to find where to put it. On leaving the store items interface you go back to ship chooser (if you have companions) so it needs to be after you leave that interface or you can just drop in and out of goods and back in again to circumvent the low prices. I finally settled on here

Code:
void Start_InterfaceDoExit()
{
    SetEventHandler("frame","InterfaceDoExit",1);
     tradeLow = false; //PW reset on exit shop interface after low trade deal

}
in interface.c which seems to be OK (It seems it is called by all sorts of interface exits but since only the store exit one actually needs it it doesn't do any harm in other cases).

It's actually better than in a dialogue anyway because one line fits all - here is an amended file
 

Attachments

  • interface.7z
    11.8 KB · Views: 156
OK so given it is a "one off" deal a more efficient way of introducing it may be to change tradeLow from a bool to a float, give it a value of 1 normally but change it in the dialogue to 0.75 and back to 1 on exit. All the "if tradeLow=false ... else..." constructs become redundant if the tradeLow is then incorporated as a multiplier in a one size fits all selling price and its display and value calculations - using its value as 1 or 0.75 as appropriate.

Maybe something for next time an enforced new game plateau is reached?
 
Someone would have to make those changes though.
But in theory, I'm not sure that would even require a new game.
Might just work on existing saves straight away.
 
Back
Top