change_screen_trade

Users who are viewing this thread

MountainBlade

Sergeant Knight at Arms
How is change_screen_trade supposed to work? Does it just start a trade window with whoever is currently speaking? I'm trying to add a trade option to caravans and I just added the operation to the consequences block, with no argument. Nothing happens. Is it because they're on the map or am I using it wrong?
 
Do you have to do something else with the troop? I tried giving the dialog to Ramun and changing it to (change_screen_trade, "trp_Ramun_the_slave_trader"), but it just quits the conversation.

The dialog for the merchants in town doesn't use any argument and it's listed in header_operations without argument too. The module builds fine whether I use an argument or not.  :???:
 
whether or not the module builds fine doesn't mean anything, it doesn't check for nr of arguments in cases like that.

It's also used with the trp_id (I had the same reaction you did after seeing header_operations).

And I don't know where you were looking but the merchants in the town game_menu are called with  (change_screen_trade, ":merchant_troop"),

maybe you can't trade with just any troop? I don't know..
 
I was looking in the dialogs. This is the line for the book merchant for example.
  [anyone,"bookseller_buy", [], "Of course {sir/madam}.", "book_trade_completed",[[change_screen_trade]]],

I gave Ramun the tf_is_merchant flag, but that doesn't work either, with or without troop id.
 
In dialogs change_screen_trade does not use any arguments. It opens a trade window between the main hero and a talking troop.
The argument in example
"village_elder_pretalk",[(change_screen_trade, "$g_talk_troop"),]], is redundant. Changing $g_talk_troop to anything else effects noting.
Then change_screen_trade is called from game_menu it requires an argument.
 
Thanks Rongar.

Well, I found the problem. The trade window won't pop up if the dialog ends (close_window as the end state). The merchant must have something to say after trading. tf_is_merchant doesn't matter and trading from the overmap works fine.

Now to give him a proper inventory and make him not trade away his clothes, but I'm glad I solved this mystery at least.

Edit: Also the end state can't be the same as the beginning state for trade to work.
 
By the way, did you find a workaround to keep merchants from trading away their clothes and gear? And I wish I'd found this thread two days earlier - I had the same problem and kept banging my head on a wall trying to find out what was wrong with my code :smile:

Related question - how do I change prices for certain items for specific merchants?  I have several different parties roaming around the map that you can trade with, and what I want to do is have each of these different parties (of different factions) specialize in some items, offering them at a discount, and have a high demand for some other items, offering usually much better prices than town merchants.

Thanks,
 
dariel said:
By the way, did you find a workaround to keep merchants from trading away their clothes and gear?
???
He cannot do it. Have you added new merchants? Did you set  tf_is_merchant for them?

dariel said:
Related question - how do I change prices for certain items for specific merchants?  I have several different parties roaming around the map that you can trade with, and what I want to do is have each of these different parties (of different factions) specialize in some items, offering them at a discount, and have a high demand for some other items, offering usually much better prices than town merchants.
You can tune price_factor on your own discretion depend on context in scripts
game_get_item_buy_price_factor and game_get_item_sell_price_factor
But it may be boring for a large number of items.
 
MountainBlade said:
Thanks Rongar.

Well, I found the problem. The trade window won't pop up if the dialog ends (close_window as the end state). The merchant must have something to say after trading. tf_is_merchant doesn't matter and trading from the overmap works fine.

Now to give him a proper inventory and make him not trade away his clothes, but I'm glad I solved this mystery at least.

Edit: Also the end state can't be the same as the beginning state for trade to work.

Care to post the code?
If you have time?
 
I'd imagine it would look like this:

Code:
    [party_tpl|pt_merchant_caravan, "trader", [], "Show me your wares.", "trader_2", [(change_screen_trade)]],
	 [party_tpl|pt_merchant_caravan, "trader_2", [], "Anything else?", "start", []],
 
Merchant Caravan dialog begins at line 7715. Put it where you'd like the dialog option to be. Btw, you should probably use this code instead.

Code:
    [anyone, "merchant_talk",
        [(eq, "$talk_context", tc_party_encounter),
		   (eq, "$g_encountered_party_type", spt_kingdom_caravan)],
        "Show me your wares.", "merchant_pretalk", [(change_screen_trade)]],
 
Many trials and errors before I got it right, but it works.
I had to add a small thing for it to work. Here is where I placed it and what I added:

  [anyone|plyr,"merchant_talk", [(eq,"$talk_context", tc_party_encounter), #TODO: For the moment don't let attacking if merchant has paid toll.
                                (neg|party_slot_ge, "$g_encountered_party", slot_party_last_toll_paid_hours, "$g_current_hours"),
                                ], "I demand something from you!", "merchant_demand",[]],

  #####################################################
  # Viking: Test to trade with caravan Begin
  #####################################################
      [anyone|plyr, "merchant_talk",
        [(eq, "$talk_context", tc_party_encounter),
        (eq, "$g_encountered_party_type", spt_kingdom_caravan)],
        "Show me your wares.", "merchant_pretalk", [(change_screen_trade)]],
  #####################################################
  # Viking: Test to trade with caravan End
  #####################################################

  [anyone,"merchant_demand", [(eq,"$talk_context", tc_party_encounter)], "What do you want?", "merchant_demand_2",[]],

  [anyone|plyr,"merchant_demand_2", [(neq,"$g_encountered_party_faction","$players_kingdom")], "There is a toll for free passage here!", "merchant_demand_toll",[]],
 


You're a genius.

Now I'm just going to see if I can manage to give him some money to trade with and some goods too.
Got any tip on where I should begin?

*sorry for being such a pain in the butt*
 
Back
Top Bottom