Note: Go to page 2 middle to see the Indictments thread info
The top thread is a tutorial for creating special merchants.
////////////////////////////////////////////////////////////////////
Goal: Add special characters who sell special, even magical, items to player.
Not using the operator troop_add_merchandise_with_faction, because it pulls in garbage that has not been assigned to factions.
Make special characters able to sell special items through the common trade window rather than the current dialog-description process in Brytenwalda.
Challenges: troop_add_merchandise_with_faction is troublesome. Even if 90% of items have a faction, it will make sure that at least half the items are non-faction items.
Imitating the booksellers don't work because they sell books. Other characters will dress in the gear you give them, making it unavailable.
Spawning new characters in scenes in a complicated process.
************Discovery Log*****************************
I decided to add special merchants with exclusive imported goods to BW.
I have finally succeeded in locating these new troops in at least 1 assigned town (there should be 7 in 7 specific towns).
I gave each merchant his own faction and appended that faction to the special items.
However, when I ask for the inventory, I am getting the gear of a weaponsmith.
Here is my script so far which merges the normal refresh_weaponsmith with refresh_armorer and refresh_bandit_merchant (I show it at bottom):
("refresh_special_merchants1",
("cf_refresh_bandit_merchants",#gdw read for Krag
***********************************Cutting to the point, the solution I chose:
In the end, the chests were not necessary.
I didn't use add merchandise with faction.
Nor could I figure out a way to keep the merchants from autoequipping their gear.
This is my working setup:
Add troops in enclosed scenes. I had problems when they were in the town center as you saw in the bug thread.
To do this, visit the town and find buildings with separated scenes, like taverns or merchant buildings.
Hit control-e in edit mod and "Add object" Entry point to the place where the merchant will stand.
Record the number of the new entry point for the troops file.
Save the scene and be sure that it is included in any archive files to replace the old scene object.
Now in module_troops, add or repurpose the troops with the new scene and entry point like this:
Script the addition of items with add_items
("refresh_special_merchants1",
Add a trigger:
Dialog:
Notice that this worked 6 different ways with the screen_trade command!
Even when I put trp_specialmerch4_chest, it still showed the gear from trp_specialmerch4!!
Why is that? It completely ignored the gear I was assigning to the trp_chests.
The top thread is a tutorial for creating special merchants.
////////////////////////////////////////////////////////////////////
Goal: Add special characters who sell special, even magical, items to player.
Not using the operator troop_add_merchandise_with_faction, because it pulls in garbage that has not been assigned to factions.
Make special characters able to sell special items through the common trade window rather than the current dialog-description process in Brytenwalda.
Challenges: troop_add_merchandise_with_faction is troublesome. Even if 90% of items have a faction, it will make sure that at least half the items are non-faction items.
Imitating the booksellers don't work because they sell books. Other characters will dress in the gear you give them, making it unavailable.
Spawning new characters in scenes in a complicated process.
************Discovery Log*****************************
I decided to add special merchants with exclusive imported goods to BW.
I have finally succeeded in locating these new troops in at least 1 assigned town (there should be 7 in 7 specific towns).
I gave each merchant his own faction and appended that faction to the special items.
However, when I ask for the inventory, I am getting the gear of a weaponsmith.
Here is my script so far which merges the normal refresh_weaponsmith with refresh_armorer and refresh_bandit_merchant (I show it at bottom):
("refresh_special_merchants1",
Code:
[
(reset_item_probabilities, 100),
(set_merchandise_modifier_quality, 230),
#(try_for_range, ":cur_merchant", special_merchants_begin, special_merchants_end),
#(store_sub, ":cur_town", ":cur_merchant", weapon_merchants_begin),
#(val_add, ":cur_town", towns_begin), try_begin),
#(this_or_next|eq, ":cur_merchant", trp_specialmerch1),
#(eq, ":cur_merchant",trp_specialmerch7),
#(troop_clear_inventory, ":cur_merchant"),
(troop_clear_inventory, "trp_specialmerch7"),
(troop_clear_inventory, "trp_specialmerch1"),
#(party_get_slot, fac_merchants1, ":cur_town", slot_center_original_faction),
#(party_get_slot, ":cur_faction", ":cur_town", slot_center_original_faction),
(troop_add_merchandise_with_faction, "trp_specialmerch1", "fac_merc1", itp_type_one_handed_wpn, 4),#gdw
(troop_add_merchandise_with_faction, "trp_specialmerch7", "fac_merc1", itp_type_two_handed_wpn, 4),#gdw
(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_polearm, 4),#gdw
#(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_shield, 5),#gdw
#(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bow, 3),
#(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_crossbow, 3),
#(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_thrown, 5),
#(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_arrows, 2),
#(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bolts, 2),
(troop_add_merchandise_with_faction, ":cur_merchant", "fac_merc1", itp_type_body_armor, 10),#gdw
(troop_add_merchandise_with_faction, ":cur_merchant", "fac_merc2", itp_type_body_armor, 10),#gdw
(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_head_armor, 1),
#(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_foot_armor, 7),#gdw
(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_hand_armor, 1),#gdw
(troop_ensure_inventory_space, ":cur_merchant", merchant_inventory_space),
(troop_sort_inventory, ":cur_merchant"),
(store_troop_gold, reg6, ":cur_merchant"),
(lt, reg6, 1500),#gdw
(store_random_in_range,":new_gold",1300,2300), #oro inicial chief cambiado#gdw
(call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
#(try_end),
]),
("cf_refresh_bandit_merchants",#gdw read for Krag
Code:
[
(reset_item_probabilities, 100),
(set_merchandise_modifier_quality, 100),
(troop_clear_inventory, "trp_brigand_hideout_merchant"),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_one_handed_wpn, 5),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_two_handed_wpn, 5),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_polearm, 5),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_shield, 6),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_bow, 4),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_crossbow, 1),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_thrown, 5),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_arrows, 2),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_bolts, 1),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_pistol,1), #chief sling
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_bullets,1),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_body_armor, 6),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_head_armor, 6),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_foot_armor, 6),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_hand_armor, 3),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_horse, 5),
(troop_add_merchandise_with_faction, "trp_brigand_hideout_merchant", "fac_outlaws", itp_type_goods, 5),
(troop_sort_inventory, "trp_brigand_hideout_merchant"),
(store_troop_gold, reg6, "trp_brigand_hideout_merchant"),
(lt, reg6, 1000),
(store_random_in_range,":new_gold",1000,2000), #oro inicial chief cambiado
(call_script, "script_troop_add_gold", "trp_brigand_hideout_merchant", ":new_gold"),
]),
***********************************Cutting to the point, the solution I chose:
In the end, the chests were not necessary.
I didn't use add merchandise with faction.
Nor could I figure out a way to keep the merchants from autoequipping their gear.
This is my working setup:
Add troops in enclosed scenes. I had problems when they were in the town center as you saw in the bug thread.
To do this, visit the town and find buildings with separated scenes, like taverns or merchant buildings.
Hit control-e in edit mod and "Add object" Entry point to the place where the merchant will stand.
Record the number of the new entry point for the troops file.
Save the scene and be sure that it is included in any archive files to replace the old scene object.
Now in module_troops, add or repurpose the troops with the new scene and entry point like this:
Code:
["specialmerch1","Harenbili","Harenbili",tf_hero|tf_is_merchant|tf_randomize_face, scn_town_1_store|entry(1), reserved, fac_commoners,[itm_leather_aprontunic,itm_ankleboots,],def_attrib|level(5),wp(20),knows_inventory_management_10, mercenary_face_1, mercenary_face_2],
["specialmerch2","Maonirn","{!}Weaponsmith",tf_hero|tf_is_merchant|tf_randomize_face, scn_town_11_store|entry(1), 0, fac_merc1,[itm_leather_aprontunic, itm_cheap_shoes],def_attrib|level(5),wp(20),knows_inventory_management_10, mercenary_face_1, mercenary_face_2],
["specialmerch3","Uormuin","{!}Weaponsmith",tf_hero|tf_is_merchant|tf_randomize_face, scn_town_26_store|entry(2), 0, fac_merc1,[itm_ptunic3, itm_cheap_shoes],def_attrib|level(5),wp(20),knows_inventory_management_10, mercenary_face_1, mercenary_face_2],
["specialmerch4","Godgyfu","{!}Weaponsmith",tf_hero|tf_is_merchant|tf_randomize_face, scn_town_10_store|entry(1), 0, fac_merc1,[itm_leather_tunic1, itm_cheap_shoes],def_attrib|level(5),wp(20),knows_inventory_management_10, mercenary_face_1, mercenary_face_2],
["specialmerch5","Dounerth","{!}Weaponsmith",tf_hero|tf_randomize_face|tf_is_merchant, scn_town_28_store|entry(1), 0, fac_merc1,[itm_ptunic3, itm_ankleboots],def_attrib|level(5),wp(20),knows_inventory_management_10, mercenary_face_1, mercenary_face_2],
["specialmerch6","Aed","{!}Weaponsmith",tf_hero|tf_randomize_face|tf_is_merchant, scn_town_29_store|entry(1), 0, fac_merc1,[itm_arena_tunic_green, itm_cheap_shoes],def_attrib|level(5),wp(20),knows_inventory_management_10, mercenary_face_1, mercenary_face_2],
["specialmerch7","Fogartach","{!}Weaponsmith",tf_hero|tf_randomize_face|tf_is_merchant, scn_town_40_store|entry(2), 0, fac_merc1,[itm_leather_aprontunic,itm_cheap_shoes],def_attrib|level(5),wp(20),knows_inventory_management_10, mercenary_face_1, mercenary_face_2],
Script the addition of items with add_items
("refresh_special_merchants1",
Code:
[
(reset_item_probabilities, 100),
(set_merchandise_modifier_quality, 230),
#(try_for_range, ":cur_merchant", special_merchants_begin, special_merchants_end),
#(store_sub, ":cur_town", ":cur_merchant", weapon_merchants_begin),
#(val_add, ":cur_town", towns_begin), try_begin),
#(this_or_next|eq, ":cur_merchant", trp_specialmerch1),
#(eq, ":cur_merchant",trp_specialmerch7),
(troop_clear_inventory, "trp_specialmerch1"),
(troop_add_items, "trp_specialmerch1", itm_noblearmor11res,2),
(troop_add_items, "trp_specialmerch1", itm_noblearmor14res,1),
(troop_add_items, "trp_specialmerch1", itm_noblearmor15res,1),
(troop_add_items, "trp_specialmerch1", itm_noblearmor18res,1),
(troop_add_items, "trp_specialmerch1", itm_saxonhelmt4face,1),
(troop_add_items, "trp_specialmerch1_chest", itm_noblearmor1res, 4),
(troop_clear_inventory, "trp_specialmerch2"),
(troop_add_items, "trp_specialmerch2", itm_longmail_coat_kingred,1),
(troop_add_items, "trp_specialmerch2", itm_noblearmor8res, 1),
(troop_add_items, "trp_specialmerch2", itm_goat_nobleman_helm, 1),
(troop_add_items, "trp_specialmerch2", itm_resanglehelmet_gold,1),
(troop_add_items, "trp_specialmerch2", itm_noblearmor21res,1),
Add a trigger:
Code:
(0.0, 0, 228.0, [],
[
(call_script, "script_refresh_special_merchants1"),
]),
Dialog:
Code:
[anyone, "start", [(is_between, "$g_talk_troop", special_merchants_begin, special_merchants_end,),],
"Good day {sir/madam}, what do you want? I'm quite busy", "special_merchant_talk", []],
[anyone|plyr, "special_merchant_talk", [], "I was told you have some of the finest gear in Brytenwalda. What makes your goods so special?", "herrero_buy", []],
#[anyone,"herrero_buy", [(troop_slot_ge, "trp_player", slot_troop_renown, 400),], "I only sell the noblest of the noble. Are you sure you qualify?", "herrero_buy2", []],
[trp_specialmerch1,"herrero_buy", [(troop_slot_ge, "trp_player", slot_troop_renown, 400),], "Haven't you hard that the Lorica is the latest must-have in Paris? I have an exclusive connection to merchants in Paris who import from all over Europe", "herrero_buy2", []],
[trp_specialmerch2,"herrero_buy", [(troop_slot_ge, "trp_player", slot_troop_renown, 400),], "The warlords of Mierce prefer Red when leading in battle. Red is for victory!", "herrero_buy2", []],
[trp_specialmerch3,"herrero_buy", [(troop_slot_ge, "trp_player", slot_troop_renown, 400),], "I have one of the best purple dyes from a secret Greek Island. Leaders come to me for Royal armor or tunics.", "herrero_buy2", []],
[trp_specialmerch4,"herrero_buy", [(troop_slot_ge, "trp_player", slot_troop_renown, 400),], "I import scale armor from a merchant in Byzantium. Both women and men enjoy these for their spaciousness and comfort.", "herrero_buy2", []],
[trp_specialmerch5,"herrero_buy", [(troop_slot_ge, "trp_player", slot_troop_renown, 400),], "White and Gold were the colors of King Arthur's court. See the armor of Christian nobles.", "herrero_buy2", []],
[trp_specialmerch6,"herrero_buy", [(troop_slot_ge, "trp_player", slot_troop_renown, 400),], "I use the finest purple imported from Italy. Purple Armor on the battlefield will make you a leader.", "herrero_buy2", []],
[trp_specialmerch7,"herrero_buy", [(troop_slot_ge, "trp_player", slot_troop_renown, 400),], "Blue is the traditional color of leadership on these islands while green is a mark of virtue.", "herrero_buy2", []],
#[anyone|plyr, "herrero_buy2", [], "Yes. Let me have a look.","herrero_window",[(change_screen_trade, "trp_specialmerch1_chest"),]],
[trp_specialmerch1|plyr, "herrero_buy2", [], "Yes. Let me have a look.","herrero_window",[(change_screen_trade, "trp_specialmerch1"),]],##works
[trp_specialmerch2|plyr, "herrero_buy2", [], "I certainly want to be victorious like Penda.","herrero_window",[(change_screen_trade, "$g_talk_troop"),]], ##works
[trp_specialmerch3|plyr, "herrero_buy2", [], "Yes. Let me have a look.","herrero_window",[[change_screen_trade]]], ##works
[trp_specialmerch4|plyr, "herrero_buy2", [], "Yes. Let me have a look.","herrero_window",[(change_screen_trade, trp_specialmerch4_chest),]], ##works
[trp_specialmerch5|plyr, "herrero_buy2", [], "Yes. Let me have a look.","herrero_window",[(change_screen_trade, "trp_specialmerch5_chest"),]], ##works
[trp_specialmerch6|plyr, "herrero_buy2", [], "Yes. Let me have a look.","herrero_window",[(change_screen_trade, trp_specialmerch6),]], ##works
[trp_specialmerch7|plyr, "herrero_buy2", [], "Yes. Let me have a look.","herrero_window",[(change_screen_trade, "trp_specialmerch7"),]], ##works
#[anyone|plyr, "herrero_buy2", [], "I am certainly. Let me have a look.","herrero_window",[(change_screen_trade, "trp_specialmerch7"),]], ##works
[anyone,"herrero_buy", [], "Sorry, friend, but my work is for prestigious men only (450 renown). Come back when you improve your renown.", "close_window",[]],
[anyone,"herrero_window", [], "Good Luck. Remember my name if you need something. Farewell.", "close_window",[]],
Notice that this worked 6 different ways with the screen_trade command!
Even when I put trp_specialmerch4_chest, it still showed the gear from trp_specialmerch4!!
Why is that? It completely ignored the gear I was assigning to the trp_chests.