OSP Code QoL Improved Trade Goods Mod (small)

Users who are viewing this thread

Lav

Sergeant Knight at Arms
This small mod will greatly improve your trading experience in the world of Calradia.

More than a dozen various item modifiers are enabled for trade goods and food items, directly affecting their prices and morale values.

As most modifiers noticeably increase item prices, average profit per inventory slot grows proportionally, turning trading into a very lucrative business.

Amount of money available to general merchants in the world has been buffed up as well, so they can actually buy all those goodies you bring to them.

Food morale values are also affected - stuff your inventory with exquisite foods to make your men happy! If you can afford the price of course.

Finally, there's also a slight tweak to the "Deliver grain to village" quest. Trust me - if you bring those peasants large bags of grain instead of regular ones, they will be grateful!

Download URL #1: http://www.nexusmods.com/mountandblade/mods/3108
Download URL #2: http://www.mbrepository.com/file.php?id=3108

Both TXT and source files are included in the download, see readme.txt for details. Mod is tested for savegame compatibility with Native.

Code extracts follow:
Code:
  # Common trade goods

  ["spice","Spice", [("spice_sack",0)], itp_merchandise|itp_type_goods|itp_consumable, 0, 880,weight(40)|abundance(25)|max_ammo(50),imodbit_fine|imodbit_large_bag|imodbit_exquisite],
  ["salt","Salt", [("salt_sack",0)], itp_merchandise|itp_type_goods, 0, 255,weight(50)|abundance(120),imodbit_fine|imodbit_large_bag],
  ["oil","Oil", [("oil",0)], itp_merchandise|itp_type_goods|itp_consumable, 0, 450,weight(50)|abundance(60)|max_ammo(50),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite],
  ["pottery","Pottery", [("jug",0)], itp_merchandise|itp_type_goods, 0, 100,weight(50)|abundance(90),imodbit_cracked|imodbit_crude|imodbit_old|imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite|imodbit_masterwork|imodbit_rough|imodbit_sturdy],
  ["raw_flax","Flax Bundle", [("raw_flax",0)], itp_merchandise|itp_type_goods, 0, 150,weight(40)|abundance(90),imodbit_fine|imodbit_exquisite],
  ["linen","Linen", [("linen",0)], itp_merchandise|itp_type_goods, 0, 250,weight(40)|abundance(90),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite|imodbit_masterwork|imodbit_tattered|imodbit_ragged|imodbit_rough|imodbit_sturdy],
  ["wool","Wool", [("wool_sack",0)], itp_merchandise|itp_type_goods, 0, 130,weight(40)|abundance(90),imodbit_fine|imodbit_exquisite],
  ["wool_cloth","Wool Cloth", [("wool_cloth",0)], itp_merchandise|itp_type_goods, 0, 250,weight(40)|abundance(90),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite|imodbit_masterwork|imodbit_tattered|imodbit_ragged|imodbit_rough|imodbit_sturdy],
  ["raw_silk","Raw Silk", [("raw_silk_bundle",0)], itp_merchandise|itp_type_goods, 0, 600,weight(30)|abundance(90),imodbit_fine|imodbit_exquisite],
  ["raw_dyes","Dyes", [("dyes",0)], itp_merchandise|itp_type_goods, 0, 200,weight(10)|abundance(90),imodbit_fine|imodbit_well_made|imodbit_exquisite|imodbit_masterwork],
  ["velvet","Velvet", [("velvet",0)], itp_merchandise|itp_type_goods, 0, 1025,weight(40)|abundance(30),imodbit_fine|imodbit_well_made|imodbit_exquisite|imodbit_masterwork],
  ["iron","Iron", [("iron",0)], itp_merchandise|itp_type_goods, 0,264,weight(60)|abundance(60),imodbit_rusty|imodbit_poor|imodbit_well_made|imodbit_tempered|imodbit_hardened],
  ["tools","Tools", [("iron_hammer",0)], itp_merchandise|itp_type_goods, 0, 410,weight(50)|abundance(90),imodbit_rusty|imodbit_crude|imodbit_old|imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite|imodbit_masterwork|imodbit_sturdy|imodbit_hardened],
  ["raw_leather","Hides", [("leatherwork_inventory",0)], itp_merchandise|itp_type_goods, 0, 120,weight(40)|abundance(90),imodbit_fine|imodbit_exquisite|imodbit_tattered|imodbit_ragged|imodbit_sturdy|imodbit_thick],
  ["leatherwork","Leatherwork", [("leatherwork_frame",0)], itp_merchandise|itp_type_goods, 0, 220,weight(40)|abundance(90),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite|imodbit_masterwork|imodbit_tattered|imodbit_ragged|imodbit_rough|imodbit_sturdy|imodbit_thick],
  ["raw_date_fruit","Date Fruit", [("date_inventory",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 120,weight(40)|food_quality(10)|max_ammo(10),imodbit_cheap|imodbit_fine|imodbit_exquisite],
  ["furs","Furs", [("fur_pack",0)], itp_merchandise|itp_type_goods, 0, 391,weight(40)|abundance(90),imodbit_cheap|imodbit_fine|imodbit_exquisite|imodbit_tattered|imodbit_ragged|imodbit_sturdy|imodbit_thick],

  # Drinking consumables

  ["wine","Wine", [("amphora_slim",0)], itp_merchandise|itp_type_goods|itp_consumable, 0, 220,weight(30)|abundance(60)|max_ammo(50),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite|imodbit_strong],
  ["ale","Ale", [("ale_barrel",0)], itp_merchandise|itp_type_goods|itp_consumable, 0, 120,weight(30)|abundance(70)|max_ammo(50),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite|imodbit_strong|imodbit_lordly],

  # Food consumables

  ["smoked_fish","Smoked Fish", [("smoked_fish",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 65,weight(15)|abundance(110)|food_quality(50)|max_ammo(50),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite],
  ["cheese","Cheese", [("cheese_b",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 75,weight(6)|abundance(110)|food_quality(40)|max_ammo(30),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite],
  ["honey","Honey", [("honey_pot",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 220,weight(5)|abundance(110)|food_quality(40)|max_ammo(30),imodbit_cheap|imodbit_fine|imodbit_exquisite],
  ["sausages","Sausages", [("sausages",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 85,weight(10)|abundance(110)|food_quality(40)|max_ammo(40),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite],
  ["cabbages","Cabbages", [("cabbage",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 30,weight(15)|abundance(110)|food_quality(40)|max_ammo(50),imodbit_cheap|imodbit_fine|imodbit_exquisite],
  ["dried_meat","Dried Meat", [("smoked_meat",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 85,weight(15)|abundance(100)|food_quality(70)|max_ammo(50),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite],
  ["apples","Fruit", [("apple_basket",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 44,weight(20)|abundance(110)|food_quality(40)|max_ammo(50),imodbit_cheap|imodbit_fine|imodbit_exquisite],
  ["raw_grapes","Grapes", [("grapes_inventory",0)], itp_merchandise|itp_consumable|itp_type_goods, 0, 75,weight(40)|abundance(90)|food_quality(10)|max_ammo(10),imodbits_none], #x2 for imodbit_cheap|imodbit_fine|imodbit_exquisite
  ["raw_olives","Olives", [("olive_inventory",0)], itp_merchandise|itp_consumable|itp_type_goods, 0, 100,weight(40)|abundance(90)|food_quality(10)|max_ammo(10),imodbits_none], #x3 for imodbit_cheap|imodbit_fine|imodbit_exquisite
  ["grain","Grain", [("wheat_sack",0)], itp_merchandise|itp_type_goods|itp_consumable, 0, 30,weight(30)|abundance(110)|food_quality(40)|max_ammo(50),imodbit_cheap|imodbit_fine|imodbit_exquisite|imodbit_large_bag],
  ["cattle_meat","Beef", [("raw_meat",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 80,weight(20)|abundance(100)|food_quality(80)|max_ammo(50),imodbits_none],
  ["bread","Bread", [("bread_a",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 50,weight(30)|abundance(110)|food_quality(40)|max_ammo(50),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite],
  ["chicken","Chicken", [("chicken",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 95,weight(10)|abundance(110)|food_quality(40)|max_ammo(50),imodbits_none],
  ["pork","Pork", [("pork",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 75,weight(15)|abundance(100)|food_quality(70)|max_ammo(50),imodbits_none],
  ["butter","Butter", [("butter_pot",0)], itp_merchandise|itp_type_goods|itp_consumable|itp_food, 0, 150,weight(6)|abundance(110)|food_quality(40)|max_ammo(30),imodbit_cheap|imodbit_fine|imodbit_well_made|imodbit_exquisite],

Code:
  #script_game_get_item_extra_text:
  # This script is called from the game engine when an item's properties are displayed.
  # INPUT: arg1 = item_no, arg2 = extra_text_id (this can be between 0-7 (7 included)), arg3 = item_modifier
  # OUTPUT: result_string = item extra text, trigger_result = text color (0 for default)
  ("game_get_item_extra_text",
    [
      (store_script_param, ":item_no", 1),
      (store_script_param, ":extra_text_id", 2),
      (store_script_param, ":item_modifier", 3),
      (try_begin),
        (is_between, ":item_no", food_begin, food_end),
        (try_begin),
          (eq, ":extra_text_id", 0),
          (assign, ":continue", 1),
          (try_begin),
            (this_or_next|eq, ":item_no", "itm_cattle_meat"),
            (this_or_next|eq, ":item_no", "itm_pork"),
            (eq, ":item_no", "itm_chicken"),
            (eq, ":item_modifier", imod_rotten),
            (assign, ":continue", 0),
          (try_end),
          (eq, ":continue", 1),
          (item_get_slot, ":food_bonus", ":item_no", slot_item_food_bonus),

########################################################################################################################
# LAV MODIFICATIONS START (TRADE GOODS MOD)
########################################################################################################################
          (try_begin),
            (eq, ":item_modifier", imod_cheap),
            (val_sub, ":food_bonus", 2),
          (else_try),
            (eq, ":item_modifier", imod_fine),
            (val_add, ":food_bonus", 1),
          (else_try),
            (eq, ":item_modifier", imod_well_made),
            (val_add, ":food_bonus", 2),
          (else_try),
            (eq, ":item_modifier", imod_strong),
            (val_add, ":food_bonus", 3),
          (else_try),
            (eq, ":item_modifier", imod_lordly),
            (val_add, ":food_bonus", 5),
          (else_try),
            (eq, ":item_modifier", imod_exquisite),
            (val_add, ":food_bonus", 6),
          (try_end),
########################################################################################################################
# LAV MODIFICATIONS END (TRADE GOODS MOD)
########################################################################################################################

          (assign, reg1, ":food_bonus"),
          (set_result_string, "@+{reg1} to party morale"),
          (set_trigger_result, 0x4444FF),
# ATTENTION!
# If you do not need savegame compatibility with Native, comment previous two lines of code and uncomment this:
#          (try_begin),
#            (ge, reg1, 0),
#            (set_result_string, "@+{reg1} to party morale"),
#            (set_trigger_result, 0x4444FF),
#          (else_try),
#            (set_result_string, "@{reg1} to party morale"),
#            (set_trigger_result, 0xFF4444),
#          (try_end),
        (try_end),
      (else_try),
        (is_between, ":item_no", readable_books_begin, readable_books_end),
        (try_begin),
          (eq, ":extra_text_id", 0),
          (item_get_slot, reg1, ":item_no", slot_item_intelligence_requirement),
          (set_result_string, "@Requires {reg1} intelligence to read"),
          (set_trigger_result, 0xFFEEDD),
        (else_try),
          (eq, ":extra_text_id", 1),
          (item_get_slot, ":progress", ":item_no", slot_item_book_reading_progress),
          (val_div, ":progress", 10),
          (assign, reg1, ":progress"),
          (set_result_string, "@Reading Progress: {reg1}%"),
          (set_trigger_result, 0xFFEEDD),
        (try_end),
      (else_try),
        (is_between, ":item_no", reference_books_begin, reference_books_end),
        (try_begin),
          (eq, ":extra_text_id", 0),
          (try_begin),
            (eq, ":item_no", "itm_book_wound_treatment_reference"),
            (str_store_string, s1, "@wound treament"),
          (else_try),
            (eq, ":item_no", "itm_book_training_reference"),
            (str_store_string, s1, "@trainer"),
          (else_try),
            (eq, ":item_no", "itm_book_surgery_reference"),
            (str_store_string, s1, "@surgery"),
          (try_end),
          (set_result_string, "@+1 to {s1} while in inventory"),
          (set_trigger_result, 0xFFEEDD),
        (try_end),
      (try_end),
  ]),
Code:
  # Input: arg1 = item_id, arg2 = modifier
  # Output: reg0 = item_modifier_if_found (can_fail)
  ("cf_player_has_item_without_modifier",
    [
      (store_script_param, ":item_id", 1),
      (store_script_param, ":modifier", 2),
      (player_has_item, ":item_id"),
      #checking if any of the meat is not rotten
      (assign, ":has_without_modifier", 0),
      (troop_get_inventory_capacity, ":inv_size", "trp_player"),
      (try_for_range, ":i_slot", 0, ":inv_size"),
        (troop_get_inventory_slot, ":cur_item", "trp_player", ":i_slot"),
        (eq, ":cur_item", ":item_id"),
        (troop_get_inventory_slot_modifier, ":cur_modifier", "trp_player", ":i_slot"),
        (neq, ":cur_modifier", ":modifier"),
        (assign, ":has_without_modifier", 1),

########################################################################################################################
# LAV MODIFICATIONS START (TRADE GOODS MOD)
########################################################################################################################
        (assign, reg0, ":cur_modifier"),
########################################################################################################################
# LAV MODIFICATIONS END (TRADE GOODS MOD)
########################################################################################################################

        (assign, ":inv_size", 0), #break
      (try_end),
      (eq, ":has_without_modifier", 1),
  ]),
Code:
  # script_get_player_party_morale_values
  # Output: reg0 = player_party_morale_target
  ("get_player_party_morale_values",
    [
      (party_get_num_companion_stacks, ":num_stacks","p_main_party"),
      (assign, ":num_men", 0),
      (try_for_range, ":i_stack", 1, ":num_stacks"),
        (party_stack_get_troop_id, ":stack_troop","p_main_party",":i_stack"),
        (try_begin),
          (troop_is_hero, ":stack_troop"),
          (val_add, ":num_men", 1), #it was 3 in "Mount&Blade", now it is 1 in Warband
        (else_try),
          (party_stack_get_size, ":stack_size","p_main_party",":i_stack"),
          (val_add, ":num_men", ":stack_size"),
        (try_end),
      (try_end),
      (assign, "$g_player_party_morale_modifier_party_size", ":num_men"),
    
      (store_skill_level, ":player_leadership", "skl_leadership", "trp_player"),
      
      (try_begin),
        (eq, "$players_kingdom", "fac_player_supporters_faction"),
        (faction_get_slot, ":cur_faction_king", "$players_kingdom", slot_faction_leader),
        (eq, ":cur_faction_king", "trp_player"),
        (store_mul, "$g_player_party_morale_modifier_leadership", ":player_leadership", 15),
      (else_try),  
        (store_mul, "$g_player_party_morale_modifier_leadership", ":player_leadership", 12),
      (try_end),  
      
      (assign, ":new_morale", "$g_player_party_morale_modifier_leadership"),
      (val_sub, ":new_morale", "$g_player_party_morale_modifier_party_size"),
      
      (val_add, ":new_morale", 50),
      
      (assign, "$g_player_party_morale_modifier_food", 0),
      (try_for_range, ":cur_edible", food_begin, food_end),      
        (call_script, "script_cf_player_has_item_without_modifier", ":cur_edible", imod_rotten),
        (item_get_slot, ":food_bonus", ":cur_edible", slot_item_food_bonus),

########################################################################################################################
# LAV MODIFICATIONS START (TRADE GOODS MOD)
########################################################################################################################
        (try_begin),
          (eq, reg0, imod_cheap),
          (val_sub, ":food_bonus", 2),
        (else_try),
          (eq, reg0, imod_fine),
          (val_add, ":food_bonus", 1),
        (else_try),
          (eq, reg0, imod_well_made),
          (val_add, ":food_bonus", 2),
        (else_try),
          (eq, reg0, imod_strong),
          (val_add, ":food_bonus", 3),
        (else_try),
          (eq, reg0, imod_lordly),
          (val_add, ":food_bonus", 5),
        (else_try),
          (eq, reg0, imod_exquisite),
          (val_add, ":food_bonus", 6),
        (try_end),
########################################################################################################################
# LAV MODIFICATIONS END (TRADE GOODS MOD)
########################################################################################################################
        
        (val_mul, ":food_bonus", 3),
        (val_div, ":food_bonus", 2),
        
        (val_add, "$g_player_party_morale_modifier_food", ":food_bonus"),
      (try_end),
      (val_add, ":new_morale", "$g_player_party_morale_modifier_food"),

      (try_begin),
        (eq, "$g_player_party_morale_modifier_food", 0),
        (assign, "$g_player_party_morale_modifier_no_food", 30),
        (val_sub, ":new_morale", "$g_player_party_morale_modifier_no_food"),
      (else_try),
        (assign, "$g_player_party_morale_modifier_no_food", 0),
      (try_end),

      (assign, "$g_player_party_morale_modifier_debt", 0),
      (try_begin),
        (gt, "$g_player_debt_to_party_members", 0),
        (call_script, "script_calculate_player_faction_wage"),
        (assign, ":total_wages", reg0),
        (store_mul, "$g_player_party_morale_modifier_debt", "$g_player_debt_to_party_members", 10),
		(val_max, ":total_wages", 1),
        (val_div, "$g_player_party_morale_modifier_debt", ":total_wages"),
        (val_clamp, "$g_player_party_morale_modifier_debt", 1, 31),
        (val_sub, ":new_morale", "$g_player_party_morale_modifier_debt"),
      (try_end),

      (val_clamp, ":new_morale", 0, 100),
      (assign, reg0, ":new_morale"),
      ]),
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"),
########################################################################################################################
# LAV MODIFICATIONS START (TRADE GOODS MOD)
########################################################################################################################
      (lt,":cur_gold",15000),
      (store_random_in_range,":new_gold",5000,10000),
########################################################################################################################
# LAV MODIFICATIONS END (TRADE GOODS MOD)
########################################################################################################################
      (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    (try_end), 	
  ]),

Code:
  [anyone,"village_elder_deliver_grain_thank", [(str_store_party_name, s13, "$current_town")],
   "My good {lord/lady}. You have saved us from hunger and desperation. We cannot thank you enough, but you'll always be in our prayers.\
 The village of {s13} will not forget what you have done for us.", "village_elder_deliver_grain_thank_2",
   [(quest_get_slot, ":quest_target_amount", "qst_deliver_grain", slot_quest_target_amount),

########################################################################################################################
# LAV MODIFICATIONS START (TRADE GOODS MOD)
########################################################################################################################
    #(troop_remove_items, "trp_player", "itm_grain", ":quest_target_amount"),
    (troop_get_inventory_capacity, ":inv_size", "trp_player"),
    (assign, ":result_xp_reward", 300), # Was 400
    (assign, ":result_prosperity", 3),  # Was 4
    (assign, ":result_relation", 4),    # Was 5
    (try_for_range, ":i_slot", 0, ":inv_size"),
      (troop_get_inventory_slot, ":cur_item", "trp_player", ":i_slot"),
      (eq, ":cur_item", "itm_grain"),
      (troop_get_inventory_slot_modifier, ":cur_modifier", "trp_player", ":i_slot"),
      (try_begin),
        (eq, ":cur_modifier", imod_large_bag), # These men are starving, they only care about quantity, so no bonus or penalty for quality
        (val_add, ":result_xp_reward", 50),
        (val_add, ":result_prosperity", 1),
        (val_add, ":result_relation", 1),
      (try_end),
      (troop_remove_item, "itm_grain", 1),
      (val_sub, ":quest_target_amount", 1),
      (lt, ":quest_target_amount", 1),
      (assign, ":inv_size", 0), #break
    (try_end),
    (add_xp_as_reward, ":result_xp_reward"),
    (call_script, "script_change_center_prosperity", "$current_town", ":result_prosperity"),
    (call_script, "script_change_player_relation_with_center", "$current_town", ":result_relation"),
########################################################################################################################
# LAV MODIFICATIONS END (TRADE GOODS MOD)
########################################################################################################################

    (call_script, "script_end_quest", "qst_deliver_grain"),
#Troop commentaries begin
    (call_script, "script_add_log_entry", logent_helped_peasants, "trp_player",  "$current_town", -1, -1),
#Troop commentaries end
   ]],

2livonk.jpg


300ad51.jpg
 
Just in case someone is interested, here's the list of all item modifiers available in the game and their effects. I needed this list to use as a reference but couldn't find it anywhere, so compiled it myself.

In fact the entire Trade Goods mod is just a side-effect of me building this list. :smile:

First value is constant name. Second is game text. Third is price modifier. Fourth is modifier rarity. And finally there's a list of all applicable item types and corresponding effects for that item.
Code:
# imod_plain       Plain_%s         1.000000  1.000000
# imod_cracked     Cracked_%s       0.500000  1.000000  Armor (ac-4), Shield (ac-4, hp-46), Weapon (damage-5), Horse (ac-4, hp-46)
# imod_rusty       Rusty_%s         0.550000  1.000000  Armor (ac-3), Shield (ac-3), Weapon (dmg-3), Horse (ac-3)
# imod_bent        Bent_%s          0.650000  1.000000  Shield (speed-3), Weapon (dmg-3, speed-3)
# imod_chipped     Chipped_%s       0.720000  1.000000  Weapon (dmg-1)
# imod_battered    Battered_%s      0.750000  1.000000  Armor (ac-2), Shield (ac-2, hp-26), Horse (ac-2, hp-26)
# imod_poor        Poor_%s          0.800000  1.000000  
# imod_crude       Crude_%s         0.830000  1.000000  Armor (ac-1), Shield (ac-1), Weapon (dmg-2), Horse (ac-1)
# imod_old         Old_%s           0.860000  1.000000
# imod_cheap       Cheap_%s         0.900000  1.000000
# imod_fine        Fine_%s          1.900000  0.600000  Weapon (dmg+1)
# imod_well_made   Well_Made_%s     2.500000  0.500000
# imod_sharp       Sharp_%s         1.600000  0.600000
# imod_balanced    Balanced_%s      3.500000  0.500000  Shield (speed+3), Weapon (dmg+3, speed+3)
# imod_tempered    Tempered_%s      6.700000  0.400000  Weapon (dmg+4)
# imod_deadly      Deadly_%s        8.500000  0.300000
# imod_exquisite   Exquisite_%s    14.500000  0.300000
# imod_masterwork  Masterwork_%s   17.500000  0.300000  Armor (req+4), Shield (speed+1), Weapon (dmg+5, speed+1, req+4)
# imod_heavy       Heavy_%s         1.900000  0.700000  Armor (ac+3, req+1), Shield (ac+3, hp+10, speed-2, req+1), Weapon (speed-2, damage+2, req+1), Horse (ac+3, charge+4, hp+10)
# imod_strong      Strong_%s        4.900000  0.400000  Armor (req+2), Shield (speed-3), Weapon (dmg+3, speed-3, req+2)
# imod_powerful    Powerful_%s      3.200000  0.400000
# imod_tattered    Tattered_%s      0.500000  1.000000  Armor (ac-3), Shield (ac-3), Horse (ac-3)
# imod_ragged      Ragged_%s        0.700000  1.000000  Armor (ac-2), Shield (ac-2), Horse (ac-2)
# imod_rough       Rough_%s         0.600000  1.000000
# imod_sturdy      Sturdy_%s        1.700000  0.500000  Armor (ac+1), Shield (ac+1), Horse (ac+1)
# imod_thick       Thick_%s         2.600000  0.350000  Armor (ac+2), Shield (ac+2, hp+47), Horse (ac+2, hp+47)
# imod_hardened    Hardened_%s      3.900000  0.300000  Armor (ac+3), Shield (ac+3), Horse (ac+3)
# imod_reinforced  Reinforced_%s    6.500000  0.250000  Armor (ac+4), Shield (ac+4, hp+83), Horse (ac+4, hp+83)
# imod_superb      Superb_%s        2.500000  0.250000
# imod_lordly      Lordly_%s       11.500000  0.250000  Armor (ac+6), Shield (ac+6, hp+155), Horse (ac+6, hp+155)
# imod_lame        Lame_%s          0.400000  1.000000  Horse (speed-10, maneuver-5)
# imod_swaybacked  Swaybacked_%s    0.600000  1.000000  Horse (speed-4, maneuver-2)
# imod_stubborn    Stubborn_%s      0.900000  1.000000  Shield (hp+5), Horse (hp+5, req+1)
# imod_timid       Timid_%s         1.800000  1.000000
# imod_meek        Meek_%s          1.800000  1.000000
# imod_spirited    Spirited_%s      6.500000  0.600000  Horse (speed+2, maneuver+1, charge+1)
# imod_champion    Champion_%s     14.500000  0.200000  Horse (speed+4, maneuver+2, charge+2, req+2)
# imod_fresh       Fresh_%s         1.000000  1.000000
# imod_day_old     Day-old_%s       1.000000  1.000000
# imod_two_day_old Two_Days-old_%s  0.900000  1.000000
# imod_smelling    Smelling_%s      0.400000  1.000000
# imod_rotten      Rotten_%s        0.050000  1.000000
# imod_large_bag   Large_Bag_of_%s  1.900000  0.300000  Food (qty+6), Ammo (amount+6), Crossbow (capable to fire twice)
 
Ikaguia said:
I think I'll add this to FIMP, nice and well done...
Sure, but - do you have any foods in FIMP which have morale value less than +2? I designed the code to be savegame-compatible with Native, but because of this the code doesn't process such situation properly, and may display something like "+-1 to party morale". It's quite easy to fix (just a few more changed lines in script_game_get_item_extra_text). I'll add the fix now to the first post as commented code.
 
Hello,

I'm trying to install the mod but I can't find "script_refresh_center_inventories" in module_scripts.py.
Where the hell is this damned script ?
Playing Diplomacy+PBO

Thanks for the answers.
 
pino69 said:
Hello,

I'm trying to install the mod but I can't find "script_refresh_center_inventories" in module_scripts.py.
Where the hell is this damned script ?
Playing Diplomacy+PBO

Thanks for the answers.
I'm not sure what Warband version that script appeared in. In the earlier versions IIRC the merchant inventories were refreshed in triggers, not in scripts. Try looking not for the script name, but for the specific code lines, variable names and operation calls.
 
Lav,

I'm using 1.134.
Just found the solution : the code is in module_triggers.py.
I suggest you update your first post for 1.134 users :wink:

Thanks
 
pino69 said:
I'm using 1.134.
Just found the solution : the code is in module_triggers.py.
I suggest you update your first post for 1.134 users :wink:
The current version is 1.143 and the new script_referesh_center_* were added as part of a change in the way the engine handles the merchant inventory operations (thus, the merchant refresh code is no longer in module_triggers, but now in module_scripts). 1.134 is now 6 months out of date.
 
It looks like you have a way to add new item modifiers, am I understanding this right?! :wink:
I've been searching like crazy on this subject to no avail ... hardcoded.  Or not.
If I'm right, that you've added new item modifiers, is there some kind of tutorial as to how I might be able to do it myself?  (I've been searching and searching, like I said, but found nothing but reports of it being hard-coded, so I'm looking in the wrong place, I guess?)
(I've been wanting to add more quality modifiers to horses and maybe some "fancy" weapon modifiers as well)
 
No, you can't add new item modifiers, as their effects are hardcoded (but their price modifier and rarity are modifiable in the txt file). In Native, most trade goods only possess the plain modifier. You can make any imodbit groups with | (binary or), which allows the item to appear as merchandise with any of those modifiers. To make "fancy" weapons just make a new item entry with whatever bonus you want.
 
Somebody said:
No, you can't add new item modifiers, as their effects are hardcoded (but their price modifier and rarity are modifiable in the txt file).
Note that their names are also modifiable in the txt, which is nice. The only thing you are stuck with are the hardcoded effects.

Also the unused modifiers can be used freely for various script-coded effects (enchanted sword anyone?).
 
Back
Top Bottom