Bu günlerde mod ile uğraştığımdan buralar bomboş kaldı.Yakında yenileri gelir.
Tesekkur ederimBlack Dead said:Baya bir uzun dersmiş tebrikler
Knife said:eline sağlık çok uğraşıyosun anladığım kadarıyla saol
google ortaylı ya sorabilirsinKnife said:tamamda hacı o link kırık çıktı bana bi zahmet module systemi atabilirmisin?meşgulsen biri atabilirmi dosyatcye yada bildiğiniz site varsa?ömür boyu minnettar kalırım atana
HyperCharge said:Dersin devamı;
İyide bu gemiler niye karaya toslamış hep öylemi oluyoEvet,Devam ediyoruz;;;
Yine module_scripts de şunu bulun;
Onu da bununla değiştirin;Code:# Towns: (try_for_range, ":item_no", trade_goods_begin, trade_goods_end), (store_sub, ":offset", ":item_no", trade_goods_begin), (val_add, ":offset", slot_town_trade_good_prices_begin), (try_for_range, ":center_no", centers_begin, centers_end), (party_set_slot, ":center_no", ":offset", average_price_factor), #1000 (try_end), (try_end), (call_script, "script_initialize_trade_routes"), (call_script, "script_initialize_town_arena_info"), #start some tournaments (try_for_range, ":town_no", towns_begin, towns_end), (store_random_in_range, ":rand", 0, 100), (lt, ":rand", 20), (store_random_in_range, ":random_days", 12, 15), (party_set_slot, ":town_no", slot_town_has_tournament, ":random_days"), (try_end),
Daha sonra,alttaki kodu bulun;Code:# Towns: (try_for_range, ":item_no", trade_goods_begin, trade_goods_end), (store_sub, ":offset", ":item_no", trade_goods_begin), (val_add, ":offset", slot_town_trade_good_prices_begin), (try_for_range, ":center_no", centers_begin, centers_end), (party_set_slot, ":center_no", ":offset", average_price_factor), #1000 (try_end), ## (party_set_slot, "p_zendar", ":offset", average_price_factor), ## (party_set_slot, "p_salt_mine", ":offset", average_price_factor), ## (party_set_slot, "p_four_ways_inn", ":offset", average_price_factor), (try_end), (call_script, "script_initialize_trade_routes"), (call_script, "script_initialize_sea_trade_routes"), ###Seatrade Marker (call_script, "script_initialize_town_arena_info"), #start some tournaments (try_for_range, ":town_no", towns_begin, towns_end), (store_random_in_range, ":rand", 0, 100), (lt, ":rand", 20), (store_random_in_range, ":random_days", 12, 15), (party_set_slot, ":town_no", slot_town_has_tournament, ":random_days"), (try_end),
Bunun üstüne şunu yapıştırın;Code:#script_initialize_tavern_variables ( "initialize_tavern_variables", [ (assign, "$g_main_attacker_agent", 0), (assign, "$g_attacker_drawn_weapon", 0), (assign, "$g_start_belligerent_drunk_fight", 0), (assign, "$g_start_hired_assassin_fight", 0), (assign, "$g_belligerent_drunk_leaving", 0), ]),
Sonuç olarak şöyle gözükmeli;Code:("initialize_sea_trade_routes", [ (party_set_slot, "p_town_1", slot_town_is_coastal, 4), #Sargoth (party_set_slot, "p_town_2", slot_town_is_coastal, 2), #Thir (party_set_slot, "p_town_6", slot_town_is_coastal, 3), #Praven (party_set_slot, "p_town_12", slot_town_is_coastal, 3), #Wercheg (party_set_slot, "p_town_13", slot_town_is_coastal, 5), #Rivacheg (party_set_slot, "p_town_15", slot_town_is_coastal, 4), #Yalen (party_set_slot, "p_town_19", slot_town_is_coastal, 8), #Shariz #RIVACHEG - 2 Routes (call_script, "script_set_trade_route_between_centers", "p_town_13", "p_town_2"), #Rivacheg - Thir (call_script, "script_set_trade_route_between_centers", "p_town_13", "p_town_6"), #Rivacheg - Praven #WERCHEG - 2 Routes (call_script, "script_set_trade_route_between_centers", "p_town_12", "p_town_2"), #Wercheg - Thir (call_script, "script_set_trade_route_between_centers", "p_town_12", "p_town_1"), #Wercheg - Sargoth #SARGOTH - 2 routes #Wercheg (call_script, "script_set_trade_route_between_centers", "p_town_1", "p_town_2"), #Sargoth - Tihr #TIHR - 4 Routes #Rivacheg, Wercheg, Sargoth (call_script, "script_set_trade_route_between_centers", "p_town_2", "p_town_6"), #Tihr - Praven #Praven - 3 Routes #Rivacheg, Thir (call_script, "script_set_trade_route_between_centers", "p_town_6", "p_town_15"), #Praven - Yalen #Yalen - 2 Routes #Praven (call_script, "script_set_trade_route_between_centers", "p_town_15", "p_town_19"), #Yalen - Shariz #Shariz - 1 Route #Yalen ]),
Daha sonra,Yine scripts de şunu bulun;Code:("initialize_sea_trade_routes", [ (party_set_slot, "p_town_1", slot_town_is_coastal, 4), #Sargoth (party_set_slot, "p_town_2", slot_town_is_coastal, 2), #Thir (party_set_slot, "p_town_6", slot_town_is_coastal, 3), #Praven (party_set_slot, "p_town_12", slot_town_is_coastal, 3), #Wercheg (party_set_slot, "p_town_13", slot_town_is_coastal, 5), #Rivacheg (party_set_slot, "p_town_15", slot_town_is_coastal, 4), #Yalen (party_set_slot, "p_town_19", slot_town_is_coastal, 8), #Shariz #RIVACHEG - 2 Routes (call_script, "script_set_trade_route_between_centers", "p_town_13", "p_town_2"), #Rivacheg - Thir (call_script, "script_set_trade_route_between_centers", "p_town_13", "p_town_6"), #Rivacheg - Praven #WERCHEG - 2 Routes (call_script, "script_set_trade_route_between_centers", "p_town_12", "p_town_2"), #Wercheg - Thir (call_script, "script_set_trade_route_between_centers", "p_town_12", "p_town_1"), #Wercheg - Sargoth #SARGOTH - 2 routes #Wercheg (call_script, "script_set_trade_route_between_centers", "p_town_1", "p_town_2"), #Sargoth - Tihr #TIHR - 4 Routes #Rivacheg, Wercheg, Sargoth (call_script, "script_set_trade_route_between_centers", "p_town_2", "p_town_6"), #Tihr - Praven #Praven - 3 Routes #Rivacheg, Thir (call_script, "script_set_trade_route_between_centers", "p_town_6", "p_town_15"), #Praven - Yalen #Yalen - 2 Routes #Praven (call_script, "script_set_trade_route_between_centers", "p_town_15", "p_town_19"), #Yalen - Shariz #Shariz - 1 Route #Yalen ]), #script_initialize_tavern_variables ( "initialize_tavern_variables", [ (assign, "$g_main_attacker_agent", 0), (assign, "$g_attacker_drawn_weapon", 0), (assign, "$g_start_belligerent_drunk_fight", 0), (assign, "$g_start_hired_assassin_fight", 0), (assign, "$g_belligerent_drunk_leaving", 0), ]),
Daha sonra,Bunu da alttaki ile değiştirin.;Code:("cf_select_most_profitable_town_at_peace_with_faction_in_trade_route", [ (store_script_param, ":town_no", 1), (store_script_param, ":faction_no", 2), (assign, ":result", -1), (assign, ":best_town_score", 0), (store_sub, ":item_to_price_slot", slot_town_trade_good_prices_begin, trade_goods_begin), (try_for_range, ":cur_slot", slot_town_trade_routes_begin, slot_town_trade_routes_end), (party_get_slot, ":cur_town", ":town_no", ":cur_slot"), (gt, ":cur_town", 0), (store_faction_of_party, ":cur_faction", ":cur_town"), (store_relation, ":reln", ":cur_faction", ":faction_no"), (ge, ":reln", 0), (assign, ":cur_town_score", 0), (try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end), (neq, ":cur_goods", "itm_butter"), #Don't count perishables (neq, ":cur_goods", "itm_cattle_meat"), (neq, ":cur_goods", "itm_chicken"), (neq, ":cur_goods", "itm_pork"), (store_add, ":cur_goods_price_slot", ":cur_goods", ":item_to_price_slot"), (party_get_slot, ":origin_price", ":town_no", ":cur_goods_price_slot"), (party_get_slot, ":destination_price", ":cur_town", ":cur_goods_price_slot"), (gt, ":destination_price", ":origin_price"), (store_sub, ":price_dif", ":destination_price", ":origin_price"), (try_begin), #weight luxury goods double (this_or_next|eq, ":cur_goods", "itm_spice"), (eq, ":cur_goods", "itm_velvet"), (val_mul, ":price_dif", 2), (try_end), (val_add, ":cur_town_score", ":price_dif"), (try_end), ## (try_begin), ## (eq, "$cheat_mode", 1), ## (str_store_party_name, s10, ":town_no"), ## (str_store_party_name, s11, ":cur_town"), ## (assign, reg3, ":cur_town_score"), ## (display_message, "str_caravan_in_s10_considers_s11_total_price_dif_=_reg3"), ## (try_end), (gt, ":cur_town_score", ":best_town_score"), (assign, ":best_town_score", ":cur_town_score"), (assign, ":result", ":cur_town"), (try_end), (gt, ":result", -1), #Fail if there are no towns (assign, reg0, ":result"), # (store_current_hours, ":hour"), # (party_set_slot, ":result", slot_town_caravan_last_visit, ":hour"), ## (try_begin), ## (eq, "$cheat_mode", 1), ## (assign, reg3, ":best_town_score"), ## (str_store_party_name, s3, ":town_no"), ## (str_store_party_name, s4, ":result"), ## (display_message, "str_test__caravan_in_s3_selects_for_s4_trade_score_reg3"), ## (try_end), ]),
Son olarak da,Module_simple_triggers'ı açın ve şunu bulun;Code:("cf_select_most_profitable_town_at_peace_with_faction_in_trade_route", [ (store_script_param, ":town_no", 1), (store_script_param, ":faction_no", 2), (assign, ":result", -1), (assign, ":best_town_score", 0), (store_sub, ":item_to_price_slot", slot_town_trade_good_prices_begin, trade_goods_begin), (try_for_range, ":cur_slot", slot_town_trade_routes_begin, slot_town_trade_routes_end), (party_get_slot, ":cur_town", ":town_no", ":cur_slot"), (gt, ":cur_town", 0), (party_slot_ge, ":cur_town", slot_town_is_coastal, 1), #Seatrade (store_faction_of_party, ":cur_faction", ":cur_town"), (store_relation, ":reln", ":cur_faction", ":faction_no"), (ge, ":reln", 0), (assign, ":cur_town_score", 0), (try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end), (neq, ":cur_goods", "itm_butter"), #Don't count perishables (neq, ":cur_goods", "itm_cattle_meat"), (neq, ":cur_goods", "itm_chicken"), (neq, ":cur_goods", "itm_pork"), (store_add, ":cur_goods_price_slot", ":cur_goods", ":item_to_price_slot"), (party_get_slot, ":origin_price", ":town_no", ":cur_goods_price_slot"), (party_get_slot, ":destination_price", ":cur_town", ":cur_goods_price_slot"), (gt, ":destination_price", ":origin_price"), (store_sub, ":price_dif", ":destination_price", ":origin_price"), (try_begin), #weight luxury goods double (this_or_next|eq, ":cur_goods", "itm_spice"), (eq, ":cur_goods", "itm_velvet"), (val_mul, ":price_dif", 2), (try_end), (val_add, ":cur_town_score", ":price_dif"), (try_end), ## (try_begin), ## (eq, "$cheat_mode", 1), ## (str_store_party_name, s10, ":town_no"), ## (str_store_party_name, s11, ":cur_town"), ## (assign, reg3, ":cur_town_score"), ## (display_message, "str_caravan_in_s10_considers_s11_total_price_dif_=_reg3"), ## (try_end), (gt, ":cur_town_score", ":best_town_score"), (assign, ":best_town_score", ":cur_town_score"), (assign, ":result", ":cur_town"), (try_end), (gt, ":result", -1), #Fail if there are no towns (assign, reg0, ":result"), # (store_current_hours, ":hour"), # (party_set_slot, ":result", slot_town_caravan_last_visit, ":hour"), # (try_begin), ###(eq, "$cheat_mode", 1), # (assign, reg3, ":best_town_score"), # (str_store_party_name, s3, ":town_no"), # (str_store_party_name, s4, ":result"), # (display_message, "str_test__caravan_in_s3_selects_for_s4_trade_score_reg3"), # (try_end), ]),
Daha sonra,Bunu alttaki ile değiştirin;Code:#Troop AI: Merchants thinking (8, [ (try_for_parties, ":party_no"), (party_slot_eq, ":party_no", slot_party_type, spt_kingdom_caravan), (party_is_in_any_town, ":party_no"), (store_faction_of_party, ":merchant_faction", ":party_no"), (faction_get_slot, ":num_towns", ":merchant_faction", slot_faction_num_towns), (try_begin), (le, ":num_towns", 0), (remove_party, ":party_no"), (else_try), (party_get_cur_town, ":cur_center", ":party_no"), (store_random_in_range, ":random_no", 0, 100), (try_begin), (party_slot_eq, ":cur_center", slot_town_lord, "trp_player"), (game_get_reduce_campaign_ai, ":reduce_campaign_ai"), (try_begin), (eq, ":reduce_campaign_ai", 0), #hard (less money from tariffs) (assign, ":tariff_succeed_limit", 35), (else_try), (eq, ":reduce_campaign_ai", 1), #medium (normal money from tariffs) (assign, ":tariff_succeed_limit", 45), (else_try), (eq, ":reduce_campaign_ai", 2), #easy (more money from tariffs) (assign, ":tariff_succeed_limit", 60), (try_end), (else_try), (assign, ":tariff_succeed_limit", 45), (try_end), (lt, ":random_no", ":tariff_succeed_limit"), (assign, ":can_leave", 1), (try_begin), (is_between, ":cur_center", walled_centers_begin, walled_centers_end), (neg|party_slot_eq, ":cur_center", slot_center_is_besieged_by, -1), (assign, ":can_leave", 0), (try_end), (eq, ":can_leave", 1), (assign, ":do_trade", 0), (try_begin), (party_get_slot, ":cur_ai_state", ":party_no", slot_party_ai_state), (eq, ":cur_ai_state", spai_trading_with_town), (party_get_slot, ":cur_ai_object", ":party_no", slot_party_ai_object), (eq, ":cur_center", ":cur_ai_object"), (assign, ":do_trade", 1), (try_end), (assign, ":target_center", -1), (try_begin), #Make sure escorted caravan continues to its original destination. (eq, "$caravan_escort_party_id", ":party_no"), (neg|party_is_in_town, ":party_no", "$caravan_escort_destination_town"), (assign, ":target_center", "$caravan_escort_destination_town"), (else_try), (call_script, "script_cf_select_most_profitable_town_at_peace_with_faction_in_trade_route", ":cur_center", ":merchant_faction"), (assign, ":target_center", reg0), (try_end), (is_between, ":target_center", towns_begin, towns_end), (neg|party_is_in_town, ":party_no", ":target_center"), (try_begin), (eq, ":do_trade", 1), (str_store_party_name, s7, ":cur_center"), (call_script, "script_do_merchant_town_trade", ":party_no", ":cur_center"), (try_end), (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party), (party_set_ai_object, ":party_no", ":target_center"), (party_set_flags, ":party_no", pf_default_behavior, 0), (party_set_slot, ":party_no", slot_party_ai_state, spai_trading_with_town), (party_set_slot, ":party_no", slot_party_ai_object, ":target_center"), (try_end), (try_end), ]),
Sonuç ;Code:#Troop AI: Merchants thinking (8, [ (try_for_parties, ":party_no"), (try_begin), (party_slot_eq, ":party_no", slot_party_type, spt_kingdom_caravan), (party_is_in_any_town, ":party_no"), (store_faction_of_party, ":merchant_faction", ":party_no"), (faction_get_slot, ":num_towns", ":merchant_faction", slot_faction_num_towns), (try_begin), (le, ":num_towns", 0), (remove_party, ":party_no"), (else_try), (party_get_cur_town, ":cur_center", ":party_no"), (store_random_in_range, ":random_no", 0, 100), (try_begin), (party_slot_eq, ":cur_center", slot_town_lord, "trp_player"), (game_get_reduce_campaign_ai, ":reduce_campaign_ai"), (try_begin), (eq, ":reduce_campaign_ai", 0), #hard (less money from tariffs) (assign, ":tariff_succeed_limit", 35), (else_try), (eq, ":reduce_campaign_ai", 1), #medium (normal money from tariffs) (assign, ":tariff_succeed_limit", 45), (else_try), (eq, ":reduce_campaign_ai", 2), #easy (more money from tariffs) (assign, ":tariff_succeed_limit", 60), (try_end), (else_try), (assign, ":tariff_succeed_limit", 45), (try_end), (lt, ":random_no", ":tariff_succeed_limit"), (assign, ":can_leave", 1), (try_begin), (is_between, ":cur_center", walled_centers_begin, walled_centers_end), (neg|party_slot_eq, ":cur_center", slot_center_is_besieged_by, -1), (assign, ":can_leave", 0), (try_end), (eq, ":can_leave", 1), (assign, ":do_trade", 0), (try_begin), (party_get_slot, ":cur_ai_state", ":party_no", slot_party_ai_state), (eq, ":cur_ai_state", spai_trading_with_town), (party_get_slot, ":cur_ai_object", ":party_no", slot_party_ai_object), (eq, ":cur_center", ":cur_ai_object"), (assign, ":do_trade", 1), (try_end), (assign, ":target_center", -1), (try_begin), #Make sure escorted caravan continues to its original destination. (eq, "$caravan_escort_party_id", ":party_no"), (neg|party_is_in_town, ":party_no", "$caravan_escort_destination_town"), (assign, ":target_center", "$caravan_escort_destination_town"), (else_try), (call_script, "script_cf_select_most_profitable_town_at_peace_with_faction_in_trade_route", ":cur_center", ":merchant_faction"), (assign, ":target_center", reg0), (try_end), (is_between, ":target_center", towns_begin, towns_end), (neg|party_is_in_town, ":party_no", ":target_center"), (try_begin), (eq, ":do_trade", 1), (str_store_party_name, s7, ":cur_center"), (call_script, "script_do_merchant_town_trade", ":party_no", ":cur_center"), (try_end), (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party), (party_set_ai_object, ":party_no", ":target_center"), (party_set_flags, ":party_no", pf_default_behavior, 0), (party_set_slot, ":party_no", slot_party_ai_state, spai_trading_with_town), (party_set_slot, ":party_no", slot_party_ai_object, ":target_center"), (try_end), (else_try), ## SEA TRADE (party_slot_eq, ":party_no", slot_party_type, spt_merchant_caravan), (get_party_ai_object, ":object_town", ":party_no"), (party_slot_ge, ":object_town", slot_town_is_coastal, 1), (store_distance_to_party_from_party, ":dist", ":party_no", ":object_town"), (party_get_position, pos0, ":object_town"), (party_get_slot, ":radius", ":object_town", slot_town_is_coastal), (val_add, ":radius", 3), (lt, ":dist", ":radius"), (assign, ":cur_center", ":object_town"), (store_faction_of_party, ":merchant_faction", ":party_no"), (faction_get_slot, ":num_towns", ":merchant_faction", slot_faction_num_towns), (try_begin), (le, ":num_towns", 0), (remove_party, ":party_no"), (else_try), (store_random_in_range, ":random_no", 0, 100), (try_begin), (party_slot_eq, ":cur_center", slot_town_lord, "trp_player"), (game_get_reduce_campaign_ai, ":reduce_campaign_ai"), (try_begin), (eq, ":reduce_campaign_ai", 0), #hard (less money from tariffs) (assign, ":tariff_succeed_limit", 35), (else_try), (eq, ":reduce_campaign_ai", 1), #medium (normal money from tariffs) (assign, ":tariff_succeed_limit", 45), (else_try), (eq, ":reduce_campaign_ai", 2), #easy (more money from tariffs) (assign, ":tariff_succeed_limit", 60), (try_end), (else_try), (assign, ":tariff_succeed_limit", 45), (try_end), (lt, ":random_no", ":tariff_succeed_limit"), (assign, ":can_leave", 1), (try_begin), (is_between, ":cur_center", walled_centers_begin, walled_centers_end), (neg|party_slot_eq, ":cur_center", slot_center_is_besieged_by, -1), (assign, ":can_leave", 0), (try_end), (eq, ":can_leave", 1), (assign, ":do_trade", 0), (try_begin), (party_get_slot, ":cur_ai_state", ":party_no", slot_party_ai_state), (eq, ":cur_ai_state", spai_trading_with_town), (party_get_slot, ":cur_ai_object", ":party_no", slot_party_ai_object), (eq, ":cur_center", ":cur_ai_object"), (assign, ":do_trade", 1), (try_end), (assign, ":target_center", -1), (try_begin), #Make sure escorted caravan continues to its original destination. #(eq, "$caravan_escort_party_id", ":party_no"), #(neg|party_is_in_town, ":party_no", "$caravan_escort_destination_town"), #(assign, ":target_center", "$caravan_escort_destination_town"), #(else_try), #Calling altered script for seatrade (call_script, "script_cf_select_most_profitable_coastal_town_at_peace_with_faction_in_trade_route", ":cur_center", ":merchant_faction"), (assign, ":target_center", reg0), (try_end), (is_between, ":target_center", towns_begin, towns_end), (store_distance_to_party_from_party, ":target_dist", ":party_no", ":target_center"), (party_get_position, pos0, ":target_center"), (party_get_slot, ":radius", ":target_center", slot_town_is_coastal), (map_get_water_position_around_position, pos1, pos0, ":radius"), (val_add, ":radius", 2), (gt, ":target_dist", ":radius"), #was 5 #Ensures that they aren't already at the target party...just a redundancy check, as there is with caravans (try_begin), (eq, ":do_trade", 1), (str_store_party_name, s7, ":cur_center"), (call_script, "script_do_merchant_town_trade", ":party_no", ":cur_center"), (try_end), (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_point), (party_set_ai_target_position, ":party_no", pos1), # (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party), (party_set_ai_object, ":party_no", ":target_center"), (party_set_flags, ":party_no", pf_default_behavior, 0), (party_set_slot, ":party_no", slot_party_ai_state, spai_trading_with_town), (party_set_slot, ":party_no", slot_party_ai_object, ":target_center"), (try_end), (try_end), ## Caravan vs Sea Trade (try_end), #Party Loop ]),
("cf_select_most_profitable_coastal_town_at_peace_with_faction_in_trade_route",
("cf_select_most_profitable_town_at_peace_with_faction_in_trade_route",
[
(store_script_param, ":town_no", 1),
(store_script_param, ":faction_no", 2),
(assign, ":result", -1),
(assign, ":best_town_score", 0),
(store_sub, ":item_to_price_slot", slot_town_trade_good_prices_begin, trade_goods_begin),
(try_for_range, ":cur_slot", slot_town_trade_routes_begin, slot_town_trade_routes_end),
(party_get_slot, ":cur_town", ":town_no", ":cur_slot"),
(gt, ":cur_town", 0),
(party_slot_ge, ":cur_town", slot_town_is_coastal, 1), #Seatrade
(store_faction_of_party, ":cur_faction", ":cur_town"),
(store_relation, ":reln", ":cur_faction", ":faction_no"),
(ge, ":reln", 0),
(assign, ":cur_town_score", 0),
(try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end),
(neq, ":cur_goods", "itm_butter"), #Don't count perishables
(neq, ":cur_goods", "itm_cattle_meat"),
(neq, ":cur_goods", "itm_chicken"),
(neq, ":cur_goods", "itm_pork"),
(store_add, ":cur_goods_price_slot", ":cur_goods", ":item_to_price_slot"),
(party_get_slot, ":origin_price", ":town_no", ":cur_goods_price_slot"),
(party_get_slot, ":destination_price", ":cur_town", ":cur_goods_price_slot"),
(gt, ":destination_price", ":origin_price"),
(store_sub, ":price_dif", ":destination_price", ":origin_price"),
(try_begin), #weight luxury goods double
(this_or_next|eq, ":cur_goods", "itm_spice"),
(eq, ":cur_goods", "itm_velvet"),
(val_mul, ":price_dif", 2),
(try_end),
(val_add, ":cur_town_score", ":price_dif"),
(try_end),
## (try_begin),
## (eq, "$cheat_mode", 1),
## (str_store_party_name, s10, ":town_no"),
## (str_store_party_name, s11, ":cur_town"),
## (assign, reg3, ":cur_town_score"),
## (display_message, "str_caravan_in_s10_considers_s11_total_price_dif_=_reg3"),
## (try_end),
(gt, ":cur_town_score", ":best_town_score"),
(assign, ":best_town_score", ":cur_town_score"),
(assign, ":result", ":cur_town"),
(try_end),
(gt, ":result", -1), #Fail if there are no towns
(assign, reg0, ":result"),
# (store_current_hours, ":hour"),
# (party_set_slot, ":result", slot_town_caravan_last_visit, ":hour"),
# (try_begin),
###(eq, "$cheat_mode", 1),
# (assign, reg3, ":best_town_score"),
# (str_store_party_name, s3, ":town_no"),
# (str_store_party_name, s4, ":result"),
# (display_message, "str_test__caravan_in_s3_selects_for_s4_trade_score_reg3"),
# (try_end),
]),
#the following is a very simple adjustment - it measures the difference in prices between two towns
#all goods are weighted equally except for luxuries
#it does not take into account the prices of the goods, nor cargo capacity
#to do that properly, a merchant would have to virtually fill his baggage, slot by slot, for each town
#i also found that one needed to introduce demand inelasticity -- prices should vary a lot for grain, relatively little for iron
("cf_select_most_profitable_coastal_town_at_peace_with_faction_in_trade_route",
[
(store_script_param, ":town_no", 1),
(store_script_param, ":faction_no", 2),
(assign, ":result", -1),
(assign, ":best_town_score", 0),
(store_sub, ":item_to_price_slot", slot_town_trade_good_prices_begin, trade_goods_begin),
(try_for_range, ":cur_slot", slot_town_trade_routes_begin, slot_town_trade_routes_end),
(party_get_slot, ":cur_town", ":town_no", ":cur_slot"),
(gt, ":cur_town", 0),
(party_slot_ge, ":cur_town", slot_town_is_coastal, 1), #Seatrade
(store_faction_of_party, ":cur_faction", ":cur_town"),
(store_relation, ":reln", ":cur_faction", ":faction_no"),
(ge, ":reln", 0),
(assign, ":cur_town_score", 0),
(try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end),
(neq, ":cur_goods", "itm_butter"), #Don't count perishables
(neq, ":cur_goods", "itm_cattle_meat"),
(neq, ":cur_goods", "itm_chicken"),
(neq, ":cur_goods", "itm_pork"),
(store_add, ":cur_goods_price_slot", ":cur_goods", ":item_to_price_slot"),
(party_get_slot, ":origin_price", ":town_no", ":cur_goods_price_slot"),
(party_get_slot, ":destination_price", ":cur_town", ":cur_goods_price_slot"),
(gt, ":destination_price", ":origin_price"),
(store_sub, ":price_dif", ":destination_price", ":origin_price"),
(try_begin), #weight luxury goods double
(this_or_next|eq, ":cur_goods", "itm_spice"),
(eq, ":cur_goods", "itm_velvet"),
(val_mul, ":price_dif", 2),
(try_end),
(val_add, ":cur_town_score", ":price_dif"),
(try_end),
## (try_begin),
## (eq, "$cheat_mode", 1),
## (str_store_party_name, s10, ":town_no"),
## (str_store_party_name, s11, ":cur_town"),
## (assign, reg3, ":cur_town_score"),
## (display_message, "str_caravan_in_s10_considers_s11_total_price_dif_=_reg3"),
## (try_end),
(gt, ":cur_town_score", ":best_town_score"),
(assign, ":best_town_score", ":cur_town_score"),
(assign, ":result", ":cur_town"),
(try_end),
(gt, ":result", -1), #Fail if there are no towns
(assign, reg0, ":result"),
# (store_current_hours, ":hour"),
# (party_set_slot, ":result", slot_town_caravan_last_visit, ":hour"),
# (try_begin),
###(eq, "$cheat_mode", 1),
# (assign, reg3, ":best_town_score"),
# (str_store_party_name, s3, ":town_no"),
# (str_store_party_name, s4, ":result"),
# (display_message, "str_test__caravan_in_s3_selects_for_s4_trade_score_reg3"),
# (try_end),
]),
#Troop AI: Merchants thinking
(8,
[
(try_for_parties, ":party_no"),
(party_slot_eq, ":party_no", slot_party_type, spt_kingdom_caravan),
(party_is_in_any_town, ":party_no"),
(store_faction_of_party, ":merchant_faction", ":party_no"),
(faction_get_slot, ":num_towns", ":merchant_faction", slot_faction_num_towns),
(try_begin),
(le, ":num_towns", 0),
(remove_party, ":party_no"),
(else_try),
(party_get_cur_town, ":cur_center", ":party_no"),
(store_random_in_range, ":random_no", 0, 100),
(try_begin),
(party_slot_eq, ":cur_center", slot_town_lord, "trp_player"),
(game_get_reduce_campaign_ai, ":reduce_campaign_ai"),
(try_begin),
(eq, ":reduce_campaign_ai", 0), #hard (less money from tariffs)
(assign, ":tariff_succeed_limit", 35),
(else_try),
(eq, ":reduce_campaign_ai", 1), #medium (normal money from tariffs)
(assign, ":tariff_succeed_limit", 45),
(else_try),
(eq, ":reduce_campaign_ai", 2), #easy (more money from tariffs)
(assign, ":tariff_succeed_limit", 60),
(try_end),
(else_try),
(assign, ":tariff_succeed_limit", 45),
(try_end),
(lt, ":random_no", ":tariff_succeed_limit"),
(assign, ":can_leave", 1),
(try_begin),
(is_between, ":cur_center", walled_centers_begin, walled_centers_end),
(neg|party_slot_eq, ":cur_center", slot_center_is_besieged_by, -1),
(assign, ":can_leave", 0),
(try_end),
(eq, ":can_leave", 1),
(assign, ":do_trade", 0),
(try_begin),
(party_get_slot, ":cur_ai_state", ":party_no", slot_party_ai_state),
(eq, ":cur_ai_state", spai_trading_with_town),
(party_get_slot, ":cur_ai_object", ":party_no", slot_party_ai_object),
(eq, ":cur_center", ":cur_ai_object"),
(assign, ":do_trade", 1),
(try_end),
(assign, ":target_center", -1),
(try_begin), #Make sure escorted caravan continues to its original destination.
(eq, "$caravan_escort_party_id", ":party_no"),
(neg|party_is_in_town, ":party_no", "$caravan_escort_destination_town"),
(assign, ":target_center", "$caravan_escort_destination_town"),
(else_try),
(call_script, "script_cf_select_most_profitable_town_at_peace_with_faction_in_trade_route", ":cur_center", ":merchant_faction"),
(assign, ":target_center", reg0),
(try_end),
(is_between, ":target_center", towns_begin, towns_end),
(neg|party_is_in_town, ":party_no", ":target_center"),
(try_begin),
(eq, ":do_trade", 1),
(str_store_party_name, s7, ":cur_center"),
(call_script, "script_do_merchant_town_trade", ":party_no", ":cur_center"),
(try_end),
(party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
(party_set_ai_object, ":party_no", ":target_center"),
(party_set_flags, ":party_no", pf_default_behavior, 0),
(party_set_slot, ":party_no", slot_party_ai_state, spai_trading_with_town),
(party_set_slot, ":party_no", slot_party_ai_object, ":target_center"),
(try_end),
(try_end),
]),
#Troop AI: Merchants thinking
(8,
[
(try_for_parties, ":party_no"),
(try_begin),
(party_slot_eq, ":party_no", slot_party_type, spt_kingdom_caravan),
(party_is_in_any_town, ":party_no"),
(store_faction_of_party, ":merchant_faction", ":party_no"),
(faction_get_slot, ":num_towns", ":merchant_faction", slot_faction_num_towns),
(try_begin),
(le, ":num_towns", 0),
(remove_party, ":party_no"),
(else_try),
(party_get_cur_town, ":cur_center", ":party_no"),
(store_random_in_range, ":random_no", 0, 100),
(try_begin),
(party_slot_eq, ":cur_center", slot_town_lord, "trp_player"),
(game_get_reduce_campaign_ai, ":reduce_campaign_ai"),
(try_begin),
(eq, ":reduce_campaign_ai", 0), #hard (less money from tariffs)
(assign, ":tariff_succeed_limit", 35),
(else_try),
(eq, ":reduce_campaign_ai", 1), #medium (normal money from tariffs)
(assign, ":tariff_succeed_limit", 45),
(else_try),
(eq, ":reduce_campaign_ai", 2), #easy (more money from tariffs)
(assign, ":tariff_succeed_limit", 60),
(try_end),
(else_try),
(assign, ":tariff_succeed_limit", 45),
(try_end),
(lt, ":random_no", ":tariff_succeed_limit"),
(assign, ":can_leave", 1),
(try_begin),
(is_between, ":cur_center", walled_centers_begin, walled_centers_end),
(neg|party_slot_eq, ":cur_center", slot_center_is_besieged_by, -1),
(assign, ":can_leave", 0),
(try_end),
(eq, ":can_leave", 1),
(assign, ":do_trade", 0),
(try_begin),
(party_get_slot, ":cur_ai_state", ":party_no", slot_party_ai_state),
(eq, ":cur_ai_state", spai_trading_with_town),
(party_get_slot, ":cur_ai_object", ":party_no", slot_party_ai_object),
(eq, ":cur_center", ":cur_ai_object"),
(assign, ":do_trade", 1),
(try_end),
(assign, ":target_center", -1),
(try_begin), #Make sure escorted caravan continues to its original destination.
(eq, "$caravan_escort_party_id", ":party_no"),
(neg|party_is_in_town, ":party_no", "$caravan_escort_destination_town"),
(assign, ":target_center", "$caravan_escort_destination_town"),
(else_try),
(call_script, "script_cf_select_most_profitable_town_at_peace_with_faction_in_trade_route", ":cur_center", ":merchant_faction"),
(assign, ":target_center", reg0),
(try_end),
(is_between, ":target_center", towns_begin, towns_end),
(neg|party_is_in_town, ":party_no", ":target_center"),
(try_begin),
(eq, ":do_trade", 1),
(str_store_party_name, s7, ":cur_center"),
(call_script, "script_do_merchant_town_trade", ":party_no", ":cur_center"),
(try_end),
(party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
(party_set_ai_object, ":party_no", ":target_center"),
(party_set_flags, ":party_no", pf_default_behavior, 0),
(party_set_slot, ":party_no", slot_party_ai_state, spai_trading_with_town),
(party_set_slot, ":party_no", slot_party_ai_object, ":target_center"),
(try_end),
(else_try), ## SEA TRADE
(party_slot_eq, ":party_no", slot_party_type, spt_merchant_caravan),
(get_party_ai_object, ":object_town", ":party_no"),
(party_slot_ge, ":object_town", slot_town_is_coastal, 1),
(store_distance_to_party_from_party, ":dist", ":party_no", ":object_town"),
(party_get_position, pos0, ":object_town"),
(party_get_slot, ":radius", ":object_town", slot_town_is_coastal),
(val_add, ":radius", 3),
(lt, ":dist", ":radius"),
(assign, ":cur_center", ":object_town"),
(store_faction_of_party, ":merchant_faction", ":party_no"),
(faction_get_slot, ":num_towns", ":merchant_faction", slot_faction_num_towns),
(try_begin),
(le, ":num_towns", 0),
(remove_party, ":party_no"),
(else_try),
(store_random_in_range, ":random_no", 0, 100),
(try_begin),
(party_slot_eq, ":cur_center", slot_town_lord, "trp_player"),
(game_get_reduce_campaign_ai, ":reduce_campaign_ai"),
(try_begin),
(eq, ":reduce_campaign_ai", 0), #hard (less money from tariffs)
(assign, ":tariff_succeed_limit", 35),
(else_try),
(eq, ":reduce_campaign_ai", 1), #medium (normal money from tariffs)
(assign, ":tariff_succeed_limit", 45),
(else_try),
(eq, ":reduce_campaign_ai", 2), #easy (more money from tariffs)
(assign, ":tariff_succeed_limit", 60),
(try_end),
(else_try),
(assign, ":tariff_succeed_limit", 45),
(try_end),
(lt, ":random_no", ":tariff_succeed_limit"),
(assign, ":can_leave", 1),
(try_begin),
(is_between, ":cur_center", walled_centers_begin, walled_centers_end),
(neg|party_slot_eq, ":cur_center", slot_center_is_besieged_by, -1),
(assign, ":can_leave", 0),
(try_end),
(eq, ":can_leave", 1),
(assign, ":do_trade", 0),
(try_begin),
(party_get_slot, ":cur_ai_state", ":party_no", slot_party_ai_state),
(eq, ":cur_ai_state", spai_trading_with_town),
(party_get_slot, ":cur_ai_object", ":party_no", slot_party_ai_object),
(eq, ":cur_center", ":cur_ai_object"),
(assign, ":do_trade", 1),
(try_end),
(assign, ":target_center", -1),
(try_begin), #Make sure escorted caravan continues to its original destination.
#(eq, "$caravan_escort_party_id", ":party_no"),
#(neg|party_is_in_town, ":party_no", "$caravan_escort_destination_town"),
#(assign, ":target_center", "$caravan_escort_destination_town"),
#(else_try), #Calling altered script for seatrade
(call_script, "script_cf_select_most_profitable_coastal_town_at_peace_with_faction_in_trade_route", ":cur_center", ":merchant_faction"),
(assign, ":target_center", reg0),
(try_end),
(is_between, ":target_center", towns_begin, towns_end),
(store_distance_to_party_from_party, ":target_dist", ":party_no", ":target_center"),
(party_get_position, pos0, ":target_center"),
(party_get_slot, ":radius", ":target_center", slot_town_is_coastal),
(map_get_water_position_around_position, pos1, pos0, ":radius"),
(val_add, ":radius", 2),
(gt, ":target_dist", ":radius"), #was 5 #Ensures that they aren't already at the target party...just a redundancy check, as there is with caravans
(try_begin),
(eq, ":do_trade", 1),
(str_store_party_name, s7, ":cur_center"),
(call_script, "script_do_merchant_town_trade", ":party_no", ":cur_center"),
(try_end),
(party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_point),
(party_set_ai_target_position, ":party_no", pos1),
# (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
(party_set_ai_object, ":party_no", ":target_center"),
(party_set_flags, ":party_no", pf_default_behavior, 0),
(party_set_slot, ":party_no", slot_party_ai_state, spai_trading_with_town),
(party_set_slot, ":party_no", slot_party_ai_object, ":target_center"),
(try_end),
(try_end), ## Caravan vs Sea Trade
(try_end), #Party Loop
]),
Teşekkür ederimBlack Dead said:Güzel oldu bu dersin gelmesi.
Düzeltelim hocam ?Lt.Ghost said:Sayın Hyper, Modül sistemini atsana bana ya. Benmki bozuk. Birşey yapamıyorum.