I taught the other day and had idea about diplomacy. I created something, implemented it into my mod and it worked, not perfect but worked. And than I founded sod source wich had that I had but in much, much better version, so I combined my stuff and source I found. So if you going to use this, give 99% credits to sod creator and 1% to me for retyping and some minor addons, so here it goes:
module.troops.py: (between merchant and seneschals)
## ["merchant_20","merchant_20_F","merchant_20_F",tf_hero|tf_female, 0,0, fac_merchants,[itm_courser, itm_arming_sword, itm_padded_leather, itm_leather_boots, ], def_attrib|level(15),wp(100),knows_inventory_management_10, 0x000000000010500401f6837d27688212],
#test court
["imperial_chancellor", "Diplomacy Advisor", "Diplomacy Advisor", tf_hero|tf_is_merchant, 0,reserved, fac_neutral,[ itm_courtly_outfit, itm_blue_hose], def_attrib|level(2),wp(20),knows_common, 0x0000000e810011125c1b6db71b89b72000000000001e38d50000000000000000],
["imperial_marshal", "Military Advisor", "Military Advisor", tf_hero|tf_is_merchant, 0,reserved, fac_neutral,[itm_plate_armor, itm_iron_greaves], def_attrib|level(20),wp(600),knows_common, 0x0000000fbd003044121b6c47db05b6eb00000000001db4e00000000000000000],
["imperial_keeper", "Imperial Armory Keeper", "Imperial Armory Keeper", tf_hero|tf_is_merchant, 0,reserved, fac_neutral,[ itm_courtly_outfit, itm_blue_hose], def_attrib|level(2),wp(20),knows_common, 0x000000083f003094471b6db6db89b73500000000001e353b0000000000000000],
#test court
#Seneschals
module_scripts.py:
find this:
# script_enter_court
and scroll down a bit and make it look like this:
#Adding guards
(store_faction_of_party, ":center_faction", ":center_no"),
(faction_get_slot, ":guard_troop", ":center_faction", slot_faction_guard_troop),
(try_begin),
(le, ":guard_troop", 0),
(assign, ":guard_troop", "trp_swadian_sergeant"),
(try_end),
(set_visitor, 6, ":guard_troop"),
(set_visitor, 7, ":guard_troop"),
#TEST COURT BEGIN
(try_begin),
(this_or_next|eq, ":center_faction", "fac_player_faction"),
(eq, ":center_faction", "fac_player_supporters_faction"),
(set_visitor, 17, "trp_imperial_chancellor"),
(set_visitor, 18, "trp_imperial_marshal"),
(set_visitor, 20, "trp_imperial_keeper"),
(troop_set_slot, "trp_imperial_chancellor", slot_troop_imperial_court, ":center_no"),
(troop_set_slot, "trp_imperial_marshal", slot_troop_imperial_court, ":center_no"),
(troop_set_slot, "trp_imperial_keeper", slot_troop_imperial_court, ":center_no"),
(try_end),
#TEST COURT END
(assign, ":cur_pos", 16),
(call_script, "script_get_heroes_attached_to_center", ":center_no", "p_temp_party"),
(party_get_num_companion_stacks, ":num_stacks","p_temp_party"),
(try_for_range, ":i_stack", 0, ":num_stacks"),
module_dialogs.py:
dialogs = [
#test ########################### OWN KINGDOM MANAGEMENT BEGIN ###########################
# ########################################################################################
# ############################################################
[trp_imperial_marshal, "start", [
(troop_slot_eq, "$g_talk_troop", slot_troop_met_previously, 0),
], "Greetings My King. Thank You for giving me chance to serve you as the Marshall. I will serve you as with utter diligence and care. Whenever You want to discuss military matters such preparing military campaigns, reinforce city troops just talk to me.", "marshal_talk",[
(troop_set_slot, "$g_talk_troop", slot_troop_met_previously, 1),
]],
# ############################################################
[trp_imperial_marshal,"start", [], "My king?", "marshal_talk",[]],
# ############################################################
[trp_imperial_marshal,"marshal_else", [], "Anything else my Lord?", "marshal_talk",[]],
# ############################################################
[trp_imperial_marshal|plyr,"marshal_talk",
[
],
"I want to start a new campaign. Let us assemble the army here.", "marshal_campaign",
[]],
# ############################################################
[trp_imperial_marshal|plyr, "marshal_talk", [], "I want to know location of one of my wassals.", "marshal_location",[
]],
# ############################################################
[trp_imperial_marshal|plyr,"marshal_talk",
[
],
"I want to recruit some town militia, my towns are weekly defended.", "marshal_militia",
[]],
# ############################################################
[trp_imperial_marshal|plyr,"marshal_talk",
[
],
"I want to recruit some elite infantry.", "marshal_infantry",
[]],
# ############################################################
[trp_imperial_marshal|plyr,"marshal_talk",
[
],
"I want to recruit some elite cavalry.", "marshal_cavalry",
[]],
# ############################################################
[trp_imperial_marshal|plyr, "marshal_talk", [], "Never mind.", "close_window",[]],
# ############################################################
[trp_imperial_marshal,"marshal_campaign", [],
"You wish to summon all lords for a new campaign?", "marshal_campaign1",[]],
# ############################################################
[trp_imperial_marshal|plyr,"marshal_campaign1", [], "Yes. We must gather all our forces before we march on the enemy.", "marshal_campaign2",[]],
# ############################################################
[trp_imperial_marshal|plyr,"marshal_campaign1", [], "On second thought, it won't be necessary to summon everyone.", "marshal_else",[]],
# ############################################################
[trp_imperial_marshal,"marshal_campaign2",
[],
"All right then. I will send messengers and tell everyone to come here.", "marshal_talk",
[
(faction_set_slot, "$players_kingdom", slot_faction_ai_state, sfai_gathering_army),
(assign, "$g_recalculate_ais", 1),
]],
# ############################################################
[trp_imperial_marshal,"marshal_location", [],
"Very well, I shall tell you what I know. About whom do you wish to hear?", "marshal_location2",[]],
# ############################################################
[trp_imperial_marshal|plyr|repeat_for_troops,"marshal_location2", [(store_repeat_object, ":troop_no"),
(neq, "$g_talk_troop", ":troop_no"),
(is_between, ":troop_no", heroes_begin, heroes_end),
(this_or_next|troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
(store_troop_faction, ":faction_no", ":troop_no"),
(eq, "fac_player_supporters_faction", ":faction_no"),
(str_store_troop_name, s1, ":troop_no")],
"{s1}", "marshal_location3",[(store_repeat_object, "$hero_requested_to_learn_location")]],
# ############################################################
[trp_imperial_marshal|plyr, "marshal_location2", [], "I have a different question.", "marshal_else",[]],
# ############################################################
[trp_imperial_marshal,"marshal_location3",
[
(call_script, "script_update_troop_location_notes", "$hero_requested_to_learn_location", 1),
(call_script, "script_get_information_about_troops_position", "$hero_requested_to_learn_location", 0),
],
"{s1}", "marshal_talk",[]],
# ############################################################
[trp_imperial_marshal,"marshal_militia", [],
"Yes my lord, they are ready to serve you.", "marshal_militia1",[]],
# ############################################################
[trp_imperial_marshal|plyr, "marshal_militia1", [], "Good, thank you.", "marshal_militia2",[]],
# ############################################################
[trp_imperial_marshal,"marshal_militia2", [
(party_add_members, "p_main_party", "trp_imperial_militia", 5)], "Glad to be of service to your highness, anything else?", "marshal_else",[]],
# ############################################################
[trp_imperial_marshal,"marshal_infantry", [],
"Yes my lord, they are finest infantry you can find in Calardia.", "marshal_infantry1",[]],
# ############################################################
[trp_imperial_marshal|plyr, "marshal_infantry1", [], "Fine, thank you.", "marshal_infantry2",[]],
# ############################################################
[trp_imperial_marshal,"marshal_infantry2", [
(party_add_members, "p_main_party", "trp_imperial_guard", 5)], "Glad to be of service to your highness, anything else?", "marshal_else",[]],
# ############################################################
[trp_imperial_marshal,"marshal_cavalry", [],
"Yes my lord, they are finest cavalry anybody saw.", "marshal_cavalry1",[]],
# ############################################################
[trp_imperial_marshal|plyr, "marshal_cavalry1", [], "I shall test them on field, thank you.", "marshal_cavalry2",[]],
# ############################################################
[trp_imperial_marshal,"marshal_cavalry2", [
(party_add_members, "p_main_party", "trp_imperial_cataphract", 5)], "Glad to be of service to your highness, anything else?", "marshal_else",[]],
# ############################################################
# ############################################################
# CHANCELLOR
# ############################################################
[trp_imperial_chancellor, "start", [
(troop_slot_eq, "$g_talk_troop", slot_troop_met_previously, 0),
], "Greetings Your Highness. Thank You for appointing me for as your Chancellor. I will serve and be available for you whenever needed. Whenever You want to discuss matters such as managing Your fiefs, recruiting Lords, declaring war or other kingdom management matters just call me.", "chancellor_talk",[
(troop_set_slot, "$g_talk_troop", slot_troop_met_previously, 1),
]],
# ############################################################
[trp_imperial_chancellor,"start", [], "Yes my King?", "chancellor_talk",[]],
# ############################################################
[trp_imperial_chancellor,"chancellor_else", [], "Anything else my King?", "chancellor_talk",[]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_talk", [], "I want to recruit new Lord", "chancellor_lord1",[
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_talk", [], "I want to manage my fiefs.", "chancellor_fiefs1",[
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_talk", [], "I want to declare war on one of the factions.", "chancellor_war",[
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_talk", [], "I want to change our kingdom color.", "chancellor_color",[
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_talk", [], "Never mind.", "close_window",[]],
# ############################################################
[trp_imperial_chancellor, "chancellor_lord1", [
(assign,":num_lords",0),
(try_for_range,":lord","trp_reserved_knight_1","trp_kingdom_1_pretender"),
(troop_slot_eq, ":lord", slot_troop_occupation, slto_kingdom_hero),
(val_add,":num_lords",1),
(try_end),
(assign,":num_centers",0),
(try_for_range, ":center_no", walled_centers_begin, walled_centers_end),
(store_faction_of_party, ":center_faction", ":center_no"),
(eq, ":center_faction", "fac_player_supporters_faction"),
(val_add,":num_centers",1),
(try_end),
(try_begin),
(lt,":num_lords",":num_centers"),
(str_store_string, s1, "@Do you wish to recruit more Lords?"),
(assign, "$territory", 1),
(else_try),
(le,":num_centers",":num_lords"),
(str_store_string, s1, "@We need more territory to recruit additional Lords."),
(assign, "$territory", 0),
(try_end),
], "{s1}", "chancellor_lord1",[
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_lord1", [
(eq, "$territory", 1),
], "Recruit new lord.", "chancellor_else",[
(assign, ":stop", 0),
(try_for_range, ":lord", "trp_reserved_knight_1", "trp_kingdom_1_pretender"),
(neq, ":stop", 1),
(neg|troop_slot_eq, ":lord", slot_troop_occupation, slto_kingdom_hero),
(assign, ":cur_lord", ":lord"),
(assign, ":stop", 1),
(try_end),
(neq, ":stop", 0),
(troop_set_slot, ":cur_lord", slot_troop_change_to_faction, "fac_player_supporters_faction"),
(troop_set_slot, ":cur_lord", slot_troop_occupation, slto_kingdom_hero),
(troop_set_slot, ":cur_lord", slot_troop_wealth, 6000),
(troop_get_slot, ":selected_banner_spr", "trp_player", slot_troop_banner_scene_prop),
(troop_set_slot, ":cur_lord", slot_troop_banner_scene_prop, ":selected_banner_spr"),
(troop_set_slot, ":cur_lord", slot_troop_original_faction, "fac_player_supporters_faction"),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_lord1", [
], "Let's look at other topics to make decisions about.", "chancellor_else",[
]],
# ############################################################
[trp_imperial_chancellor, "chancellor_fiefs1", [
], "Which topic is of interest to you, my Liege?", "chancellor_fiefs2",[
]],
# ############################################################
[trp_imperial_chancellor|plyr|repeat_for_parties, "chancellor_fiefs2", [
(store_repeat_object, ":fief"),
(is_between, ":fief", "p_town_1", "p_salt_mine"),
(store_faction_of_party, ":center_faction", ":fief"),
(eq, ":center_faction", "fac_player_supporters_faction"),
(str_store_party_name, s1, ":fief"),
(party_get_slot, ":lord", ":fief", slot_town_lord),
(str_store_troop_name,s2,":lord"),
], "{s1} belonging to {s2}", "chancellor_fiefs3",[
(store_repeat_object, "$temp_fief"),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_fiefs2", [
], "Let's look at other topics to make decisions about.", "chancellor_else",[
]],
# ############################################################
[trp_imperial_chancellor, "chancellor_fiefs3", [
(party_get_slot, ":lord", "$temp_fief", slot_town_lord),
(str_store_party_name,s2,"$temp_fief"),
(str_store_troop_name,s3,":lord"),
], "{s2} belongs to {s3}. Who shall be your vassal to manage these lands?", "chancellor_fiefs3",[
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_fiefs3", [
], "I want it for Myself.", "chancellor_else",[
(call_script, "script_give_center_to_lord", "$temp_fief", "trp_player", 0),
]],
# ############################################################
[trp_imperial_chancellor|plyr|repeat_for_troops, "chancellor_fiefs3", [
(store_repeat_object, ":lord"),
(is_between, ":lord", "trp_reserved_knight_1", "trp_kingdom_1_pretender"),
(troop_slot_eq, ":lord", slot_troop_occupation, slto_kingdom_hero),
(str_store_party_name, s1, "$temp_fief"),
(str_store_troop_name,s2,":lord"),
], "Assign {s1} to {s2}.", "chancellor_else",[
(store_repeat_object, "$temp_lord"),
(call_script, "script_give_center_to_lord", "$temp_fief", "$temp_lord", 0),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_fiefs3", [
], "Let's look at other topics to make decisions about.", "chancellor_else",[
]],
# ############################################################
[trp_imperial_chancellor, "chancellor_war", [
], "This is a very difficult decision, my Liege. Where should I send the envoy to declare war?", "chancellor_war",[
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_war", [
], "To the Kingdom of Swadia.", "chancellor_else",[
(call_script, "script_make_kingdom_hostile_to_player", "fac_kingdom_1", -3),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_war", [
], "To the Kingdom of Vaegirs.", "chancellor_else",[
(call_script, "script_make_kingdom_hostile_to_player", "fac_kingdom_2", -3),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_war", [
], "To the Khergit Khanate.", "chancellor_else",[
(call_script, "script_make_kingdom_hostile_to_player", "fac_kingdom_3", -3),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_war", [
], "To the Kingdom of Nords.", "chancellor_else",[
(call_script, "script_make_kingdom_hostile_to_player", "fac_kingdom_4", -3),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_war", [
], "To the Kingdom of Rhodoks.", "chancellor_else",[
(call_script, "script_make_kingdom_hostile_to_player", "fac_kingdom_5", -3),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_war", [
], "To the Imperial Expeditionary Forces.", "chancellor_else",[
(call_script, "script_make_kingdom_hostile_to_player", "fac_kingdom_6", -3),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_war", [
], "Let's look at other topics to make decisions about.", "chancellor_else",[
]],
# ############################################################
[trp_imperial_chancellor, "chancellor_color", [
], "Which color would suit our kingdom most, Your Highness?", "chancellor_color",[
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_color", [
], "Black.", "chancellor_else",[
(faction_set_color, "fac_player_supporters_faction", 0x000000),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_color", [
], "White.", "chancellor_else",[
(faction_set_color, "fac_player_supporters_faction", 0xFFFFFF),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_color", [
], "Blue.", "chancellor_else",[
(faction_set_color, "fac_player_supporters_faction", 0x4876FF),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_color", [
], "Wheat.", "chancellor_else",[
(faction_set_color, "fac_player_supporters_faction", 0xCDBA96),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_color", [
], "Red.", "chancellor_else",[
(faction_set_color, "fac_player_supporters_faction", 0xFF4500),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_color", [
], "Green.", "chancellor_else",[
(faction_set_color, "fac_player_supporters_faction", 0x32CD32),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_color", [
], "Purple.", "chancellor_else",[
(faction_set_color, "fac_player_supporters_faction", 0x9400D3),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_color", [
], "Gold.", "chancellor_else",[
(faction_set_color, "fac_player_supporters_faction", 0xFFB90F),
]],
# ############################################################
[trp_imperial_chancellor|plyr, "chancellor_color", [
], "Let's look at other topics to make decisions about.", "chancellor_else",[
]],
# ############################################################
# ############################################################
##############################################################
# ############################################################
##############################################################
### ARMORY KEEPER
##############################################################
# ############################################################
[trp_imperial_keeper, "start", [
(troop_slot_eq, "$g_talk_troop", slot_troop_met_previously, 0),
], "Greetings My King. Thank You for put me in place of trust.", "keeper_talk",[
(troop_set_slot, "$g_talk_troop", slot_troop_met_previously, 1),
]],
# ############################################################
[trp_imperial_keeper,"start", [], "My king?", "keeper_talk",[]],
# ############################################################
[trp_imperial_keeper,"keeper_else", [], "Anything else my Lord?", "keeper_talk",[]],
# ############################################################
[trp_imperial_keeper|plyr,"keeper_talk",
[
],
"I have a need for some armour.", "keeper_armor",
[]],
# ############################################################
[trp_imperial_keeper|plyr,"keeper_talk",
[
],
"I need some armour for one of my vassals.", "keeper_vassal",
[]],
# ############################################################
[trp_imperial_keeper|plyr,"keeper_talk",
[
],
"I have a need for some weapons.", "keeper_sword",
[]],
# ############################################################
[trp_imperial_keeper|plyr,"keeper_talk",
[
],
"I have a need for some weapons for one of my vassal.", "keeper_weapon",
[]],
# ############################################################
[trp_imperial_keeper|plyr, "keeper_talk", [], "Never mind.", "close_window",[]],
# ############################################################
[trp_imperial_keeper,"keeper_armor", [],
"Yes my lord, my best armoureer just brought this to me.", "keeper_armor1",[]],
# ############################################################
[trp_imperial_keeper|plyr,"keeper_armor1",
[
],
"Good I shall take it, thank you.", "keeper_armor2",
[]],
# ############################################################
[trp_imperial_keeper,"keeper_armor2", [
(troop_add_item,"trp_player","itm_winged_great_helmet",imod_lordly),
(troop_add_item,"trp_player","itm_plate_armor",imod_lordly),
(troop_add_item,"trp_player","itm_iron_greaves",imod_lordly),
(troop_add_item,"trp_player","itm_gauntlets",imod_lordly)], "I hope that this armour will serve you well my Lord, anything else?", "keeper_else",[]],
# ############################################################
[trp_imperial_keeper,"keeper_vassal", [],
"Yes my lord, my best armoureer just brought one you need.", "keeper_vassal1",[]],
# ############################################################
[trp_imperial_keeper|plyr,"keeper_vassal1",
[
],
"Good I shall take it for them, thank you.", "keeper_vassal2",
[]],
# ############################################################
[trp_imperial_keeper,"keeper_vassal2", [
(troop_add_item,"trp_player","itm_great_helmet",imod_lordly),
(troop_add_item,"trp_player","itm_coat_of_plates",imod_lordly),
(troop_add_item,"trp_player","itm_mail_boots",imod_lordly),
(troop_add_item,"trp_player","itm_mail_mittens",imod_lordly)], "I hope that this armour will serve you well my Lord, anything else?", "keeper_else",[]],
# ############################################################
[trp_imperial_keeper,"keeper_sword", [],
"Yes my lord, my best smith brought this morning this arms.", "keeper_sword1",[]],
# ############################################################
[trp_imperial_keeper|plyr,"keeper_sword1",
[
],
"Exelent, thank you.", "keeper_sword2",
[]],
# ############################################################
[trp_imperial_keeper,"keeper_sword2", [
(troop_add_item,"trp_player","itm_bastard_sword_b",imod_masterwork),
(troop_add_item,"trp_player","itm_tab_shield_round_e",imod_reinforced)], "I hope that you will find this arms worty of your Highness, anything else?", "keeper_else",[]],
# ############################################################
[trp_imperial_keeper,"keeper_weapon", [],
"Yes my lord, my smith brought me this, I hope it will do.", "keeper_weapon1",[]],
# ############################################################
[trp_imperial_keeper|plyr,"keeper_weapon1",
[
],
"Nice balanced, thank you.", "keeper_weapon2",
[]],
# ############################################################
[trp_imperial_keeper,"keeper_weapon2", [
(troop_add_item,"trp_player","itm_bastard_sword_a",imod_masterwork),
(troop_add_item,"trp_player","itm_tab_shield_round_e",imod_reinforced)], "I hope this sword will serve you well in hands of your vassals, anything else my King?", "keeper_else",[]],
# ############################################################
as it is obvious I created new troop tree for my self(earlier) and implemented it, so put in your own or put original troops created for this okm.
and in module_constants.py:
slot_troop_imperial_court = 210
mine is on the bottom, but you can place yours where you want.
Thats it for now. I will probably update it when I find more time to work on it, and untill that time comes you can try to modify it yourself. The things I couldnt do because of my low scripting experience is:
I got this piece of game_menu code:
("action_modify_banner",[],"Choose new heraldry.",
[
(start_presentation, "prsnt_banner_selection"),
#(start_presentation, "prsnt_custom_banner"),
]
),
so if anybody knows how to do it, it would be nice.
Known problems:
I tested it and it worked good, but one thing was going on my nervs and I couldnt fix it. I placed trp_militia to stand in town as guards, and trp_militia_sergeant to be prison/castle guard, and when i implemented this town guards are Vaeghir lower troops and castle/prison guards doesnt exist at all. So I need help about that.