Recent content by capri_sun

  1. OSP Kit SP Mercenary Camps (of Calradia)

    Code:
    castles_begin = "p_castle_1"
    villages_begin = "p_village_1"
    
    towns_end = castles_begin
    castles_end = villages_begin
    villages_end   = "p_salt_mine"
    
    walled_centers_begin = towns_begin
    walled_centers_end   = castles_end
    
    centers_begin = towns_begin
    centers_end   = villages_end
    
    training_grounds_begin   = "p_training_ground_1"
    training_grounds_end     = "p_Bridge_1"
    
    scenes_begin = "scn_town_1_center"
    scenes_end = "scn_castle_1_exterior"
    
    spawn_points_begin = "p_zendar"
    spawn_points_end = "p_spawn_points_end"
    
    regular_troops_begin       = "trp_novice_fighter"
    regular_troops_end         = "trp_tournament_master"
    
    swadian_merc_parties_begin = "p_town_1_mercs"
    swadian_merc_parties_end   = "p_town_8_mercs"
    
    vaegir_merc_parties_begin  = "p_town_8_mercs"
    vaegir_merc_parties_end    = "p_zendar"
    
    # Merc Camp Begin
    mercenary_camp_begin  = "p_merc_camp_geroia"
    mercenary_camp_end    = "p_merc_camp_end"
    # Merc Camp End
    
    arena_masters_begin    = "trp_town_1_arena_master"
    arena_masters_end      = "trp_town_1_armorer"

    Code:
      # Merc Camp Begin   
      ( "mercenary_camp",0,
        "You approach the mercenary camp...",
        "none",
        [],
        [
          ("enter_geroian_camp",[(eq, "$g_encountered_party", "p_merc_camp_geroia"),],"Visit the Geroian Camp.",[
    		(modify_visitors_at_site,"scn_geroian_camp"),
    		(reset_visitors),    
    		(assign, "$g_mt_mode", tcm_default),   		
    		(set_jump_entry, 1),
    		(set_visitor, 2, "trp_vernid"),
    		(set_visitor, 5, "trp_geroia_sergeant"),
    		(set_visitor, 6, "trp_geroia_swordsman"),
    		(set_visitor, 7, "trp_geroia_swordsman"),
    		(set_visitor, 8, "trp_geroia_pavisier"),
    		(set_visitor, 9, "trp_geroia_pavisier"),
    		(set_jump_mission,"mt_visit_town_castle"),
    		(jump_to_scene,"scn_geroian_camp"),
    		(change_screen_mission),		
    	]),	
          ("enter_balion_camp",[(eq, "$g_encountered_party", "p_merc_camp_balion"),],"Enter the castle of the Knights of Balion.",[
    		(modify_visitors_at_site,"scn_balion_camp"),
    		(reset_visitors),    
    		(assign, "$g_mt_mode", tcm_default),   		
    		(set_jump_entry, 1),
    		(set_visitor, 2, "trp_kornwall"),
    
    		(set_visitor, 5, "trp_balion_knight"),
    		(set_visitor, 6, "trp_balion_infantry"),
    		(set_visitor, 7, "trp_balion_infantry"),
    		(set_visitor, 8, "trp_balion_longbowman"),
    		(set_visitor, 9, "trp_balion_longbowman"),
    		(set_jump_mission,"mt_visit_town_castle"),
    		(jump_to_scene,"scn_balion_camp"),
    		(change_screen_mission),		
    	]),	
          ("enter_jumne_camp",[(eq, "$g_encountered_party", "p_merc_camp_jumne"),],"Enter the Northmen camp.",[
    		(modify_visitors_at_site,"scn_jumne_camp"),
    		(reset_visitors),    
    		(assign, "$g_mt_mode", tcm_default),   		
    		(set_jump_entry, 1),
    		(set_visitor, 2, "trp_sverre"),
    
    		(set_visitor, 5, "trp_jumne_huscarl"),
    		(set_visitor, 6, "trp_jumne_raider"),
    		(set_visitor, 7, "trp_jumne_raider"),
    		(set_visitor, 8, "trp_jumne_raider"),
    		(set_visitor, 9, "trp_jumne_skirmisher"),
    		(set_jump_mission,"mt_visit_town_castle"),
    		(jump_to_scene,"scn_jumne_camp"),
    		(change_screen_mission),		
    	]),	
          ("enter_zendar_camp",[(eq, "$g_encountered_party", "p_merc_camp_zendar"),],"Enter the ruins of Zendar.",[
    		(modify_visitors_at_site,"scn_zendar_camp"),
    		(reset_visitors),    
    		(assign, "$g_mt_mode", tcm_default),   		
    		(set_jump_entry, 1),
    		(set_visitor, 2, "trp_stavros"),
    
    		(set_visitor, 5, "trp_slaver_chief"),
    		(set_visitor, 6, "trp_manhunter"),
    		(set_visitor, 7, "trp_manhunter"),
    		(set_visitor, 8, "trp_manhunter"),
    		(set_visitor, 9, "trp_manhunter"),
    		(set_jump_mission,"mt_visit_town_castle"),
    		(jump_to_scene,"scn_zendar_camp"),
    		(change_screen_mission),		
    	]),	
          ("leave",[],"Leave.",[(leave_encounter),(change_screen_return)]),
        ]
      ),  
    # Merc Camp End   
    
     
       
     ( "recruit_nobles",0,
        "{s18}",
        "none",
        [(store_faction_of_party, ":cur_faction", "$current_town"),
         (faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_5_troop), 
         (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
         (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
         (store_troop_gold, ":gold", "trp_player"),
         (store_div, ":gold_capacity", ":gold", 40),#40 denars per man
         (assign, ":party_capacity", ":free_capacity"),
         (val_min, ":party_capacity", ":gold_capacity"),
         (try_begin),
           (gt, ":party_capacity", 0),
           (val_min, ":volunteer_amount", ":party_capacity"),
         (try_end),
         (assign, reg5, ":volunteer_amount"),
         (assign, reg7, 0),
         (try_begin),
           (gt, ":volunteer_amount", ":gold_capacity"),
           (assign, reg7, 1), #not enough money
         (try_end),
         (try_begin),
           (eq, ":volunteer_amount", 0),
           (str_store_string, s18, "@No one here seems to be willing to join your party."),
         (else_try),
           (store_mul, reg6, ":volunteer_amount", 40),#40 denars per man
           (str_store_troop_name_by_count, s3, ":volunteer_troop", ":volunteer_amount"),
           (try_begin),
             (eq, reg5, 1),
             (str_store_string, s18, "@One {s3} volunteers to follow you."),
           (else_try),
             (str_store_string, s18, "@{reg5} {s3} volunteer to follow you."),
           (try_end),
           (set_background_mesh, "mesh_pic_recruits"),
         (try_end),
        ],
        [
          ("continue_not_enough_gold",
          [
            (eq, reg7, 1),
          ],
          "I don't have enough money...",
          [
      (jump_to_menu, "mnu_town"),
          ]),
           
          ("continue",
          [
            (eq, reg7, 0),
            (eq, reg5, 0),
          ], #noone willing to join                   
          "Continue...",
          [
            (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
      (jump_to_menu, "mnu_town"),
          ]),
           
          ("recruit_them",
          [
            (eq, reg7, 0),
            (gt, reg5, 0),
          ],
          "Recruit them ({reg6} denars).",
          [
            (call_script, "script_town_castle_recruit_nobles_recruit"),
                            
      (jump_to_menu, "mnu_town"),
          ]),
          
          ("forget_it",
          [
            (eq, reg7, 0),
            (gt, reg5, 0),
          ],
          "Forget it.",
          [
      (jump_to_menu, "mnu_town"),
          ]),
        ],
      ),
  2. OSP Kit SP Mercenary Camps (of Calradia)

    Seek n Destroy said:
    That part seems fine to me, did you check the constants and the game menus?
    yeah ill post it in a bit
  3. OSP Kit SP Mercenary Camps (of Calradia)

    Code:
    Initializing...
    Compiling all global variables...
    Exporting strings...
    Exporting skills...
    Exporting tracks...
    Exporting animations...
    Exporting meshes...
    Exporting sounds...
    Exporting skins...
    Exporting map icons...
    Creating new tag_uses.txt file...
    Creating new quick_strings.txt file...
    Exporting faction data...
    Exporting item data...
    Exporting scene data...
    Exporting troops data
    Exporting particle data...
    Exporting scene props...
    Exporting tableau materials data...
    Exporting presentations...
    Exporting party_template data...
    Exporting parties
    Exporting quest data...
    Exporting info_page data...
    Exporting scripts...
    Exporting mission_template data...
    Exporting game menus data...
    exporting simple triggers...
    exporting triggers...
    exporting dialogs...
    Checking global variable usages...
    WARNING: Global variable never used: faction_display
    WARNING: Global variable never used: kaos_disabled
    Imported 21 global variables for saved-game compatability that are not used.
    Exporting postfx_params...
    
    ______________________________
    
    Script processing has ended.
    Press any key to exit. . .


    Code:
          (call_script, "script_update_mercenary_units_of_towns"),
          (call_script, "script_update_companion_candidates_in_taverns"),
          (call_script, "script_update_ransom_brokers"),
          (call_script, "script_update_tavern_travellers"),
          (call_script, "script_update_tavern_minstrels"),
          (call_script, "script_update_booksellers"),
    	  (try_for_range, ":village_no", villages_begin, villages_end),
          (call_script, "script_update_volunteer_troops_in_village", ":village_no"),
          (try_end),
    	  
    	  
    	  # Merc Camp Begin  
          (try_for_range, ":camp_no", mercenary_camp_begin, mercenary_camp_end),
    	  (call_script, "script_refresh_mercenary_camp_troops",":camp_no"),
          (try_end),	
    
         # Merc Camp End

    Code:
       (try_begin),
               (party_slot_eq, "$g_encountered_party", slot_party_type, spt_town),
               (jump_to_menu, "mnu_castle_outside"),
             (else_try),
               (party_slot_eq, "$g_encountered_party", slot_party_type, spt_castle),
               (jump_to_menu, "mnu_castle_outside"),
             (else_try),
               (party_slot_eq, "$g_encountered_party", slot_party_type, spt_ship),
               (jump_to_menu, "mnu_ship_reembark"),
             (else_try),
               (party_slot_eq, "$g_encountered_party", slot_party_type, spt_village),
               (jump_to_menu, "mnu_village"),
             (else_try),
               (party_slot_eq, "$g_encountered_party", slot_party_type, spt_cattle_herd),
               (jump_to_menu, "mnu_cattle_herd"),
             (else_try),
               (is_between, "$g_encountered_party", training_grounds_begin, training_grounds_end),
               (jump_to_menu, "mnu_training_ground"),
    		 (else_try),
    		   (party_get_template_id, ":template", "$g_encountered_party"),
    		   (ge, ":template", "pt_steppe_bandit_lair"),
    		   (lt, ":template", "pt_bandit_lair_templates_end"),
    		   (assign, "$loot_screen_shown", 0),
    #		   (call_script, "script_encounter_init_variables"),
    		   (jump_to_menu, "mnu_bandit_lair"),
             (else_try),
               (eq, "$g_encountered_party", "p_zendar"),
               (jump_to_menu, "mnu_zendar"),
             (else_try),
               (eq, "$g_encountered_party", "p_salt_mine"),
               (jump_to_menu, "mnu_salt_mine"),
             (else_try),
               (eq, "$g_encountered_party", "p_four_ways_inn"),
               (jump_to_menu, "mnu_four_ways_inn"),
             (else_try),
               (eq, "$g_encountered_party", "p_test_scene"),
               (jump_to_menu, "mnu_test_scene"),
             (else_try),
               (eq, "$g_encountered_party", "p_battlefields"),
               (jump_to_menu, "mnu_battlefields"),
             (else_try),
               (eq, "$g_encountered_party", "p_training_ground"),
               (jump_to_menu, "mnu_tutorial"),
             (else_try),
               (eq, "$g_encountered_party", "p_camp_bandits"),
               (jump_to_menu, "mnu_camp"),		  
             # Merc Camp Begin  			  
             (else_try),
               (is_between, "$g_encountered_party", mercenary_camp_begin, mercenary_camp_end),       
               (jump_to_menu, "mnu_mercenary_camp"),		
             # Merc Camp End 

    Code:
    # Merc Camp Begin 	
      # script_refresh_mercenary_camp_troops
      # Input: arg1 = camp_no
      # Output: none
      ("refresh_mercenary_camp_troops",
        [
          (store_script_param_1, ":camp_no"),
          (assign, ":ideal_size", 50), # Limit of Mercenary troops available in one camp
    
          (try_begin),
            (eq, ":camp_no", "p_merc_camp_geroia"),	
            (assign, ":party_template", "pt_merc_camp_geroia_troops"), 	
          (else_try),
            (eq, ":camp_no", "p_merc_camp_balion"),	
            (assign, ":party_template", "pt_merc_camp_balion_troops"), 	
          (else_try),
            (eq, ":camp_no", "p_merc_camp_jumne"),	
            (assign, ":party_template", "pt_merc_camp_jumne_troops"), 	      
          (else_try),
            (eq, ":camp_no", "p_merc_camp_zendar"),	
            (assign, ":party_template", "pt_merc_camp_zendar_troops"), 			  
          (try_end),
    		
          (try_begin),
            (party_get_num_companions, ":party_size", ":camp_no"),
            (lt, ":party_size", ":ideal_size"),
            (party_add_template, ":camp_no", ":party_template"),	  
          (try_end), 
    	  
      ]),
    # Merc Camp End 
  4. OSP Kit SP Mercenary Camps (of Calradia)

    Seek n Destroy said:
    I forgot to thank Totenkopf900 for his additions, I have plans to revisit and expand the functionalities of this kit but haven't had the time yet.

    capri_sun said:
    Ok for some reason every time i visit any of the mercenary camps its bringing up the training ground menu.
    Make sure you didn't forget to add this bit to script_game_event_party_encounter so the right menu shows up when visiting a camp:
    Code:
    ...
             (else_try),
               (eq, "$g_encountered_party", "p_camp_bandits"),           
               (jump_to_menu, "mnu_camp"),
    # Merc Camp Begin  			 
             (else_try),
               (is_between, "$g_encountered_party", mercenary_camp_begin, mercenary_camp_end),       
               (jump_to_menu, "mnu_mercenary_camp"),		
    # Merc Camp End  			 
             (else_try),
               (jump_to_menu, "mnu_simple_encounter"),
    ...
    i tried that still no luck
  5. OSP Kit SP Mercenary Camps (of Calradia)

    Ok for some reason every time i visit any of the mercenary camps its bringing up the training ground menu.
  6. OSP Kit SP Mercenary Camps (of Calradia)

    Totenkopf900 said:
    You only need to add stuff that is are between merc camps begin and merc camp end, use the stuff that is before them to know where to place the code.
    sorry i figured it out i placed the second line of scripts code in the wrong place
  7. OSP Kit SP Mercenary Camps (of Calradia)

    im getting a error from module_scripts.py, with the three sections of code do i have to put them all together?
  8. PYTHON SCRIPT/SCHEME EXCHANGE

    Totenkopf900 said:
    That is weird, care to post the code and a screenshot?
    here you go good sir lol
    Code:
    ###################################################################################################
      # Prisoner Talk - Originally written by Leprechaun, majorly overhauled & extended by Mordachai
      ###################################################################################################
    
      # this is a dummy dialog - it sets up the globals we need
      [anyone|plyr, "prisoner_chat", [
        (store_conversation_troop,"$g_talk_troop"),
        (store_troop_faction,"$g_talk_troop_faction","$g_talk_troop"),
        (store_relation, "$g_talk_troop_faction_relation", "$g_talk_troop_faction", "fac_player_faction"),
        (call_script, "script_troop_get_player_relation", "$g_talk_troop"),
        (assign, "$g_talk_troop_relation", reg0),
        (eq, 1, 0)
      ], "", "close_window", []],
    
      # the following is intended to catch when you free up space for a prisoner that already agreed to join you
      [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(troops_can_join, 1)], "All right, I have made room for you.", "prisoner_chat_accept_confirm", []],
      [anyone,      "prisoner_chat_accept_confirm", [], "I am at your command, my {lord/lady}.", "prisoner_chat_accept3", []],
    
      # and we catch the case where you still don't have any room for a pending conscripted prisoner
      [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(neg|troops_can_join, 1)], "I am sorry, I still have no room for you. You'll have to wait a while longer.", "close_window",[]],
    
      # default entry (no prior join agreement, or they've previously refused)
      [anyone|plyr, "prisoner_chat", [(neg|troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero)], "You there!", "prisoner_chat_commoner", []],
      [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero),(str_store_troop_name, s1, "$g_talk_troop")], "{s1}", "prisoner_chat_lord", []],
    
      # reaction to you based on noble or low-birth
      [anyone,     "prisoner_chat_commoner", [], "Me?! (Gulp!)", "prisoner_chat_menu",[]],
      [anyone,     "prisoner_chat_lord", [(str_store_troop_name, s1, "trp_player")], "Yes, {Lord/Lady} {s1}?", "prisoner_chat_noble",[]],
    
      # nobles chat begin
      [anyone|plyr,"prisoner_chat_noble", [], "You are free to go.", "prisoner_chat_noble_prerelease",[]],
      [anyone|plyr,"prisoner_chat_noble", [], "You will remain my prisoner.", "prisoner_chat_noble_prekeep",[]],
      [anyone|plyr,"prisoner_chat_noble", [(gt, "$players_kingdom", 0)], "You have committed high treason!", "prisoner_chat_treason",[]],
    
      [anyone|plyr,"prisoner_chat_noble_prerelease", [], "Despite what you may have heard, I am a {man/woman} of honor.  You are free to go.", "prisoner_chat_noble_release", []],
      [anyone,     "prisoner_chat_noble_release", [], "I will not forget this act of Chivalry!", "close_window",
       [
        # remove the troop from prison
        (call_script, "script_remove_troop_from_prison", "$g_talk_troop"),
        (party_remove_prisoners, "p_main_party", "$g_talk_troop", 1),
    
        # determine how much honor and faction relation change this prisoner is worth
        (try_begin),
          # king
          (faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
          (assign, ":honor", 5),
          (assign, ":fac_reln", 15),
        (else_try),
          # other lord
          (assign, ":honor", 2),
          (assign, ":fac_reln", 5),
        (try_end),
    
        # give the player their honor, faction relation, and lord relation change
        (call_script, "script_change_player_relation_with_troop", "$g_talk_troop", 10),
        (call_script, "script_change_player_honor", ":honor"),
        (call_script, "script_change_player_relation_with_faction", "$g_talk_troop_faction", ":fac_reln" ),
      ]],
    
      [anyone|plyr,"prisoner_chat_noble_prekeep", [], "You will understand if I keep you hostage until your family can afford to... compensate me for certain expenses and hardships I have endured to keep you fed and ...safe... these past weeks.", "prisoner_chat_noble_keep",[]],
    
      [anyone,     "prisoner_chat_noble_keep", [(ge, "$player_honor", 10),(ge, "$g_talk_troop_relation", 0)], "Truly, this is beneath you.", "close_window",[]],
      [anyone,     "prisoner_chat_noble_keep", [], "And I trust you will be as understanding when I hunt you down like the dog you are!", "close_window",[(call_script, "script_change_player_relation_with_troop", "$g_talk_troop", -1)]],
    
      # commoners chat begin
      [anyone|plyr,"prisoner_chat_menu", [], "Hmmm... perhaps you're not as stupid as the rest of those rabble.", "prisoner_chat_offer",[]],
      [anyone|plyr,"prisoner_chat_menu", [], "As wretched as you are, I cannot help but feel sorry for you.", "prisoner_chat_release",[]],
      [anyone|plyr,"prisoner_chat_menu", [], "The sight of you makes me sick! You.. Die.. Now!", "prisoner_chat_die1",[]],
      [anyone|plyr,"prisoner_chat_menu", [], "Get back in line, Scum!", "close_window",[]],
    
      [anyone|plyr,"prisoner_chat_release", [], "I'm feeling magnanimous today.  Begone, before I change my mind!", "prisoner_chat_release2", []],
      [anyone,     "prisoner_chat_release2", [], "Oh, thank you, {sir/madam}.  Blessings on you!", "close_window",
        [(remove_troops_from_prisoners, "$g_talk_troop", 1),(call_script, "script_change_player_honor", 1)]],
    
      [anyone|plyr,"prisoner_chat_offer", [], "Listen, scum, you have one last chance to redeem yourself before I sell you to the slave-traders.  "\
                                          "Drop all your previous allegiances and swear fealty to me, obey my every order to the letter, and you'll be paid, fed and equipped.  "\
                                          "If you don't....well, let's just say that life as a slave will be seemingly unending years of agony, malnutrition and beatings.  "\
                                          "I'd advise you to think very, very carefully before choosing.  ", "prisoner_chat_reaction",
                                          [(call_script, "script_determine_prisoner_agreed", "$g_talk_troop", "$g_talk_troop_faction_relation")]],
    
      [anyone,     "prisoner_chat_reaction", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "Thank you for your mercy, {sir/madam}. I swear on my mothers grave I will serve you, my {lord/lady}!","prisoner_chat_accept1",[]],
      [anyone,     "prisoner_chat_reaction", [], "I'll show you what I think of your offer! (The prisoner spits at your feet) There. Now get lost, I'm not interested.", "prisoner_chat_refuse",[]],
    
      [anyone|plyr,"prisoner_chat_refuse", [], "I see...", "prisoner_chat_menu",[]],
    
      [anyone|plyr,"prisoner_chat_die1", [], "(You advance on the prisoner...)", "prisoner_chat_die2",[]],
      [anyone,     "prisoner_chat_die2", [], "Please, {sir/madam}, don't kill me. I am a defenceless prisoner. Surely you're not that cruel?", "prisoner_chat_die3",[]],
      [anyone|plyr,"prisoner_chat_die3", [], "(Kill the prisoner)", "prisoner_chat_die4",[]],
      [anyone|plyr,"prisoner_chat_die3", [], "No, I will not sink that low.", "close_window",[]],
      [anyone|plyr,"prisoner_chat_die4", [], "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit their throat with a knife and watch, satisfied, as his corpse sags to the floor.)", "close_window",
       [(remove_troops_from_prisoners, "$g_talk_troop", 1),
        (call_script, "script_change_player_honor", -1)]],
    
      [anyone|plyr, "prisoner_chat_accept1", [], "If you so much as fail to tremble on my command, I will have you severely disciplined!", "prisoner_chat_accept2",[]],
      [anyone|plyr, "prisoner_chat_accept1", [], "In my camp we are all treated as equals.  I expect your obedience, but also your trust.", "prisoner_chat_accept2",[]],
    
      [anyone,      "prisoner_chat_accept2", [], "I will obey your wishes, my {lord/lady}.  I swear!", "prisoner_chat_accept3",[]],
    
      [anyone|plyr, "prisoner_chat_accept3", [(neg|troops_can_join, 1)], "Oh! Apparently there isn't enough room for you in my party. I will be back when I have made space.", "close_window", []],
      [anyone|plyr, "prisoner_chat_accept3", [(troops_can_join, 1)], "Excellent. Report to the quartermaster for provisions and equiment.  There is hard fighting ahead.", "close_window",
       [(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
        (remove_troops_from_prisoners, "$g_talk_troop",1),
        (party_add_members, "p_main_party", "$g_talk_troop", 1),
        (call_script, "script_change_troop_renown", "trp_player", 1),]],
    
      [anyone|plyr, "prisoner_chat_treason", [(str_store_troop_name, s1, "$g_talk_troop"), (str_store_faction_name, s2, "$players_kingdom")],
        "{s1}, you have committed cimes against the {s2}, for which you will now stand trial.^How plead you?", "prisoner_chat_treason_plead",
        [
          # determine the noble's reaction to this accusation
          (store_random_in_range, reg0, 1, 5),#bug: must set upper number one higher to actually generate correct range
          #TODO: weight the reaction according to the renown?  Or at least according to king or not...
          (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0),
        ]
      ],
    
      [anyone,      "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),],
        "Please have mercy upon my soul.  All I have done, I have done in the name of my King and Country!  I am but a patriot, as you, and I deserve your respect, if nothing else.", "prisoner_chat_treason_choose", []],
      [anyone,      "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2),],
        "You are gravely mistaken!  I am an honorable Lord, and I have done nothing that you would not do were our roles exchanged.", "prisoner_chat_treason_choose", []],
      [anyone,      "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3),],
        "I spit on you and yours!  You are but a cur come to put on airs, as though you were Noble and had any right whatsoever to judge me!  Me!  You are a nothing but a common brigand and a coward!  I do not bow to you.  You should drop to your knees and beg *my* forgiveness!", "prisoner_chat_treason_choose", []],
      [anyone,      "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4),],
        "You dare accuse me?!  You sniveling whelpling!  I should see you flogged and put in chains in one of my prisons for your insolence!", "prisoner_chat_treason_choose", []],
    
      [anyone|plyr, "prisoner_chat_treason_choose", [], "I am a {man/woman} of honor.  I shall spare your life this day!", "prisoner_chat_treason_not_guilty",
        [
          #TODO: have the relation with the prison have a mixed (random) result - relief, anger, etc, which dictates their final monologue to the player before exiting the dialog
    
          # make sure we don't try to recruit this prisoner later!
          (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
        ]
      ],
    
      [anyone,      "prisoner_chat_treason_not_guilty", [(str_store_troop_name, s1, "trp_player")], "There is yet hope for you, {s1}.", "close_window", []],
    
      [anyone|plyr, "prisoner_chat_treason_choose", [], "You do not deserve leiniency.  You must pay for your crimes with your life.", "prisoner_chat_treason_guilty", []],
    
      [anyone|plyr, "prisoner_chat_treason_guilty", [], "For your many crimes against {s1}, I hereby sentence you to death, to be carried out immediately.  Have you any final words to say?", "prisoner_chat_treason_final_words",
        [(store_random_in_range, reg0, 1, 6), (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0)]],
    
      [anyone,      "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "I believe you will one day come to regret your actions.  There is only one who is worthy to decide another's fate... and that one is not you.", "prisoner_chat_treason_execute", []],
      [anyone,      "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2)], "You are a coward and a dog!  May your soul rot eternal, damn you!", "prisoner_chat_treason_execute", []],
      [anyone,      "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3)], "Winter's mortality,^locked in frozen indifference,^melts with Spring's rebirth.", "prisoner_chat_treason_execute", []],
      [anyone,      "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4)], "You will find no peace on this earth!  I shall haunt thee eternal!  Unto death you will find nothing but unhappiness and fear.  And beyond... only torture and pain!", "prisoner_chat_treason_execute", []],
      [anyone,      "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 5)], "Who are you?^A day passes^We are but children", "prisoner_chat_treason_execute", []],
    
      [anyone|plyr, "prisoner_chat_treason_execute", [],
        "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit his throat and watch, satisfied, as his corpse sags to the floor.)",
        "close_window",
        [
          # attempt to allow the player to see the consequences of their actions
          #(set_show_messages, 1),  # this not only fails - but messages are hereafter disabled in the main game...
    
          # make sure we don't try to recruit this prisoner stack later!
          (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
    
          # "kill" the NPC - force the 48 hr respawn kingdom heros trigger to ignore this troop (no party will be created for this troop, ever again)
          # [q.v. script_create_kingdom_hero_party]
          (troop_set_slot, "$g_talk_troop", slot_troop_occupation, slto_dead),
    
          # remove them from their faction
          (troop_set_slot, "$g_talk_troop", slot_troop_change_to_faction, "fac_no_faction"),
          (troop_set_slot, "$g_talk_troop", slot_troop_original_faction, "fac_no_faction"),
    
          # determine the penalty for this act (based on the honor of the troop they've killed)
          (troop_get_slot, ":impact", "$g_talk_troop", slot_troop_renown),
          (val_div, ":impact", -33),
          (store_div, ":half", ":impact", 2),
    
          # reduce the player's relationship with every village, town, and castle
          (try_for_range, ":center", centers_begin, centers_end),
            (store_faction_of_party, ":faction", ":center"),
            (store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
            (try_begin),
              (le, ":relation", -10),
              # enemies, half impact
              (call_script, "script_change_player_relation_with_center", ":center", ":half"),
            (else_try),
              # not at war, full impact
              (call_script, "script_change_player_relation_with_center", ":center", ":impact"),
            (try_end),
          (try_end),
    
          # reduce the player's relationship with every hero, companion, lady, and daughter
          (try_for_range, ":troop", trp_npc1, trp_heroes_end),
            # don't make the dead any angrier than they already are!
            (neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead),
            (store_troop_faction, ":faction", ":troop"),
            (store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
            (try_begin),
              (le, ":relation", -10),
              # enemies, half impact
              (call_script, "script_change_player_relation_with_troop", ":troop", ":half"),
            (else_try),
              # not at war, full impact
              (call_script, "script_change_player_relation_with_troop", ":troop", ":impact"),
            (try_end),
          (try_end),
    
          # reduce the player's relationship with every faction (enemies 1/2 as much)
          (try_for_range, ":faction", kingdoms_begin, kingdoms_end),
            (store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
            (try_begin),
              (le, ":relation", -10),
              # enemies, half impact
              (call_script, "script_change_player_relation_with_faction", ":faction", ":half"),
            (else_try),
              # not at war, full impact
              (call_script, "script_change_player_relation_with_faction", ":faction", ":impact"),
            (try_end),
          (try_end),
    
          # apply the honor hit
          (call_script, "script_change_player_honor", ":impact"),
    
          # party morale takes a hit as well
          (call_script, "script_change_player_party_morale", ":half"),
    
          # but give them renown for this evil deed (their deed spreads upon every tongue, impressing some, and cowing others)
          (val_mul, ":impact", -1),
          (call_script, "script_change_troop_renown", "trp_player" , ":impact"),
    
          # start with the assumption that the fief should return to its faction for redistribution
          (assign, ":fief_faction", "$g_talk_troop_faction"),
    
          (try_begin),
            # handle executing the King!
            (faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
    
            # find best candidate to become king
            (assign, ":best_troop", -1),
            (assign, ":best_renown", -1),
            (try_for_range, ":troop", kingdom_heroes_begin, kingdom_heroes_end),
              (neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead),  #can't choose a dead hero!
              (store_troop_faction, ":faction", ":troop"),
              (eq, ":faction", "$g_talk_troop_faction"),
              (troop_slot_eq, ":troop", slot_troop_occupation, slto_kingdom_hero),  #only other heros of this faction may become the king
              (troop_get_slot, ":renown", ":troop", slot_troop_renown),
              (gt, ":renown", ":best_renown"),
              (assign, ":best_troop", ":troop"),
              (assign, ":best_renown", ":renown"),
            (try_end),
    
            (try_begin),
              # check if a candidate was found
              (neq, ":best_troop", -1),
    
              # make them king
              (faction_set_slot, "$g_talk_troop_faction", slot_faction_leader, ":best_troop"),
    
              # announce it!
              #TODO: generate a presentation for this! (start_presentation, "prsnt_enemy_succession"),
              (str_store_troop_name, s1, ":best_troop"),
              (str_store_faction_name, s2, "$g_talk_troop_faction"),
              (display_message, "@{s1} is the new King of the {s2}!!!", 0xFFFF2222),
              #TODO: update the game log for this event
            (else_try),
              # all of the lords have been eliminated - so eliminate the faction by making their last fief neutral (q.v. trigger: # Check if a faction is defeated every day)
              (assign, ":fief_faction", "fac_no_faction"),
            (try_end),
          (try_end),
    
          # free up the deceased's fief
          (try_for_range, ":fief", centers_begin, centers_end),
            (party_get_slot, ":lord", ":fief", slot_town_lord),
            (eq, ":lord", "$g_talk_troop"),
            (call_script, "script_give_center_to_faction", ":fief", ":fief_faction"),
          (try_end),
    
          # no longer our prisoner
          (call_script, "script_remove_troop_from_prison", "$g_talk_troop"),
          (remove_troops_from_prisoners, "$g_talk_troop", 1),
        ]
      ],
    
      ###################################################################################################
      # End Prisoner Talk
      ###################################################################################################
    https://imgur.com/a/bbzkhCo
  9. PYTHON SCRIPT/SCHEME EXCHANGE

    Totenkopf900 said:
    What do you mean by duplicate text? The code you should be replacing looks like this
    Code:
      [anyone|plyr,"prisoner_chat", [], "Do not try running away or trying something stupid. I will be watching you.", "prisoner_chat_2",[]],
      [anyone,"prisoner_chat_2", [], "No, I swear I won't.", "close_window",[]],
    That's what I replaced i mean in game during dialog i'm getting duplicate dialog texts.
  10. PYTHON SCRIPT/SCHEME EXCHANGE

    Totenkopf900 said:
    did you replace the entire prisoner dialog as asked? I just found out that dialog placement is important for things to work properly.
    Its working but for some reason i'm getting duplicate texts.
  11. PYTHON SCRIPT/SCHEME EXCHANGE

    Totenkopf900 said:
    did you replace the entire prisoner dialog as asked? I just found out that dialog placement is important for things to work properly.
    No I didn't i'm going to try that now,thank you
  12. PYTHON SCRIPT/SCHEME EXCHANGE

    Mordachai said:
    Ok, I'm posting a bit of code that is fully functional, as far as I can tell, with a fair bit of testing (been playing using it for about 2 weeks).  It was originally written by Leprechaun, but of course I've extended it and modified it, and fixed bugs, and so on, so its considerably more than it was when I first came by it (great idea from Leprechaun!).

    Feel free to use it, abuse it, etc.  As always, Leprechaun and I should get some mention. 

    Features:
    * New, extended Prisoner Chat
    * Ability to persuade prisoners to join you directly
    * Ability to set them free
    * Ability to murder regular prisoners
    * Ability to taunt nobles
    * Ability to let nobles go, with a gain to honor and relation
    * Ability to kill nobles permanently in-game.

    This last feature - permanent death to an enemy noble, includes selection of a new king for a kingdom, as well as extensive repercussions for ones actions.  See the comments in the code for specifics, but it aint good. :evil:

    The whole succession part of the code hasn't been tested in practice.  There may be a bug or two there, so use at your own risk.

    Update: I just happened to capture a King, and tested the succession code by having him killed.  It works properly now, as I made some minor bug fixes to the code to correct for some missing messages and the order the messages were being produced so that its easier to get a sense of what happened if you look at the Quest->Recent Messages.

    Enjoy: :cool:
    The following goes in your module_dialogs.py.  It must precede or replace the native prisoner dialogs (if you place it after, then it will be ignored in favor of the native code).
    Code:
      ###################################################################################################
      # Prisoner Talk - Originally written by Leprechaun, majorly overhauled & extended by Mordachai
      ###################################################################################################
    
      # this is a dummy dialog - it sets up the globals we need
      [anyone|plyr, "prisoner_chat", [
        (store_conversation_troop,"$g_talk_troop"),
        (store_troop_faction,"$g_talk_troop_faction","$g_talk_troop"),
        (store_relation, "$g_talk_troop_faction_relation", "$g_talk_troop_faction", "fac_player_faction"),
        (call_script, "script_troop_get_player_relation", "$g_talk_troop"),
        (assign, "$g_talk_troop_relation", reg0),
        (eq, 1, 0)
      ], "", "close_window", []],
    
      # the following is intended to catch when you free up space for a prisoner that already agreed to join you
      [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(troops_can_join, 1)], "All right, I have made room for you.", "prisoner_chat_accept_confirm", []],
      [anyone,      "prisoner_chat_accept_confirm", [], "I am at your command, my {lord/lady}.", "prisoner_chat_accept3", []],
    
      # and we catch the case where you still don't have any room for a pending conscripted prisoner
      [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(neg|troops_can_join, 1)], "I am sorry, I still have no room for you. You'll have to wait a while longer.", "close_window",[]],
    
      # default entry (no prior join agreement, or they've previously refused)
      [anyone|plyr, "prisoner_chat", [(neg|troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero)], "You there!", "prisoner_chat_commoner", []],
      [anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero),(str_store_troop_name, s1, "$g_talk_troop")], "{s1}", "prisoner_chat_lord", []],
    
      # reaction to you based on noble or low-birth
      [anyone,     "prisoner_chat_commoner", [], "Me?! (Gulp!)", "prisoner_chat_menu",[]],
      [anyone,     "prisoner_chat_lord", [(str_store_troop_name, s1, "trp_player")], "Yes, {Lord/Lady} {s1}?", "prisoner_chat_noble",[]],
    
      # nobles chat begin
      [anyone|plyr,"prisoner_chat_noble", [], "You are free to go.", "prisoner_chat_noble_prerelease",[]],
      [anyone|plyr,"prisoner_chat_noble", [], "You will remain my prisoner.", "prisoner_chat_noble_prekeep",[]],
      [anyone|plyr,"prisoner_chat_noble", [(gt, "$players_kingdom", 0)], "You have committed high treason!", "prisoner_chat_treason",[]],
    
      [anyone|plyr,"prisoner_chat_noble_prerelease", [], "Despite what you may have heard, I am a {man/woman} of honor.  You are free to go.", "prisoner_chat_noble_release", []],
      [anyone,     "prisoner_chat_noble_release", [], "I will not forget this act of Chivalry!", "close_window",
       [
        # remove the troop from prison
        (call_script, "script_remove_troop_from_prison", "$g_talk_troop"),
        (party_remove_prisoners, "p_main_party", "$g_talk_troop", 1),
    
        # determine how much honor and faction relation change this prisoner is worth
        (try_begin),
          # king
          (faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
          (assign, ":honor", 5),
          (assign, ":fac_reln", 15),
        (else_try),
          # other lord
          (assign, ":honor", 2),
          (assign, ":fac_reln", 5),
        (try_end),
    
        # give the player their honor, faction relation, and lord relation change
        (call_script, "script_change_player_relation_with_troop", "$g_talk_troop", 10),
        (call_script, "script_change_player_honor", ":honor"),
        (call_script, "script_change_player_relation_with_faction", "$g_talk_troop_faction", ":fac_reln" ),
      ]],
    
      [anyone|plyr,"prisoner_chat_noble_prekeep", [], "You will understand if I keep you hostage until your family can afford to... compensate me for certain expenses and hardships I have endured to keep you fed and ...safe... these past weeks.", "prisoner_chat_noble_keep",[]],
    
      [anyone,     "prisoner_chat_noble_keep", [(ge, "$player_honor", 10),(ge, "$g_talk_troop_relation", 0)], "Truly, this is beneath you.", "close_window",[]],
      [anyone,     "prisoner_chat_noble_keep", [], "And I trust you will be as understanding when I hunt you down like the dog you are!", "close_window",[(call_script, "script_change_player_relation_with_troop", "$g_talk_troop", -1)]],
    
      # commoners chat begin
      [anyone|plyr,"prisoner_chat_menu", [], "Hmmm... perhaps you're not as stupid as the rest of those rabble.", "prisoner_chat_offer",[]],
      [anyone|plyr,"prisoner_chat_menu", [], "As wretched as you are, I cannot help but feel sorry for you.", "prisoner_chat_release",[]],
      [anyone|plyr,"prisoner_chat_menu", [], "The sight of you makes me sick! You.. Die.. Now!", "prisoner_chat_die1",[]],
      [anyone|plyr,"prisoner_chat_menu", [], "Get back in line, Scum!", "close_window",[]],
    
      [anyone|plyr,"prisoner_chat_release", [], "I'm feeling magnanimous today.  Begone, before I change my mind!", "prisoner_chat_release2", []],
      [anyone,     "prisoner_chat_release2", [], "Oh, thank you, {sir/madam}.  Blessings on you!", "close_window",
        [(remove_troops_from_prisoners, "$g_talk_troop", 1),(call_script, "script_change_player_honor", 1)]],
    
      [anyone|plyr,"prisoner_chat_offer", [], "Listen, scum, you have one last chance to redeem yourself before I sell you to the slave-traders.  "\
                                          "Drop all your previous allegiances and swear fealty to me, obey my every order to the letter, and you'll be paid, fed and equipped.  "\
                                          "If you don't....well, let's just say that life as a slave will be seemingly unending years of agony, malnutrition and beatings.  "\
                                          "I'd advise you to think very, very carefully before choosing.  ", "prisoner_chat_reaction",
                                          [(call_script, "script_determine_prisoner_agreed", "$g_talk_troop", "$g_talk_troop_faction_relation")]],
    
      [anyone,     "prisoner_chat_reaction", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "Thank you for your mercy, {sir/madam}. I swear on my mothers grave I will serve you, my {lord/lady}!","prisoner_chat_accept1",[]],
      [anyone,     "prisoner_chat_reaction", [], "I'll show you what I think of your offer! (The prisoner spits at your feet) There. Now get lost, I'm not interested.", "prisoner_chat_refuse",[]],
    
      [anyone|plyr,"prisoner_chat_refuse", [], "I see...", "prisoner_chat_menu",[]],
    
      [anyone|plyr,"prisoner_chat_die1", [], "(You advance on the prisoner...)", "prisoner_chat_die2",[]],
      [anyone,     "prisoner_chat_die2", [], "Please, {sir/madam}, don't kill me. I am a defenceless prisoner. Surely you're not that cruel?", "prisoner_chat_die3",[]],
      [anyone|plyr,"prisoner_chat_die3", [], "(Kill the prisoner)", "prisoner_chat_die4",[]],
      [anyone|plyr,"prisoner_chat_die3", [], "No, I will not sink that low.", "close_window",[]],
      [anyone|plyr,"prisoner_chat_die4", [], "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit their throat with a knife and watch, satisfied, as his corpse sags to the floor.)", "close_window",
       [(remove_troops_from_prisoners, "$g_talk_troop", 1),
        (call_script, "script_change_player_honor", -1)]],
    
      [anyone|plyr, "prisoner_chat_accept1", [], "If you so much as fail to tremble on my command, I will have you severely disciplined!", "prisoner_chat_accept2",[]],
      [anyone|plyr, "prisoner_chat_accept1", [], "In my camp we are all treated as equals.  I expect your obedience, but also your trust.", "prisoner_chat_accept2",[]],
    
      [anyone,      "prisoner_chat_accept2", [], "I will obey your wishes, my {lord/lady}.  I swear!", "prisoner_chat_accept3",[]],
    
      [anyone|plyr, "prisoner_chat_accept3", [(neg|troops_can_join, 1)], "Oh! Apparently there isn't enough room for you in my party. I will be back when I have made space.", "close_window", []],
      [anyone|plyr, "prisoner_chat_accept3", [(troops_can_join, 1)], "Excellent. Report to the quartermaster for provisions and equiment.  There is hard fighting ahead.", "close_window",
       [(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
        (remove_troops_from_prisoners, "$g_talk_troop",1),
        (party_add_members, "p_main_party", "$g_talk_troop", 1),
        (call_script, "script_change_troop_renown", "trp_player", 1),]],
    
      [anyone|plyr, "prisoner_chat_treason", [(str_store_troop_name, s1, "$g_talk_troop"), (str_store_faction_name, s2, "$players_kingdom")],
        "{s1}, you have committed cimes against the {s2}, for which you will now stand trial.^How plead you?", "prisoner_chat_treason_plead",
        [
          # determine the noble's reaction to this accusation
          (store_random_in_range, reg0, 1, 5),#bug: must set upper number one higher to actually generate correct range
          #TODO: weight the reaction according to the renown?  Or at least according to king or not...
          (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0),
        ]
      ],
    
      [anyone,      "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),],
        "Please have mercy upon my soul.  All I have done, I have done in the name of my King and Country!  I am but a patriot, as you, and I deserve your respect, if nothing else.", "prisoner_chat_treason_choose", []],
      [anyone,      "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2),],
        "You are gravely mistaken!  I am an honorable Lord, and I have done nothing that you would not do were our roles exchanged.", "prisoner_chat_treason_choose", []],
      [anyone,      "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3),],
        "I spit on you and yours!  You are but a cur come to put on airs, as though you were Noble and had any right whatsoever to judge me!  Me!  You are a nothing but a common brigand and a coward!  I do not bow to you.  You should drop to your knees and beg *my* forgiveness!", "prisoner_chat_treason_choose", []],
      [anyone,      "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4),],
        "You dare accuse me?!  You sniveling whelpling!  I should see you flogged and put in chains in one of my prisons for your insolence!", "prisoner_chat_treason_choose", []],
    
      [anyone|plyr, "prisoner_chat_treason_choose", [], "I am a {man/woman} of honor.  I shall spare your life this day!", "prisoner_chat_treason_not_guilty",
        [
          #TODO: have the relation with the prison have a mixed (random) result - relief, anger, etc, which dictates their final monologue to the player before exiting the dialog
    
          # make sure we don't try to recruit this prisoner later!
          (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
        ]
      ],
    
      [anyone,      "prisoner_chat_treason_not_guilty", [(str_store_troop_name, s1, "trp_player")], "There is yet hope for you, {s1}.", "close_window", []],
    
      [anyone|plyr, "prisoner_chat_treason_choose", [], "You do not deserve leiniency.  You must pay for your crimes with your life.", "prisoner_chat_treason_guilty", []],
    
      [anyone|plyr, "prisoner_chat_treason_guilty", [], "For your many crimes against {s1}, I hereby sentence you to death, to be carried out immediately.  Have you any final words to say?", "prisoner_chat_treason_final_words",
        [(store_random_in_range, reg0, 1, 6), (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0)]],
    
      [anyone,      "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "I believe you will one day come to regret your actions.  There is only one who is worthy to decide another's fate... and that one is not you.", "prisoner_chat_treason_execute", []],
      [anyone,      "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2)], "You are a coward and a dog!  May your soul rot eternal, damn you!", "prisoner_chat_treason_execute", []],
      [anyone,      "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3)], "Winter's mortality,^locked in frozen indifference,^melts with Spring's rebirth.", "prisoner_chat_treason_execute", []],
      [anyone,      "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4)], "You will find no peace on this earth!  I shall haunt thee eternal!  Unto death you will find nothing but unhappiness and fear.  And beyond... only torture and pain!", "prisoner_chat_treason_execute", []],
      [anyone,      "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 5)], "Who are you?^A day passes^We are but children", "prisoner_chat_treason_execute", []],
    
      [anyone|plyr, "prisoner_chat_treason_execute", [],
        "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit his throat and watch, satisfied, as his corpse sags to the floor.)",
        "close_window",
        [
          # attempt to allow the player to see the consequences of their actions
          #(set_show_messages, 1),  # this not only fails - but messages are hereafter disabled in the main game...
    
          # make sure we don't try to recruit this prisoner stack later!
          (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
    
          # "kill" the NPC - force the 48 hr respawn kingdom heros trigger to ignore this troop (no party will be created for this troop, ever again)
          # [q.v. script_create_kingdom_hero_party]
          (troop_set_slot, "$g_talk_troop", slot_troop_occupation, slto_dead),
    
          # remove them from their faction
          (troop_set_slot, "$g_talk_troop", slot_troop_change_to_faction, "fac_no_faction"),
          (troop_set_slot, "$g_talk_troop", slot_troop_original_faction, "fac_no_faction"),
    
          # determine the penalty for this act (based on the honor of the troop they've killed)
          (troop_get_slot, ":impact", "$g_talk_troop", slot_troop_renown),
          (val_div, ":impact", -33),
          (store_div, ":half", ":impact", 2),
    
          # reduce the player's relationship with every village, town, and castle
          (try_for_range, ":center", centers_begin, centers_end),
            (store_faction_of_party, ":faction", ":center"),
            (store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
            (try_begin),
              (le, ":relation", -10),
              # enemies, half impact
              (call_script, "script_change_player_relation_with_center", ":center", ":half"),
            (else_try),
              # not at war, full impact
              (call_script, "script_change_player_relation_with_center", ":center", ":impact"),
            (try_end),
          (try_end),
    
          # reduce the player's relationship with every hero, companion, lady, and daughter
          (try_for_range, ":troop", trp_npc1, trp_heroes_end),
            # don't make the dead any angrier than they already are!
            (neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead),
            (store_troop_faction, ":faction", ":troop"),
            (store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
            (try_begin),
              (le, ":relation", -10),
              # enemies, half impact
              (call_script, "script_change_player_relation_with_troop", ":troop", ":half"),
            (else_try),
              # not at war, full impact
              (call_script, "script_change_player_relation_with_troop", ":troop", ":impact"),
            (try_end),
          (try_end),
    
          # reduce the player's relationship with every faction (enemies 1/2 as much)
          (try_for_range, ":faction", kingdoms_begin, kingdoms_end),
            (store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
            (try_begin),
              (le, ":relation", -10),
              # enemies, half impact
              (call_script, "script_change_player_relation_with_faction", ":faction", ":half"),
            (else_try),
              # not at war, full impact
              (call_script, "script_change_player_relation_with_faction", ":faction", ":impact"),
            (try_end),
          (try_end),
    
          # apply the honor hit
          (call_script, "script_change_player_honor", ":impact"),
    
          # party morale takes a hit as well
          (call_script, "script_change_player_party_morale", ":half"),
    
          # but give them renown for this evil deed (their deed spreads upon every tongue, impressing some, and cowing others)
          (val_mul, ":impact", -1),
          (call_script, "script_change_troop_renown", "trp_player" , ":impact"),
    
          # start with the assumption that the fief should return to its faction for redistribution
          (assign, ":fief_faction", "$g_talk_troop_faction"),
    
          (try_begin),
            # handle executing the King!
            (faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
    
            # find best candidate to become king
            (assign, ":best_troop", -1),
            (assign, ":best_renown", -1),
            (try_for_range, ":troop", kingdom_heroes_begin, kingdom_heroes_end),
              (neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead),  #can't choose a dead hero!
              (store_troop_faction, ":faction", ":troop"),
              (eq, ":faction", "$g_talk_troop_faction"),
              (troop_slot_eq, ":troop", slot_troop_occupation, slto_kingdom_hero),  #only other heros of this faction may become the king
              (troop_get_slot, ":renown", ":troop", slot_troop_renown),
              (gt, ":renown", ":best_renown"),
              (assign, ":best_troop", ":troop"),
              (assign, ":best_renown", ":renown"),
            (try_end),
    
            (try_begin),
              # check if a candidate was found
              (neq, ":best_troop", -1),
    
              # make them king
              (faction_set_slot, "$g_talk_troop_faction", slot_faction_leader, ":best_troop"),
    
              # announce it!
              #TODO: generate a presentation for this! (start_presentation, "prsnt_enemy_succession"),
              (str_store_troop_name, s1, ":best_troop"),
              (str_store_faction_name, s2, "$g_talk_troop_faction"),
              (display_message, "@{s1} is the new King of the {s2}!!!", 0xFFFF2222),
              #TODO: update the game log for this event
            (else_try),
              # all of the lords have been eliminated - so eliminate the faction by making their last fief neutral (q.v. trigger: # Check if a faction is defeated every day)
              (assign, ":fief_faction", "fac_no_faction"),
            (try_end),
          (try_end),
    
          # free up the deceased's fief
          (try_for_range, ":fief", centers_begin, centers_end),
            (party_get_slot, ":lord", ":fief", slot_town_lord),
            (eq, ":lord", "$g_talk_troop"),
            (call_script, "script_give_center_to_faction", ":fief", ":fief_faction"),
          (try_end),
    
          # no longer our prisoner
          (call_script, "script_remove_troop_from_prison", "$g_talk_troop"),
          (remove_troops_from_prisoners, "$g_talk_troop", 1),
        ]
      ],
    
      ###################################################################################################
      # End Prisoner Talk
      ###################################################################################################

    Please note that slto_dead is not a native symbol - if you want to use the above you'll also need to add slto_dead = 86 in your module_constants.py.

    Please note that slot_prisoner_agreed is not a native symbol - simply add slot_prisoner_agreed = 142 to your module_constants.py.  Actually, 142 is arbitrary - any unused slot will do.

    Additionally, you'll need to add this script to module_scripts.py - I added it towards the end, as the last script in the file, but you're welcome to place it anywhere within the list of scripts within that file:
    Code:
      #MORDACHAI - update whether the specified prisoner would like to join the player's party
      # script_determine_prisoner_agreed
      # Input: arg1 = troop, arg2 = troop faction relation
      # Output: slot_prisoner_agreed is set to 1 if they agreed, or 0 if not
      #         reg0 = agreed or not
      ("determine_prisoner_agreed",
        [
          (store_script_param, ":troop", 1),
          (store_script_param, ":relation", 2),
    
          # upper bound = Persuasion*3 + Charisma + Leadership*3 + Honor/2 + Renown/100
          (store_attribute_level, ":charisma", "trp_player", ca_charisma),
          (store_skill_level, ":persuasion", "skl_persuasion", "trp_player"),
          (store_skill_level, ":leadership", "skl_leadership", "trp_player"),
          (val_mul, ":persuasion", 3),
          (val_mul, ":leadership", 3),
          (store_div, ":half_honor", "$player_honor", 2),
          (troop_get_slot, ":renown_factor", slot_troop_renown),
          (val_div, ":renown_factor", 100),
          (assign, ":upper_bound", ":persuasion"),
          (val_add, ":upper_bound", ":leadership"),
          (val_add, ":upper_bound", ":charisma"),
          (val_add, ":upper_bound", ":half_honor"),
          (val_add, ":upper_bound", ":renown_factor"),
          (val_min, ":relation", ":upper_bound"),
    
          # determine their reaction (relation...upper_bound)
          (store_random_in_range, ":reaction", ":relation", ":upper_bound"),
          (assign, reg1, ":reaction"),
          (assign, reg2, ":relation"),
          (assign, reg3, ":upper_bound"),
          #(display_message, "@Prisoner Agrees Check: rolled a {reg1} out of a possible {reg2}-{reg3}"),#diagnostic only
    
          # record whether they agree or not
          (try_begin),
            (ge, ":reaction", 0),
            (troop_set_slot, ":troop", slot_prisoner_agreed, 1),
          (else_try),
            (troop_set_slot, ":troop", slot_prisoner_agreed, 0),
          (try_end),
    
          # return the results
          (troop_get_slot, reg0, ":troop", slot_prisoner_agreed),
          #(display_message, "@Prisoner Agrees Check: slot_prisoner_agreed = {reg0?yes:no}"),#diagnostic only
        ]
      ),

    Has anybody got this to work with warband? Weird thing is i tried it but its not working and im not getting any compile errors
  13. Mercenary Generals

    bumping this topic thought about making a new thread but me & the Original poster have the same question.
  14. PYTHON SCRIPT/SCHEME EXCHANGE

    Totenkopf900 said:
    Search and delete/or comment this line of code
    Code:
    (neg|party_slot_eq, ":center", slot_town_lord, "trp_player"),  ## Not a player owned center
    thank you
  15. PYTHON SCRIPT/SCHEME EXCHANGE

    Zaitenko said:
    Zaitenko's Reinforcement Script

    Allright I've made a modification to M&B that makes the castles/towns get reinforcements from their respective villages when they go below a number of troops in their garrisons.
    I did it because I got tired of being able to tear down town defenses with alot less men than the castle/town by just attacking it repeatedly.

    And when you had taken a castle/town I've never seen an npc lord that got command of it reinforce the garrison himself.

    The modification makes Reinforcement parties spawn from the villages and travel to the castles/towns and then join them upon arrival.
    It's set not to reinforce player owned towns/castles, but that is a personal preferance and easy to change.

    To the code!!

    In module_triggers we add this code. Basicly it's the main code that determins if a party should spawn, where it should go and what template it should use.

    I do believe you can add the code anywhere you like in module_triggers. Afaik there are no hardwired triggers.

    Code:
    (36, 0, 0.0, [], [  ## Set the reinforcements interval to 36 Game hours. Change as you feel like.
                         (try_for_range, ":center", walled_centers_begin, walled_centers_end),
                             (store_faction_of_party, ":faction", ":center"),
                             (party_get_num_companions, ":garrison", ":center"),
                             (faction_get_slot, ":party_template_a", ":faction", slot_faction_reinforcements_a),
                             (faction_get_slot, ":party_template_b", ":faction", slot_faction_reinforcements_b),
                             (faction_get_slot, ":party_template_c", ":faction", slot_faction_reinforcements_c),
                             (assign, ":party_template", 0),
                             (try_begin),
                                 (party_slot_eq, ":center", slot_party_type, spt_town),
                                 (lt, ":garrison", 200),            ## Under this number of troops will towns get reinforcements
                                 (assign, ":party_template", "pt_reinforcements"),
                             (else_try),
                                 (party_slot_eq, ":center", slot_party_type, spt_castle),
                                 (lt, ":garrison", 70),            ## Under this number of troops will castles get reinforcements
                                 (assign, ":party_template", "pt_reinforcements"),
                             (try_end),
                             (try_begin),
                                 (gt, ":party_template", 0),
                                 (try_for_range, ":village_reinforcements", villages_begin, villages_end),
                                     (try_begin),
                                         (party_slot_eq, ":center", slot_party_type, spt_castle),  ## For Castles
                                         (party_slot_eq, ":village_reinforcements", slot_village_bound_center, ":center"),
                                         (party_slot_eq, ":village_reinforcements", slot_village_state, svs_normal), ## Not if the village is being raided or is looted
                                         (neg|party_slot_eq, ":center", slot_town_lord, "trp_player"),  ## Not a player owned center
                                         (spawn_around_party, ":village_reinforcements", ":party_template"),
                                         (assign, ":result", reg0),
                                         (store_random_in_range, ":rand", 0, 100),
                                         (try_begin),
                                             (is_between, ":rand", 0, 45),  ## Get weakest template
                                             (party_add_template, ":result", ":party_template_a"),
                                         (else_try),
                                             (is_between, ":rand", 45, 85), ## Get stronger template
                                             (party_add_template, ":result", ":party_template_b"),
                                         (else_try),
                                             (ge, ":rand", 85), ## Get strongest template
                                             (party_add_template, ":result", ":party_template_c"),
                                         (try_end),
                                         (party_set_faction, ":result", ":faction"),
                                         (party_set_slot, ":result", slot_party_type, spt_reinforcement_party),
                                         (party_set_slot, ":result", slot_party_ai_object, ":center"),
                                         (str_store_party_name, s14, ":village_reinforcements"),
                                         (party_set_name, ":result", "@Reinforcements from {s14}"),
                                         (party_set_ai_behavior,":result",ai_bhvr_travel_to_party),
                                         (party_set_ai_object,":result", ":center"),
                                         (party_set_flags, ":result", pf_default_behavior, 1),
                                     (else_try),        
                                         (party_slot_eq, ":center", slot_party_type, spt_town), ## For Towns
                                         (party_slot_eq, ":village_reinforcements", slot_village_bound_center, ":center"),
                                         (party_slot_eq, ":village_reinforcements", slot_village_state, svs_normal), ## Not if the village is being raided or is looted
                                         (neg|party_slot_eq, ":center", slot_town_lord, "trp_player"), ## Not a player owned center
                                         (spawn_around_party, ":village_reinforcements", ":party_template"),
                                         (assign, ":result", reg0),
                                         (store_random_in_range, ":rand", 0, 100),
                                         (try_begin),
                                             (is_between, ":rand", 0, 45),  ## Get weakest template
                                             (party_add_template, ":result", ":party_template_a"),
                                         (else_try),
                                             (is_between, ":rand", 40, 85), ## Get stronger template
                                             (party_add_template, ":result", ":party_template_b"),
                                         (else_try),
                                             (ge, ":rand", 85), ## Get strongest template
                                             (party_add_template, ":result", ":party_template_c"),
                                         (try_end),
                                         (party_set_faction, ":result", ":faction"),
                                         (party_set_slot, ":result", slot_party_type, spt_reinforcement_party),
                                         (party_set_slot, ":result", slot_party_ai_object, ":center"),
                                         (str_store_party_name, s14, ":village_reinforcements"),
                                         (party_set_name, ":result", "@Reinforcements from {s14}"),
                                         (party_set_ai_behavior,":result",ai_bhvr_travel_to_party),
                                         (party_set_ai_object,":result", ":center"),
                                         (party_set_flags, ":result", pf_default_behavior, 1),
                                     (try_end),
                                 (try_end),
                             (try_end),
                         (try_end)])

    Okay, that's a chunk of code that I've tried to comment for clarity on some parts of it.
    The reinforcements will come even if the center is being besieged, but they will come as a small party(or well, as you have defined the reinforcements in you module_party_templates) so keep an eye open while resting at a castle/town and you can intercept them before they sneak in. This makes the most sense to me, but if you don't want them to come if the castle is being besieged, simply add this code

    Code:
    (party_get_slot, ":besieged", ":center", slot_center_is_besieged_by),
                             (neg|ge, ":besieged", 0), #Town/castle is under siege jump out

    after the begining

    Code:
    (try_for_range, ":center", walled_centers_begin, walled_centers_end),

    I have not given that thorough testing, but I'm pretty sure that will work.

    Two rather critical but very small steps will follow. First add this anywhere after the hardwired code in module_party_templates:

    Code:
    ("reinforcements","Reinforcements",icon_axeman|pf_show_faction,0,fac_commoners,soldier_personality,[]),

    Now to the next step. You may or may not have noticed that I gave the reinforcement party a party type slot called: spt_reinforcement_party
    Well there is no such thing if you don't create it. So open up module_constants which is where(afaik) all the diffrent slot types are stored.
    Add this line of code where the rest of the slot_party_type value's are.

    Code:
    spt_reinforcement_party = 14

    Take notice, if you have modded in other party types your 14 slot may be taken and you may have to give it another slot value.

    Easily done. Are we done? No.

    At the moment we got reinforcement parties travelling allright, but they are not joining the town/castle. For this to work, we need module_simple_triggers.

    I put this code close to the #Troop AI: Merchants thinking line.

    Code:
    (0.2,  #Every 0.2 game hours will the game check if there are any reinforcements in the centers.
       [
           (try_for_parties, ":party_no"), 
             (party_slot_eq, ":party_no", slot_party_type, spt_reinforcement_party),  #Find parties of the type spt_reinforcement_party
             (party_is_in_any_town, ":party_no"),  # Is the party in any town?
             (party_get_cur_town, ":cur_center", ":party_no"), #What town are they in?
             (call_script, "script_party_add_party_companions", ":cur_center", ":party_no"), #Add the party to the center, which is infact a party ;)
             (party_clear, ":party_no"), #Not sure if this cleaning up is necessary, but it's a precaution so we don't have a bundle of templates lying around.
           (try_end), 
        ]),

    Then ofcourse you can add some hip dialoge to them if you please. I did this quickly:

    Code:
    # Reinforcements
      [party_tpl|pt_reinforcements,"start", [(eq,"$talk_context",tc_party_encounter),
                                             (party_get_slot, ":ai_object", "$g_encountered_party", slot_party_ai_object),
                                             (str_store_party_name,s21,":ai_object"),
                                             (str_store_party_name, s20, "$g_encountered_party")],
       "Who goes there? We are {s20}.\ We're on our way to {s21}.", "reinforcements_intro",[]],
      [anyone|plyr, "reinforcements_intro", [], "I am {playername}. I'm just passing by.", "close_window",[]],
      [anyone|plyr, "reinforcements_intro", [], "I am {playername}. And I'm here to stop you from reaching your destination!.", "reinforcement_hostile",[]],
      [party_tpl|pt_reinforcements,"reinforcement_hostile", [(faction_get_slot, ":faction_leader", "$g_encountered_party_faction",slot_faction_leader),
                                                             (str_store_troop_name, s9, ":faction_leader"),],
                                                             "What!? We are under the protection of {s9}!\ Be certain he will take vengance!", "reinforcements_attack",[]],
      [anyone|plyr, "reinforcements_attack", [], "Fine let him! I will kill him after I've dealt with you!", "close_window",[(call_script, "script_make_kingdom_hostile_to_player", "$g_encountered_party_faction", -1),
                                                                                                                              (encounter_attack,0)]],
      [anyone|plyr, "reinforcements_attack", [], "Allright, go! But you have not seen the last of me!", "close_window",[]],

    Haven't really had chance to test it yet but I think it'll work.

    And there you have it. Hope you like it!

    Zait

    Edit - Working On:
    Anyway, I've updated  the script due to a simple copy/paste err of mine. The script still worked fine but it took the garrison size from the garrison AND the potential parties resting at the castle/town. This was not intended and it's been fixed. If you run the script in your mod, re-copy paste the part that goes into module_triggers.py.

    Thanks NCrawler for dialogue correction.
    sorry to bump this but how would you get it to work for player faction?
Back
Top Bottom