Will this work??

Users who are viewing this thread

Does anyone know if this code would work, so like i could buy a castle or town or village from a lord??
Plus has anyone got a tutorial on how to make kingdom management or kingdom name/colour changer menus in the module system

from module_dialogues.py
Code:
##  [anyone,"lord_start", [(troop_slot_eq, "$g_talk_troop", slot_troop_is_prisoner, 0),
##                         (ge,"$g_talk_troop_faction_relation",0),
##                         (call_script, "script_get_number_of_unclaimed_centers_by_player"),
##                         (gt, reg1, 0),
##                         (assign, "$center_wanted_to_be_bought", reg1),
##                         (str_store_party_name, s4, "$center_wanted_to_be_bought"),
##                         (call_script, "script_get_number_of_hero_centers", "$g_talk_troop"),
##                         (assign, ":no_of_owned_centers", reg0),
##                         (neg|faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
##                         (lt, ":no_of_owned_centers", 2),
##                         (troop_get_slot, ":wealth", "$g_talk_troop", slot_troop_wealth),
##                         (ge, ":wealth", 6000)],
##   "I heard that your forces have taken {s4}. I applaud your victory {playername}, but you know as well as I do that\
## as a person of low rank and status you cannot be permitted to hold that castle for yourself.\
## It is to your benefit to sell it to a Lord like myself who can hold and protect the castle and the surrounding estates.\
## Anyway, I am ready to make you an offer of 5000 denars, should you decide to sell that castle.", "lord_buy_center", []],
##
##
##  [anyone|plyr,"lord_buy_center", [],
##   "I accept your offer sir. The castle is yours for 5000 denars.", "lord_buy_center_accept", []],
##  [anyone|plyr,"lord_buy_center", [],
##   "I am afraid I can't accept that offer.", "lord_buy_center_deny", []],
##
##  [anyone,"lord_buy_center_accept", [],
##   "Excellent, {playername}! You have decided wisely.\
## Why bother yourself with the necessities of keeping a castle while you can leave all those boring details to noble Lords like me?\
## I am sure money will be much more useful to you than a castle would.", "lord_buy_center_accept_2", []],
##
##  [anyone|plyr,"lord_buy_center_accept_2", [],
##   "One day sir, one day I'll have my own castle.", "lord_buy_center_accept_3", []],
##  [anyone|plyr,"lord_buy_center_accept_2", [],
##   "Everyone needs money sir. I can take another castle anytime.", "lord_buy_center_accept_3", []],
##
##  [anyone,"lord_buy_center_accept_3", [],
##   "Of course, of course, {playername}.  Then let us conclude our deal. Here's the 5000 denars I offered you.\
## I'll have my clerk handle the necessary details.\
## I guess from now on, {s4} belongs to me. Well, that worked very well for both of us, I guess.", "lord_pretalk",
##   [(troop_get_slot, ":wealth", "$g_talk_troop", slot_troop_wealth),
##    (val_sub, ":wealth", 6000),
##    (troop_set_slot, "$g_talk_troop", slot_troop_wealth, ":wealth"),
##    (call_script, "script_troop_add_gold", "trp_player", 5000),
##    (party_set_slot, "$center_wanted_to_be_bought", slot_town_lord, "$g_talk_troop"),
##    #Changing center faction
##    (party_set_faction, "$center_wanted_to_be_bought", "$g_talk_troop_faction"),
##    (set_spawn_radius, 1),
##    (spawn_around_party, "$center_wanted_to_be_bought", "pt_old_garrison"),
##    (assign, ":new_party", reg0),
##    (party_set_ai_behavior, ":new_party", ai_bhvr_attack_party),
##    (party_set_ai_object, ":new_party", "p_main_party"),
##    (party_set_flags, ":new_party", pf_default_behavior, 0),
##    (call_script, "script_party_copy", ":new_party", "$center_wanted_to_be_bought"),
##    (party_clear, "$center_wanted_to_be_bought"),
##
##    (faction_get_slot, ":reinforcement_template_archers", "$g_talk_troop_faction", slot_faction_reinforcements_archers),
##    (faction_get_slot, ":reinforcement_template_infantry", "$g_talk_troop_faction", slot_faction_reinforcements_infantry),
##    (party_add_template, "$center_wanted_to_be_bought", ":reinforcement_template_archers"),
##    (party_add_template, "$center_wanted_to_be_bought", ":reinforcement_template_infantry"),
##    ]],
##
##  [anyone,"lord_buy_center_deny", [],
##   "As you wish {playername}. But don't forget, the great lords of the country won't like a low born {man/woman} like you holding such an estate without their consent.\
## It is the nature of this world {playername}. Everyone should know their place.", "lord_pretalk", []],
 
Actually that code as is does the opposite you're selling a castle to the lord. It might be possible to reverse the code so that you would be buying it, but I'm not sure exactly how to do that.
 
Hello there..

You are asking three things.

Does this code work?  I have no idea. un-comment it out and test it.

How to handle Kingdom Management: Do you mean how to manage your kingdom, or how to create a "player as king" option or both?  The former is fairly easy,  The latter must be done very carefully.  I have implemented it recently, and it was a real pain and am still finding little things to deal with. 

