Another small piece of code...
Make the starting merchant and his brother look like they are related.
This is how:
In module_dialogs.py find the dialogue that starts our first conversation with the merchant. Look for "start_up_quest_1_next"
This is how it looks in my module system:
The code above requires an operation that normally isn't declared in WB vanilla header_operations.py, but is supported by game engine, so we gotta declare it:
The operation is documented here: https://mbcommands.fandom.com/wiki/Operators
Now you can use the fact that every town has its own merchant and for example go to module_troops.py and set face codes for merchants so that their ethnicity matches the town.
I recommend Swyter's editor for that, as it allows you to paste in existing face codes and modify them:
https://swyter.github.io/mab-tools/face
Make the starting merchant and his brother look like they are related.
This is how:
In module_dialogs.py find the dialogue that starts our first conversation with the merchant. Look for "start_up_quest_1_next"
This is how it looks in my module system:
Python:
#Quest 0 - Alley talk
[anyone|auto_proceed,"start",
[
(is_between,"$g_talk_troop","trp_swadian_merchant","trp_startup_merchants_end"),
(eq,"$talk_context",tc_back_alley),
(eq,"$talked_with_merchant",0),
],
"{!}.",
"start_up_quest_1_next",
[
#MOD BEGIN - starting merchant and his brother look like they are related
#merchant's face is randomized, but each town has different merchant, and we can set his face to match the town's culture (so Swadian-looking guy in Praven, Sarranid-looking guy in Shariz)
#merchant's younger brother however is just 1 NPC regardless of city, so we have to set his face in runtime
(str_store_agent_face_keys,s59,"$g_talk_agent"), #get merchant's face code
(face_keys_set_beard,s59,0), #remove beard from it, for younger look
(face_keys_get_age,reg59,s59), #get age from face code
(val_mul,reg59,3), #merchant's age is between 20-80% range of the slider, where min and max are roughly 20 years and 60 (upper limit is highly random, but on avg)
(val_div,reg59,4), #reduce value by 25%, this should give us visibly younger face
(face_keys_set_age,s59,reg59), #put newly calculated age into face code
(troop_set_face_keys,"trp_relative_of_merchant",s59), #set the modified face code to merchant's brother
#MOD END - starting merchant and his brother look like they are related
]
],
[anyone,"start_up_quest_1_next",
[],
"Are you all right? Well... I guess you're alive, at any rate. I'm not sure that we can say the same for the other fellow. That's one less thief to trouble our streets at night, although Heaven knows he won't be the last... Anyway, maybe you can help me with something. Let's talk more inside. Out here, we don't know who's listening.", #MOD - typos
"close_window",
[
(assign,"$talked_with_merchant",1),
(mission_disable_talk),
]
],
The code above requires an operation that normally isn't declared in WB vanilla header_operations.py, but is supported by game engine, so we gotta declare it:
Python:
player_set_face_keys = 2748 #(player_set_face_keys, <player_id>, <string_no>), #Sets <player_id>'s face keys from string.
#MOD BEGIN - starting merchant and his brother look like they are related
str_store_agent_face_keys = 2749 #(str_store_agent_face_keys, <string_reg>, <agent_id>), #Stores agent face code. Regular agents have random generated face from two face codes of the troop.
#MOD END - starting merchant and his brother look like they are related
str_store_troop_face_keys = 2750 #(str_store_troop_face_keys, <string_no>, <troop_no>, [<alt>]), #Stores <troop_no>'s face key into string. if [<alt>] is non-zero the second pair of face keys is stored
Now you can use the fact that every town has its own merchant and for example go to module_troops.py and set face codes for merchants so that their ethnicity matches the town.
I recommend Swyter's editor for that, as it allows you to paste in existing face codes and modify them:
https://swyter.github.io/mab-tools/face
Last edited: