Recent content by aleeque

  1. Modding Q&A [For Quick Questions and Answers]

    Avareee said:
    Hi guys, I have a question;

    Can someone tell me how I can fix the horse archers in native(diplomacy+pbod)?

    https://forums.taleworlds.com/index.php/topic,366006.0.html
    There is this script to do just that. But I don't know where I have to use it exactly and how to.
    So I would appreciate it if you guys could help a noob such as me, out.:smile:

    The functions used in that script were introduced in 1.163 or whatever. IIRC diplomacy+pbod requires 1.153 or so.
  2. Modding Q&A [For Quick Questions and Answers]

    What I mean is, when a lamed horse that previously had a Champion/Spirited/Heavy modifier, heals, it retains said modifier instead of becoming a regular horse.

    There's nothing in modsys code about this that I could find.
  3. Modding Q&A [For Quick Questions and Answers]

    How do I make it so that when a Spirited/Heavy/Champion horse is lamed, it doesn't lose the positive modifier?

    This can't possibly be hardcoded, can it? I found nothing in the modsys files.
  4. Modding Q&A [For Quick Questions and Answers]

    Silverc said:
    I was watching a M&B video and the guy had a fun op crossbow that he just held down right click and it continuously fired. How do I make the crossbow do this? I have changed a crossbow to hold 20 ammo ect but can not get it to fire continuously.

    I think it was the "shots before reload" attribute in Morgh's Editor.
  5. Modding Q&A [For Quick Questions and Answers]

    kalarhan said:
    aleeque said:
    Hi, does anybody know how to make it possible to take prisoners after a village battle? Like, when you catch an enemy lord raiding a village and fight him there. I want the prisoner taking UI screen to show when you win that battle.

    Thanks in advance.

    menu total_victory has a series of checks for conditions after a battle, one of them takes you to the prisoner exchange and calls this operation "change_screen_exchange_with_party"

    track down the code post-battle in your case and what the flags/conditions are and add a new rule similar to above.

    Thanks! Unfortunately, this is a bit too advanced for me. I found nothing in the village_raid mission template that could link to this prisoner code.

    I tried simply removing the
        (gt, ":total_capture_size", 0),
    line right before
        (change_screen_exchange_with_party, "p_temp_party"),

    And this sort of worked in that the prisoner exchange screen WAS shown after a village battle, but both the "freed allies" and "captured enemies" fields were empty.

    Maybe this is because the village_raid code in mission_templates is missing this piece:
    Code:
    (ti_on_agent_killed_or_wounded, 0, 0, [],
           [
            (store_trigger_param_1, ":dead_agent_no"),
            (store_trigger_param_2, ":killer_agent_no"),
            (store_trigger_param_3, ":is_wounded"),
    
            (try_begin),
              (ge, ":dead_agent_no", 0),
              (neg|agent_is_ally, ":dead_agent_no"),
              (agent_is_human, ":dead_agent_no"),
              (agent_get_troop_id, ":dead_agent_troop_id", ":dead_agent_no"),
    ##          (str_store_troop_name, s6, ":dead_agent_troop_id"),
    ##          (assign, reg0, ":dead_agent_no"),
    ##          (assign, reg1, ":killer_agent_no"),
    ##          (assign, reg2, ":is_wounded"),
    ##          (agent_get_team, reg3, ":dead_agent_no"),          
              #(display_message, "@{!}dead agent no : {reg0} ; killer agent no : {reg1} ; is_wounded : {reg2} ; dead agent team : {reg3} ; {s6} is added"), 
              (party_add_members, "p_total_enemy_casualties", ":dead_agent_troop_id", 1), #addition_to_p_total_enemy_casualties
              (eq, ":is_wounded", 1),
              (party_wound_members, "p_total_enemy_casualties", ":dead_agent_troop_id", 1), 
            (try_end),
    
            (call_script, "script_apply_death_effect_on_courage_scores", ":dead_agent_no", ":killer_agent_no"),
           ]),

    ? I noticed that it's present in all battle templates (regular lead_charge, siege etc) except village_raid.

    edit: holy ****, it actually worked!! All I did was add this trigger to the village_raid entry in mission_templates and changed nothing else in any other files.

    And it actually worked. I could take prisoners after the village battle! I don't know if this will cause any side effects though. Doesn't seem to be any so far.
  6. Modding Q&A [For Quick Questions and Answers]

    Hi, does anybody know how to make it possible to take prisoners after a village battle? Like, when you catch an enemy lord raiding a village and fight him there. I want the prisoner taking UI screen to show when you win that battle.

    Thanks in advance.
  7. Modding Q&A [For Quick Questions and Answers]

    I was looking through the source code of Diplomacy and found this in simple_triggers:

    Code:
    #Individual lord political calculations
    	#Check for lords without fiefs, auto-defections, etc
       (0.5,
        [
    	##diplomacy start+
    	#This is fairly complicated, and it was getting nearly unreadable so I reformatted it.
    	#The old version is visible in version control.
    	(assign, ":save_reg0", reg0),
    	(val_add, "$g_lord_long_term_count", 1),
    	(try_begin),
    		(neg|is_between, "$g_lord_long_term_count", active_npcs_including_player_begin, active_npcs_end),
    		(assign, "$g_lord_long_term_count", active_npcs_including_player_begin),
    	(try_end),
    
    	##Add political calculations for kingdom ladies.  Just extending the range would
    	##slow down the political calculations cycle, which would have possibly-unforeseen results.
    	##Instead, add a second iteration to deal with extensions.
    	(try_for_range, ":iteration", 0, 2),
    		(assign, ":troop_no", "$g_lord_long_term_count"),
    		(try_begin),
    			(eq, ":iteration", 1),
    			(val_sub, ":troop_no", active_npcs_including_player_begin),
    			(val_add, ":troop_no", active_npcs_end),
    		(try_end),
    		#Crude check to make sure that a careless modder (i.e. me) didn't decide it
    		#would be a good idea to redefine active_npcs to include kingdom_ladies,
    		#which would make the second iteration run off the end of the heroes list.
    		(is_between, ":troop_no", active_npcs_including_player_begin, heroes_end),
    
    		#Special handling for trp_player, and get the troop's faction
    		(try_begin),
    			(eq, ":troop_no", "trp_kingdom_heroes_including_player_begin"),
    			(assign, ":troop_no", "trp_player"),
    			(assign, ":faction", "$players_kingdom"),
    		(else_try),
    			(store_faction_of_troop, ":faction", ":troop_no"),
    		(try_end),
    
    		(try_begin),
    			(eq, "$cheat_mode", 1),
    			(str_store_troop_name, s9, ":troop_no"),
    			(display_message, "@{!}DEBUG -- Doing political calculations for {s9}"),
    		(try_end),
    
            #Tally the fiefs owned by the hero, and cache the value in slot.
    		#If a lord owns no fiefs, his relations with his liege may deteriorate.
            (try_begin),
    			(assign, reg0, 1),#Center points + 1
    			(try_for_range, ":center", centers_begin, centers_end),
    				(party_slot_eq, ":center", slot_town_lord, ":troop_no"),
    				(try_begin),
    					(is_between, ":center", towns_begin, towns_end),
    					(val_add, reg0, 3),#3 points per town
    				(else_try),
    					(is_between, ":center", walled_centers_begin, walled_centers_end),
    					(val_add, reg0, 2),#2 points per castle
    				(else_try),
    					(val_add, reg0, 1),#1 point per village
    				(try_end),
    			(try_end),
    			#Update cached total
    			(troop_set_slot, ":troop_no", dplmc_slot_troop_center_points_plus_one, reg0),
    			#If a lord has no fiefs, relation loss potentially results.
    			#Do not apply this to the player.
    			(eq, reg0, 1),
    			(troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
    			(neq, ":troop_no", "trp_player"),
    
    			#Don't apply this to the leader
    			(faction_get_slot, ":faction_leader", ":faction", slot_faction_leader),
    			(gt, ":faction_leader", -1),
    			(neq, ":faction_leader", ":troop_no"),
    			(neg|troop_slot_eq, ":faction_leader", slot_troop_spouse, ":troop_no"),
    			(neg|troop_slot_eq, ":troop_no", slot_troop_spouse, ":faction_leader"),
    
    			(troop_get_slot, ":troop_reputation", ":troop_no", slot_lord_reputation_type),
    			(try_begin),
    				(this_or_next|eq, ":troop_reputation", lrep_quarrelsome),
    				(this_or_next|eq, ":troop_reputation", lrep_selfrighteous),
    				(this_or_next|eq, ":troop_reputation", lrep_cunning),
    				(eq, ":troop_reputation", lrep_debauched),
    				(call_script, "script_troop_change_relation_with_troop", ":troop_no", ":faction_leader", -4),
    				(val_add, "$total_no_fief_changes", -4),
    			(else_try),
    				(this_or_next|eq, ":troop_reputation", lrep_ambitious),#add support for lady personalities
    				(eq, ":troop_reputation", lrep_martial),
    				(call_script, "script_troop_change_relation_with_troop", ":troop_no", ":faction_leader", -2),
    				(val_add, "$total_no_fief_changes", -2),
    			(try_end),
            (try_end),

    Specifically take a look at the last two paragraphs, where there occurs relation loss with the king for fiefless lords. This trigger is set to execute at 0.5 interval, now does this mean that all fiefless vassals with less then good-natured/upstanding personality lose -2/-4 relation with the king every half an hour, i.e. 48 times PER DAY up to -192 relation total in a SINGLE day? This would explain why there are so many defections so early into the game, often at day 50 already we can see lords defecting constantly if their faction has lost some land. And then they keep defecting from their new factions, never lasting anywhere for longer than a couple days.

    Or am I understanding this wrong?
  8. Modding Q&A [For Quick Questions and Answers]

    Okay, I just found something weird in vanilla Warband and I need advice from experienced people.

    I did a search for this:
          ":faction_leader",
    in the module system files. You know, to find out all the ways the AI king can lose/gain relationship with his vassals. And guess what: there was no mention of feasts anywhere! This means that AI kings do NOT gain relation with vassals when they throw a feast. This mechanic does nothing for them. Kings can only LOSE relation with everybody (except for the occasional +10 when they award a lord with a fief) until they are hated by everyone.

    Can someone confirm? Am I maybe missing something and AI kings in fact do gain relation from feasts and I just overlooked it?

    edit: false alarm, I looked through the files again and managed to find it:

    Code:
    (call_script, "script_troop_change_relation_with_troop", ":feast_host", ":troop_no", ":relation_booster"),
  9. Looking for complete list of way for AI king to lose/gain relation with vassal

    Personally I know of these: - every time a lord's village gets raided, he loses relation with king - every time a lord is defeated in battle, he loses relation with king - when a faction's marshall is defeated and a lord has incompatible personality with marshall's, he loses relation with...
  10. Modding Q&A [For Quick Questions and Answers]

    These are all the refresh scripts:

    Code:
      # script_refresh_center_inventories
      ("refresh_center_inventories",
      [
      (set_merchandise_modifier_quality,150),
      (reset_item_probabilities,100),
    
      # Add trade goods to merchant inventories
      (try_for_range,":cur_center",towns_begin,towns_end),
        (party_get_slot,":cur_merchant",":cur_center",slot_town_merchant),
        (reset_item_probabilities,100),
          (assign, ":total_production", 0),
        (try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end),
            (call_script, "script_center_get_production", ":cur_center", ":cur_goods"),
    		(assign, ":cur_production", reg0),
    
            (try_for_range, ":cur_village", villages_begin, villages_end),
    		  (party_slot_eq, ":cur_village", slot_village_bound_center, ":cur_center"),
              (call_script, "script_center_get_production", ":cur_village", ":cur_goods"),
    		  (val_div, reg0, 3),
    		  (val_add, ":cur_production", reg0),
    		(try_end),
    
    		(val_max, ":cur_production", 1),
    		(val_mul, ":cur_production", 4),
    
    		(val_add, ":total_production", ":cur_production"),
          (try_end),
    
    	  (party_get_slot, ":town_prosperity", ":cur_center", slot_town_prosperity),
    	  (assign, ":number_of_items_in_town", 25),
    
    	  (try_begin), #1.0x - 2.0x (50 - 100 prosperity)
    	    (ge, ":town_prosperity", 50),
    		(store_sub, ":ratio", ":town_prosperity", 50),
    		(val_mul, ":ratio", 2),
    		(val_add, ":ratio", 100),
    		(val_mul, ":number_of_items_in_town", ":ratio"),
    		(val_div, ":number_of_items_in_town", 100),
    	  (else_try), #0.5x - 1.0x (0 - 50 prosperity)
    		(store_sub, ":ratio", ":town_prosperity", 50),
    		(val_add, ":ratio", 100),
    		(val_mul, ":number_of_items_in_town", ":ratio"),
    		(val_div, ":number_of_items_in_town", 100),
    	  (try_end),
    
    	  (val_clamp, ":number_of_items_in_town", 10, 40),
    
    	  (try_begin),
    	    (is_between, ":cur_center", castles_begin, castles_end),
    	    (val_div, ":number_of_items_in_town", 2),
          (try_end),
    
          (try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end),
    	  (call_script, "script_center_get_production", ":cur_center", ":cur_goods"),
    		(assign, ":cur_production", reg0),
    
            (try_for_range, ":cur_village", villages_begin, villages_end),
    		  (party_slot_eq, ":cur_village", slot_village_bound_center, ":cur_center"),
              (call_script, "script_center_get_production", ":cur_village", ":cur_goods"),
    		  (val_div, reg0, 3),
    		  (val_add, ":cur_production", reg0),
    		(try_end),
    
    		(val_max, ":cur_production", 1),
    		(val_mul, ":cur_production", 4),
    
            (val_mul, ":cur_production", ":number_of_items_in_town"),
    		(val_mul, ":cur_production", 100),
    		(val_div, ":cur_production", ":total_production"),
            (set_item_probability_in_merchandise, ":cur_goods", ":cur_production"),
        (try_end),
    
    	  (troop_clear_inventory, ":cur_merchant"),
          (troop_add_merchandise, ":cur_merchant", itp_type_goods, ":number_of_items_in_town"),
    
          (troop_ensure_inventory_space, ":cur_merchant", 20),
        (troop_sort_inventory, ":cur_merchant"),
        (store_troop_gold, ":cur_gold",":cur_merchant"),
        ##diplomacy start+
    	#Option: scaling gold additions by the prosperity of the town.
    	(try_begin),
    		(ge, "$g_dplmc_gold_changes", DPLMC_GOLD_CHANGES_LOW),#this must be explicitly enabled
    	    (party_get_slot, ":prosperity_75", ":cur_center", slot_town_prosperity),
    		(val_add, ":prosperity_75", 75),
    		(store_mul, ":target_gold", ":prosperity_75", 1500),
    		(val_add, ":target_gold", 62),
    		(val_div, ":target_gold", 125),#average 1500
    		(lt, ":cur_gold", ":target_gold"),
    		(store_random_in_range,":new_gold",500,1000),
    		(val_mul, ":new_gold", ":prosperity_75"),
    		(val_add, ":new_gold", 62),
    		(val_div, ":new_gold", 125),
    		(call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    	(else_try),
    		(lt, "$g_dplmc_gold_changes", DPLMC_GOLD_CHANGES_LOW),
    	    #fall through to default behavior
    	    ##diplomacy end+
        (lt,":cur_gold",1500),
        (store_random_in_range,":new_gold",500,1000),
        (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
        ##diplomacy start+
        (try_end),
    	##diplomacy end+
      (try_end),
      ]),
    
      # script_refresh_center_armories
      ("refresh_center_armories",
      [
    	  (reset_item_probabilities,100),
    	  (set_merchandise_modifier_quality,150),
    	  (try_for_range, ":cur_merchant", armor_merchants_begin, armor_merchants_end),
    		(store_sub, ":cur_town", ":cur_merchant", armor_merchants_begin),
    		(val_add, ":cur_town", towns_begin),
    		(troop_clear_inventory, ":cur_merchant"),
    		(party_get_slot, ":cur_faction", ":cur_town", slot_center_original_faction),
    		(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_body_armor, 16),
    		(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_head_armor, 16),
    		(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_foot_armor, 8),
    		(troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_hand_armor, 4),
    		(troop_ensure_inventory_space, ":cur_merchant", merchant_inventory_space),
    		(troop_sort_inventory, ":cur_merchant"),
    		(store_troop_gold, reg6, ":cur_merchant"),
    
    	    ##diplomacy start+
    		#Option: scaling gold additions by the prosperity of the town.
    		(try_begin),
    			(ge, "$g_dplmc_gold_changes", DPLMC_GOLD_CHANGES_LOW),#this must be explicitly enabled
    		    (party_get_slot, ":prosperity_75", ":cur_town", slot_town_prosperity),
    			(val_add, ":prosperity_75", 75),
    			(store_mul, ":target_gold", ":prosperity_75", 900),
    			(val_add, ":target_gold", 62),
    			(val_div, ":target_gold", 125),#average 900
    			(lt, reg(6), ":target_gold"),
    			(store_random_in_range,":new_gold",200,400),
    			(val_mul, ":new_gold", ":prosperity_75"),
    			(val_add, ":new_gold", 62),
    			(val_div, ":new_gold", 125),
    			(call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    		(else_try),
    			(lt, "$g_dplmc_gold_changes", DPLMC_GOLD_CHANGES_LOW),
    		    #fall through to default behavior
    		    ##diplomacy end+
    	    (lt,reg6,1000),
    	    (store_random_in_range,":new_gold",250,500),
    	    (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    		##diplomacy start+
    		(try_end),
    		##diplomacy end+
    	  (end_try),
      ]),
    
      # script_refresh_center_weaponsmiths
      ("refresh_center_weaponsmiths",
      [
    	  (reset_item_probabilities,100),
    	  (set_merchandise_modifier_quality,150),
        (try_for_range, ":cur_merchant", weapon_merchants_begin, weapon_merchants_end),
    	  (store_sub, ":cur_town", ":cur_merchant", weapon_merchants_begin),
    	    (val_add, ":cur_town", towns_begin),
    	  (troop_clear_inventory, ":cur_merchant"),
    	    (party_get_slot, ":cur_faction", ":cur_town", slot_center_original_faction),
          (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_one_handed_wpn, 5),
          (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_two_handed_wpn, 5),
          (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_polearm, 5),
          (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_shield, 6),
          (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bow, 4),
          (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_crossbow, 3),
          (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_thrown, 5),
          (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_arrows, 2),
          (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bolts, 2),
          (troop_ensure_inventory_space, ":cur_merchant", merchant_inventory_space),
          (troop_sort_inventory, ":cur_merchant"),
          (store_troop_gold, reg6, ":cur_merchant"),
    
    	    ##diplomacy start+
    		#Option: scaling gold additions by the prosperity of the town.
    		(try_begin),
    			(ge, "$g_dplmc_gold_changes", DPLMC_GOLD_CHANGES_LOW),#this must be explicitly enabled
    		    (party_get_slot, ":prosperity_75", ":cur_town", slot_town_prosperity),
    			(val_add, ":prosperity_75", 75),
    			(store_mul, ":target_gold", ":prosperity_75", 900),
    			(val_add, ":target_gold", 62),
    			(val_div, ":target_gold", 125),#average 900
    			(lt, reg6, ":target_gold"),
    			(store_random_in_range,":new_gold",200,400),
    			(val_mul, ":new_gold", ":prosperity_75"),
    			(val_add, ":new_gold", 62),
    			(val_div, ":new_gold", 125),
    			(call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    		(else_try),
    			(lt, "$g_dplmc_gold_changes", DPLMC_GOLD_CHANGES_LOW),
    		    #fall through to default behavior
    		    ##diplomacy end+
    	    (lt,reg6,1000),
    	    (store_random_in_range,":new_gold",250,500),
    	  (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    	  ##diplomacy start+
    	  (try_end),
    	  ##diplomacy end+
    	  (try_end),
      ]),
    
      # script_refresh_center_stables
      ("refresh_center_stables",
      [
          (reset_item_probabilities,100),
          (set_merchandise_modifier_quality,150),
          (try_for_range,":cur_merchant",horse_merchants_begin,horse_merchants_end),
    	  (troop_clear_inventory, ":cur_merchant"),
          (store_sub, ":cur_town", ":cur_merchant", horse_merchants_begin),
          (val_add, ":cur_town", towns_begin),
          (party_get_slot, ":cur_faction", ":cur_town", slot_center_original_faction),
          (troop_add_merchandise_with_faction,":cur_merchant", ":cur_faction",itp_type_horse,5),
          (troop_ensure_inventory_space,":cur_merchant",65),
          (troop_sort_inventory, ":cur_merchant"),
          (store_troop_gold, ":cur_gold",":cur_merchant"),
    	##diplomacy start+
    	#Option: scaling gold additions by the prosperity of the town.
    	(try_begin),
    		(ge, "$g_dplmc_gold_changes", DPLMC_GOLD_CHANGES_LOW),#this must be explicitly enabled
    	    (party_get_slot, ":prosperity_75", ":cur_town", slot_town_prosperity),
    		(val_add, ":prosperity_75", 75),
    		(store_mul, ":target_gold", ":prosperity_75", 600),
    		(val_add, ":target_gold", 62),
    		(val_div, ":target_gold", 125),#average 600
    		(lt, ":cur_gold", ":target_gold"),
    		(store_random_in_range,":new_gold",200,400),
    		(val_mul, ":new_gold", ":prosperity_75"),
    		(val_add, ":new_gold", 62),
    		(val_div, ":new_gold", 125),
    		(call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    	(else_try),
    		(lt, "$g_dplmc_gold_changes", DPLMC_GOLD_CHANGES_LOW),
    	    #fall through to default behavior
    	    ##diplomacy end+
        (lt,":cur_gold",600),
        (store_random_in_range, ":new_gold", 250, 500),
        (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
        ##diplomacy start+
        (try_end),
        ##diplomacy end+
      (try_end),
      ]),

    I don't see any references to seneschals. I suppose they are somehow linked in an array loop.

    p.s. the chests are all refilled at the exact same time the town merchants are reset. So it must be the refresh_center_inventories script. I just don't know how to exclude the damn chests from it!

    [Bcw]Btm_Earendil said:
    Or you could also move the chest in the scene editor to another place which the player cannot reach if you don't find the respective code snippet^^
    Yes, I ended up doing this instead. Worked like a charm, I guess.
  11. Modding Q&A [For Quick Questions and Answers]

    JuJu70 said:
    look up where trp_town_x_seneshal is being used - they should have their own scripts. They are not merchants.

    Unfortunately, there are no scripts at all involving seneschals, except one about marriage.
  12. Modding Q&A [For Quick Questions and Answers]

    Oh, I see. Thanks!

    Okay, so now I more or less understand how to do this. In the refresh_center_inventories script I need to add right before this piece of code:

    Code:
    (troop_clear_inventory, ":cur_merchant"),
    (troop_add_merchandise, ":cur_merchant", itp_type_goods, ":number_of_items_in_town"),

    A check to make sure ":cur_merchant" is not one of the 22 seneschals. How does one do this though? Can someone please help with the necessary syntax? I know of the neq operator of course, but I'm not sure how to choose a specific range of people from module_troops.py to scan. Here's the file if this helps: https://pastebin.com/M7dXdVct

    Or maybe one could just do something like this:

    Code:
    (neq, ":cur_merchant", "trp_town_1_seneschal"),

    ...22 times in a row for all of them. Would that work? And if yes, would I need to enclose such a check in (try_begin)(try_end)?

    Update: okay, I tried that and it didn't work, the chests still refresh. Welp, I'm out of ideas.
  13. Modding Q&A [For Quick Questions and Answers]

    SupaNinjaMan said:
    Chests are actually just troops and accessing them accesses the troops inventory, so one way to fix this would be to look for the troop the chest is tied to, then search for that troop inside a script like refresh_center_inventories or similar and comment it out.

    Thank you for your help!

    Unfortunately, I can't find any references to chests in that script:
    Code:
    ("refresh_center_inventories",
      [
      (set_merchandise_modifier_quality,150),
      (reset_item_probabilities,100),
    
      # Add trade goods to merchant inventories
      (try_for_range,":cur_center",towns_begin,towns_end),
        (party_get_slot,":cur_merchant",":cur_center",slot_town_merchant),
        (reset_item_probabilities,100),
          (assign, ":total_production", 0),
        (try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end),
            (call_script, "script_center_get_production", ":cur_center", ":cur_goods"),
    		(assign, ":cur_production", reg0),
    
            (try_for_range, ":cur_village", villages_begin, villages_end),
    		  (party_slot_eq, ":cur_village", slot_village_bound_center, ":cur_center"),
              (call_script, "script_center_get_production", ":cur_village", ":cur_goods"),
    		  (val_div, reg0, 3),
    		  (val_add, ":cur_production", reg0),
    		(try_end),
    
    		(val_max, ":cur_production", 1),
    		(val_mul, ":cur_production", 4),
    
    		(val_add, ":total_production", ":cur_production"),
          (try_end),
    
    	  (party_get_slot, ":town_prosperity", ":cur_center", slot_town_prosperity),
    	  (assign, ":number_of_items_in_town", 25),
    
    	  (try_begin), #1.0x - 2.0x (50 - 100 prosperity)
    	    (ge, ":town_prosperity", 50),
    		(store_sub, ":ratio", ":town_prosperity", 50),
    		(val_mul, ":ratio", 2),
    		(val_add, ":ratio", 100),
    		(val_mul, ":number_of_items_in_town", ":ratio"),
    		(val_div, ":number_of_items_in_town", 100),
    	  (else_try), #0.5x - 1.0x (0 - 50 prosperity)
    		(store_sub, ":ratio", ":town_prosperity", 50),
    		(val_add, ":ratio", 100),
    		(val_mul, ":number_of_items_in_town", ":ratio"),
    		(val_div, ":number_of_items_in_town", 100),
    	  (try_end),
    
    	  (val_clamp, ":number_of_items_in_town", 10, 40),
    
    	  (try_begin),
    	    (is_between, ":cur_center", castles_begin, castles_end),
    	    (val_div, ":number_of_items_in_town", 2),
          (try_end),
    
          (try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end),
    	  (call_script, "script_center_get_production", ":cur_center", ":cur_goods"),
    		(assign, ":cur_production", reg0),
    
            (try_for_range, ":cur_village", villages_begin, villages_end),
    		  (party_slot_eq, ":cur_village", slot_village_bound_center, ":cur_center"),
              (call_script, "script_center_get_production", ":cur_village", ":cur_goods"),
    		  (val_div, reg0, 3),
    		  (val_add, ":cur_production", reg0),
    		(try_end),
    
    		(val_max, ":cur_production", 1),
    		(val_mul, ":cur_production", 4),
    
            (val_mul, ":cur_production", ":number_of_items_in_town"),
    		(val_mul, ":cur_production", 100),
    		(val_div, ":cur_production", ":total_production"),
            (set_item_probability_in_merchandise, ":cur_goods", ":cur_production"),
        (try_end),
    
    	  (troop_clear_inventory, ":cur_merchant"),
          (troop_add_merchandise, ":cur_merchant", itp_type_goods, ":number_of_items_in_town"),
    
          (troop_ensure_inventory_space, ":cur_merchant", 20),
        (troop_sort_inventory, ":cur_merchant"),
        (store_troop_gold, ":cur_gold",":cur_merchant"),
        ##diplomacy start+
    	#Option: scaling gold additions by the prosperity of the town.
    	(try_begin),
    		(ge, "$g_dplmc_gold_changes", DPLMC_GOLD_CHANGES_LOW),#this must be explicitly enabled
    	    (party_get_slot, ":prosperity_75", ":cur_center", slot_town_prosperity),
    		(val_add, ":prosperity_75", 75),
    		(store_mul, ":target_gold", ":prosperity_75", 1500),
    		(val_add, ":target_gold", 62),
    		(val_div, ":target_gold", 125),#average 1500
    		(lt, ":cur_gold", ":target_gold"),
    		(store_random_in_range,":new_gold",500,1000),
    		(val_mul, ":new_gold", ":prosperity_75"),
    		(val_add, ":new_gold", 62),
    		(val_div, ":new_gold", 125),
    		(call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    	(else_try),
    		(lt, "$g_dplmc_gold_changes", DPLMC_GOLD_CHANGES_LOW),
    	    #fall through to default behavior
    	    ##diplomacy end+
        (lt,":cur_gold",1500),
        (store_random_in_range,":new_gold",500,1000),
        (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
        ##diplomacy start+
        (try_end),
    	##diplomacy end+
      (try_end),
      ]),

    I also only found four or five troops with "chest" in their names, and none of them look like they are what I'm looking for:

    Code:
    # Chests
      ["zendar_chest","{!}Zendar Chest","{!}Zendar Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,
       [],def_attrib|level(18),wp(60),knows_common, 0],
      ["tutorial_chest_1","{!}Melee Weapons Chest","{!}Melee Weapons Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[itm_tutorial_sword, itm_tutorial_axe, itm_tutorial_spear, itm_tutorial_club, itm_tutorial_battle_axe],def_attrib|level(18),wp(60),knows_common, 0],
      ["tutorial_chest_2","{!}Ranged Weapons Chest","{!}Ranged Weapons Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[itm_tutorial_short_bow, itm_tutorial_arrows, itm_tutorial_crossbow, itm_tutorial_bolts, itm_tutorial_throwing_daggers],def_attrib|level(18),wp(60),knows_common, 0],
      ["bonus_chest_1","{!}Bonus Chest","{!}Bonus Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[itm_strange_armor,itm_strange_short_sword],def_attrib|level(18),wp(60),knows_common, 0],
      ["bonus_chest_2","{!}Bonus Chest","{!}Bonus Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[itm_strange_boots,itm_strange_sword],def_attrib|level(18),wp(60),knows_common, 0],
      ["bonus_chest_3","{!}Bonus Chest","{!}Bonus Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[itm_strange_helmet,itm_strange_great_sword],def_attrib|level(18),wp(60),knows_common, 0],
    
      ["household_possessions","{!}household_possessions","{!}household_possessions",tf_hero|tf_inactive|tf_is_merchant, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_inventory_management_10, 0], 

    Though that last one has an attribute "tf_is_merchant" so theoretically it's probably included in the refresh_center_inventories script because that script I think goes through an array of merchants. But judging by the modsys files, this "household_possessions" chest is actually what you access through the dialogue in the Diplomacy chamberlain NPC menu and not that other chest that you just freely access by physically walking up to it.
  14. Modding Q&A [For Quick Questions and Answers]

    Hello fellow modders!

    I'm not exactly sure this is the right place to ask, but the Diplomacy 4.3 forum is dead and I'm trying to change one thing about that mod. You see, there are these inventory chests in the towns that the player owns and they have random contents (like, in one town there are flax and velvet in the chest, and in another there's horses etc). This would be fine, but the contents seem to respawn periodically, so you get an infinite source of free income, and that's basically cheating. Does anyone have any idea how to change this? Surely there's some sort of script responsible?

    The chest model is called 'spr_player_chest'. I tried searching for it in the Diplomacy 4.3 module system, and all I got was one line in the scene_props file.
  15. Made a simple kill count for Diplomacy 4.3

    This shows you how many people you personally killed after each battle so you know how much of a badass you are. Works in both field battles and sieges. This is for the original Diplomacy 4.3 (the one from 2012 for Warband 1.153). To install, replace mission_templates.txt with this...
Top Bottom