Name change:  Take the approach that you need a person in every castle, town or location that you can have a dialogue with in order to manage this function.  Likely the seneschal 's and/or village elders as a possibility. 

I used the seneschals and the players run their kingdom by talking with them.  Here is an example of name changes.  Note, that there currently is one primary input string.. your characters name.  This limits the ways in which you can easily inform your players on how to use it.  Thus, I have given a handful of options for pre-fab names, and let them discover this added option regarding changing their name.. selecting that name of their kingdom, then changing their name back.

Code:
 [anyone,"change_name_of_realm", [],
   "Very well my {Lord/lady}, I believe we have the pages and scribes ready to make the proclimations.. what shall we be called?  Do not let me forget to mention that it will cost 300 gold to accomplish this..(also note that you can modify your name temporarily in the character screen) ", "change_name_of_realm",[]],

        [anyone|plyr,"change_name_of_realm", [(str_store_string,s2, "@The Royal Kingdom of Pendor") ],
      "{s2}", "pop_diplomacy_menu1",[(str_store_string,s2, "@The Royal Kingdom of Pendor") ,(faction_set_name, "fac_kingdom_6", s2),(troop_remove_gold,"trp_player",300)]],
         [anyone|plyr,"change_name_of_realm", [(str_store_string,s2, "@The Kingdom of Pendor") ],
      "{s2}", "pop_diplomacy_menu1",[(str_store_string,s2, "@The Kingdom of Pendor"),(faction_set_name, "fac_kingdom_6", s2),(troop_remove_gold,"trp_player",300)]],
         [anyone|plyr,"change_name_of_realm", [(str_store_string,s2, "@The Dynasty of {playername}") ],
      "{s2}", "pop_diplomacy_menu1",[(str_store_string,s2, "@The Dynasty of {playername}") ,(faction_set_name, "fac_kingdom_6", s2),(troop_remove_gold,"trp_player",300)]],
        [anyone|plyr,"change_name_of_realm", [(str_store_string,s2, "@The Kingdom of {playername}") ],
      "{s2}", "pop_diplomacy_menu1",[(str_store_string,s2, "@The Kingdom of {playername}"),(faction_set_name, "fac_kingdom_6", s2),(troop_remove_gold,"trp_player",300)]],
         [anyone|plyr,"change_name_of_realm", [(str_store_string,s2, "@The City States of Pendor") ],
      "{s2}", "pop_diplomacy_menu1",[(str_store_string,s2, "@The City States of Pendor") ,(faction_set_name, "fac_kingdom_6", s2),(troop_remove_gold,"trp_player",300)]],
        [anyone|plyr,"change_name_of_realm", [(str_store_string,s2, "@The Principalities of Pendor") ],
      "{s2}", "pop_diplomacy_menu1",[(str_store_string,s2, "@The Principalities of Pendor") ,(faction_set_name, "fac_kingdom_6", s2),(troop_remove_gold,"trp_player",300)]],
        [anyone|plyr,"change_name_of_realm", [(str_store_string,s2, "@The {playername}") ],
      "{s2}", "pop_diplomacy_menu1",[(str_store_string,s2, "@The {playername}"),(faction_set_name, "fac_kingdom_6", s2),(troop_remove_gold,"trp_player",300)]],
        
        
    [anyone|plyr,"change_name_of_realm", [],
   "Hmm.. our name is fine for now..", "pop_diplomacy_menu1",[]],

Color change:  Same concept as the name change.. a series of options in dialogue.. Note that the color must be in Hex format.  I searched for hexadecimal color charts in Google and found some great resources.  Here is a code example. 


Code:
[anyone,"pop_change_color1", [],
         "Very well {sir/madame}, I shall call for the Artists.. please select your color.", "pop_change_color",[]],

         [anyone|plyr,"pop_change_color", [],
         "Change the color to Buff", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xF0DC82),(faction_set_color, "fac_player_supporters_faction", 0xF0DC82),(faction_set_color, "fac_player_faction", 0xF0DC82)]],

         [anyone|plyr,"pop_change_color", [],
         "Change the color to Yellow", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xFFEF00),(faction_set_color, "fac_player_supporters_faction", 0xFFEF00),(faction_set_color, "fac_player_faction",  0xFFEF00)]],
        
           [anyone|plyr,"pop_change_color", [],
         "Change the color to Violet", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xEE82EE),(faction_set_color, "fac_player_supporters_faction", 0xEE82EE),(faction_set_color, "fac_player_faction", 0xEE82EE)]],

          [anyone|plyr,"pop_change_color", [],
         "Change the color to Sea Shell Tan", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xFFF5EE),(faction_set_color, "fac_player_supporters_faction", 0xFFF5EE),(faction_set_color, "fac_player_faction", 0xFFF5EE)]],

          [anyone|plyr,"pop_change_color", [],
         "Change the color to Purple", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x8B00FF),(faction_set_color, "fac_player_supporters_faction", 0x8B00FF),(faction_set_color, "fac_player_faction", 0x8B00FF)]],

          [anyone|plyr,"pop_change_color", [],
         "Change the color to Turquoise", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x30D5C8),(faction_set_color, "fac_player_supporters_faction", 0x30D5C8),(faction_set_color, "fac_player_faction", 0x30D5C8)]],

         [anyone|plyr,"pop_change_color", [],
         "Change the color to Terra Cotta", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xE2725B),(faction_set_color, "fac_player_supporters_faction", 0xE2725B),(faction_set_color, "fac_player_faction",  0xE2725B)]],

         [anyone|plyr,"pop_change_color", [],
         "Change the color to Teal", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x008080),(faction_set_color, "fac_player_supporters_faction", 0x008080),(faction_set_color, "fac_player_faction", 0x008080)]],

         [anyone|plyr,"pop_change_color", [],
         "Change the color to Sandy Brown", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xF4A460),(faction_set_color, "fac_player_supporters_faction", 0xF4A460),(faction_set_color, "fac_player_faction", 0xF4A460)]],

         [anyone|plyr,"pop_change_color", [],
         "Change the color to Tangerine", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xF28500),(faction_set_color, "fac_player_supporters_faction", 0xF28500),(faction_set_color, "fac_player_faction", 0xF28500)]],

         [anyone|plyr,"pop_change_color", [],
         "Change the color to Steel Blue", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x4682B4),(faction_set_color, "fac_player_supporters_faction", 0x4682B4),(faction_set_color, "fac_player_faction",0x4682B4)]],

        [anyone|plyr,"pop_change_color", [],
         "Change the color to Salmon", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xFF8C69),(faction_set_color, "fac_player_supporters_faction", 0xFF8C69),(faction_set_color, "fac_player_faction", 0xFF8C69)]],

        [anyone|plyr,"pop_change_color", [],
         "Change the color to Spring Green", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x00FF7F),(faction_set_color, "fac_player_supporters_faction", 0x00FF7F),(faction_set_color, "fac_player_faction", 0x00FF7F)]],

       [anyone|plyr,"pop_change_color", [],
         "Change the color to Black", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x000000),(faction_set_color, "fac_player_supporters_faction", 0x000000),(faction_set_color, "fac_player_faction", 0x00000)]],

        [anyone|plyr,"pop_change_color", [],
         "Change the color to Dark Blue", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x003399),(faction_set_color, "fac_player_supporters_faction", 0x003399),(faction_set_color, "fac_player_faction", 0x003399)]],

        [anyone|plyr,"pop_change_color", [],
         "Change the color to Blue_green", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x00DDDD),(faction_set_color, "fac_player_supporters_faction", 0x00DDDD),(faction_set_color, "fac_player_faction", 0x00DDDD)]],

        [anyone|plyr,"pop_change_color", [],
         "Change the color to White", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xFFFFFF),(faction_set_color, "fac_player_supporters_faction", 0xFFFFFF),(faction_set_color, "fac_player_faction", 0xFFFFFF)]],

       [anyone|plyr,"pop_change_color", [],
         "Change the color to Royal Blue", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x4169E1),(faction_set_color, "fac_player_supporters_faction", 0x4169E1),(faction_set_color, "fac_player_faction", 0x4169E1)]],

       [anyone|plyr,"pop_change_color", [],
         "Change the color to Red-Violet", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xC71585),(faction_set_color, "fac_player_supporters_faction", 0xC71585),(faction_set_color, "fac_player_faction", 0xC71585)]],

        [anyone|plyr,"pop_change_color", [],
         "Change the color to Ravenstern Blue", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x5B92E5),(faction_set_color, "fac_player_supporters_faction", 0x5B92E5),(faction_set_color, "fac_player_faction", 0x5B92E5)]],

        [anyone|plyr,"pop_change_color", [],
         "Change the color to Empire Yellow", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xFFCC00),(faction_set_color, "fac_player_supporters_faction", 0xFFCC00),(faction_set_color, "fac_player_faction", 0xFFCC00)]],

        [anyone|plyr,"pop_change_color", [],
         "Change the color to Sarleon Red", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xFF0000),(faction_set_color, "fac_player_supporters_faction", 0xFF0000),(faction_set_color, "fac_player_faction", 0xFF0000)]],

        [anyone|plyr,"pop_change_color", [],
         "Change the color to D'Shar Brown", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0xC2B280),(faction_set_color, "fac_player_supporters_faction", 0xC2B280),(faction_set_color, "fac_player_faction", 0xC2B280)]],

        [anyone|plyr,"pop_change_color", [],
         "Change the color to Fierdsvain Green", "pop_diplomacy_menu1",[ (faction_set_color, "fac_kingdom_6", 0x03C03C),(faction_set_color, "fac_player_supporters_faction", 0x03C03C),(faction_set_color, "fac_player_faction", 0x03C03C)]],

         #[anyone|plyr,"pop_change_color", [],
         # "Change the color to Purple", "steward_menu",[(store_faction_of_party,":faction"),(faction_set_color,":faction", 0x8A2BE2)]],

Hope that this helps you along the path mate..

Best,

Saxondragon
 
Back
Top Bottom