[KIT] Sea Trade (Морская торговля)
Автор: Duh
Родная Страница
Что даст этот код:
~Морские Торговли
~Увеличение экономики для городов.
Код
##Floris addon seatrade
("sea_traders","Royal Traders",icon_ship|pf_is_ship|carries_goods(50)|pf_show_faction,0,fac_commoners,merchant_personality,[(trp_caravan_master,1,1),(trp_mercenary_enforcer,20,30),(trp_mercenary_crossbowman,5,20),(trp_mercenary_gendarme,5,10),(trp_mercenary_axeman,5,10)]),
##Floris addon seatrade end
("sea_traders","Royal Traders",icon_ship|pf_is_ship|carries_goods(50)|pf_show_faction,0,fac_commoners,merchant_personality,[(trp_caravan_master,1,1),(trp_mercenary_enforcer,20,30),(trp_mercenary_crossbowman,5,20),(trp_mercenary_gendarme,5,10),(trp_mercenary_axeman,5,10)]),
##Floris addon seatrade end
В module_constants
#slot_party_type values
##spt_caravan = 1
spt_castle = 2
spt_town = 3
spt_village = 4
##spt_forager = 5
##spt_war_party = 6
##spt_patrol = 7 #Activated in Diplomacy
##spt_messenger = 8 #Activated in Diplomacy
##spt_raider = 9
##spt_scout = 10 #Activated in Diplomacy
spt_kingdom_caravan = 11
##spt_prisoner_train = 12 #Activated in Diplomacy as dplmc_spt_recruiter
spt_kingdom_hero_party = 13
spt_merchant_caravan = 14 #Seatrader
spt_village_farmer = 15
spt_ship = 16
spt_cattle_herd = 17
spt_bandit_lair = 18
#spt_deserter = 20 #19 is dplmc_spouse
spt_entrenchment = 22 #TEMPERED ADDED FOR ENTRENCHMENT PARTIES #21 USED IN DIPLOMACY FOR "Gift Caravan"
##spt_caravan = 1
spt_castle = 2
spt_town = 3
spt_village = 4
##spt_forager = 5
##spt_war_party = 6
##spt_patrol = 7 #Activated in Diplomacy
##spt_messenger = 8 #Activated in Diplomacy
##spt_raider = 9
##spt_scout = 10 #Activated in Diplomacy
spt_kingdom_caravan = 11
##spt_prisoner_train = 12 #Activated in Diplomacy as dplmc_spt_recruiter
spt_kingdom_hero_party = 13
spt_merchant_caravan = 14 #Seatrader
spt_village_farmer = 15
spt_ship = 16
spt_cattle_herd = 17
spt_bandit_lair = 18
#spt_deserter = 20 #19 is dplmc_spouse
spt_entrenchment = 22 #TEMPERED ADDED FOR ENTRENCHMENT PARTIES #21 USED IN DIPLOMACY FOR "Gift Caravan"
Туда же
## Seatrade
slot_town_is_coastal = slot_party_follow_me #63 (any other new or unused slot can ofc be used as well)
##
slot_town_is_coastal = slot_party_follow_me #63 (any other new or unused slot can ofc be used as well)
##
Module Triggers:
#Kingdom Parties
(1.0, 0, 0.0, [],
[(try_for_range, ":cur_kingdom", kingdoms_begin, kingdoms_end),
(faction_slot_eq, ":cur_kingdom", slot_faction_state, sfs_active),
## (neq, ":cur_kingdom", "fac_player_supporters_faction"),
## (try_begin),
## (store_random_in_range, ":random_no", 0, 100),
## (lt, ":random_no", 10),
## (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_forager),
## (try_end),
## (try_begin),
## (store_random_in_range, ":random_no", 0, 100),
## (lt, ":random_no", 10),
## (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_scout),
## (try_end),
## (try_begin),
## (store_random_in_range, ":random_no", 0, 100),
## (lt, ":random_no", 10),
## (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_patrol),
## (try_end),
## (try_begin),
## (store_random_in_range, ":random_no", 0, 100),
## (lt, ":random_no", 10),
## (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_messenger),
## (try_end),
(try_begin),
(store_random_in_range, ":random_no", 0, 100),
(lt, ":random_no", 10),
(call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_kingdom_caravan),
(try_end),
(try_begin), #SEATRADE
(store_random_in_range, ":random_no", 0, 100), #Disable these for faster testing
(lt, ":random_no", 10), #Disable these for faster testing
(call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_merchant_caravan),
(try_end),
## (try_begin),
## (store_random_in_range, ":random_no", 0, 100),
## (lt, ":random_no", 10),
## (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_prisoner_train),
## (try_end),
(try_end),
]),
(1.0, 0, 0.0, [],
[(try_for_range, ":cur_kingdom", kingdoms_begin, kingdoms_end),
(faction_slot_eq, ":cur_kingdom", slot_faction_state, sfs_active),
## (neq, ":cur_kingdom", "fac_player_supporters_faction"),
## (try_begin),
## (store_random_in_range, ":random_no", 0, 100),
## (lt, ":random_no", 10),
## (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_forager),
## (try_end),
## (try_begin),
## (store_random_in_range, ":random_no", 0, 100),
## (lt, ":random_no", 10),
## (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_scout),
## (try_end),
## (try_begin),
## (store_random_in_range, ":random_no", 0, 100),
## (lt, ":random_no", 10),
## (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_patrol),
## (try_end),
## (try_begin),
## (store_random_in_range, ":random_no", 0, 100),
## (lt, ":random_no", 10),
## (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_messenger),
## (try_end),
(try_begin),
(store_random_in_range, ":random_no", 0, 100),
(lt, ":random_no", 10),
(call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_kingdom_caravan),
(try_end),
(try_begin), #SEATRADE
(store_random_in_range, ":random_no", 0, 100), #Disable these for faster testing
(lt, ":random_no", 10), #Disable these for faster testing
(call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_merchant_caravan),
(try_end),
## (try_begin),
## (store_random_in_range, ":random_no", 0, 100),
## (lt, ":random_no", 10),
## (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_prisoner_train),
## (try_end),
(try_end),
]),
Module Scripts
# script_create_kingdom_party_if_below_limit
# Input: arg1 = faction_no, arg2 = party_type (variables beginning with spt_)
# Output: reg0 = party_no
("create_kingdom_party_if_below_limit",
[
(store_script_param_1, ":faction_no"),
(store_script_param_2, ":party_type"),
(call_script, "script_count_parties_of_faction_and_party_type", ":faction_no", ":party_type"),
(assign, ":party_count", reg0),
(assign, ":party_count_limit", 0),
(faction_get_slot, ":num_towns", ":faction_no", slot_faction_num_towns),
(try_begin),
## (eq, ":party_type", spt_forager),
## (assign, ":party_count_limit", 1),
## (else_try),
## (eq, ":party_type", spt_scout),
## (assign, ":party_count_limit", 1),
## (else_try),
## (eq, ":party_type", spt_patrol),
## (assign, ":party_count_limit", 1),
## (else_try),
## (eq, ":party_type", spt_messenger),
## (assign, ":party_count_limit", 1),
## (else_try),
(this_or_next|eq, ":party_type", spt_merchant_caravan), #### This is our sea trader ##THIS INSTEAD
(eq, ":party_type", spt_kingdom_caravan),
(try_begin),
(eq, ":num_towns", 0),
(assign, ":party_count_limit", 0),
(else_try),
(eq, ":num_towns", 1),
(assign, ":party_count_limit", 1),
(else_try),
(eq, ":num_towns", 2),
(assign, ":party_count_limit", 3),
(else_try),
(assign, ":party_count_limit", 5),
(try_end),
## (else_try),
## (eq, ":party_type", spt_prisoner_train),
## (assign, ":party_count_limit", 1),
(try_end),
(try_begin),
(eq, ":party_type", spt_merchant_caravan),
(gt, ":party_count_limit", 2),
(val_sub, ":party_count_limit", 1),
(try_end),
(assign, reg0, -1),
(try_begin),
(lt, ":party_count", ":party_count_limit"),
(call_script,"script_cf_create_kingdom_party", ":faction_no", ":party_type"),
(try_end),
]),
# Input: arg1 = faction_no, arg2 = party_type (variables beginning with spt_)
# Output: reg0 = party_no
("create_kingdom_party_if_below_limit",
[
(store_script_param_1, ":faction_no"),
(store_script_param_2, ":party_type"),
(call_script, "script_count_parties_of_faction_and_party_type", ":faction_no", ":party_type"),
(assign, ":party_count", reg0),
(assign, ":party_count_limit", 0),
(faction_get_slot, ":num_towns", ":faction_no", slot_faction_num_towns),
(try_begin),
## (eq, ":party_type", spt_forager),
## (assign, ":party_count_limit", 1),
## (else_try),
## (eq, ":party_type", spt_scout),
## (assign, ":party_count_limit", 1),
## (else_try),
## (eq, ":party_type", spt_patrol),
## (assign, ":party_count_limit", 1),
## (else_try),
## (eq, ":party_type", spt_messenger),
## (assign, ":party_count_limit", 1),
## (else_try),
(this_or_next|eq, ":party_type", spt_merchant_caravan), #### This is our sea trader ##THIS INSTEAD
(eq, ":party_type", spt_kingdom_caravan),
(try_begin),
(eq, ":num_towns", 0),
(assign, ":party_count_limit", 0),
(else_try),
(eq, ":num_towns", 1),
(assign, ":party_count_limit", 1),
(else_try),
(eq, ":num_towns", 2),
(assign, ":party_count_limit", 3),
(else_try),
(assign, ":party_count_limit", 5),
(try_end),
## (else_try),
## (eq, ":party_type", spt_prisoner_train),
## (assign, ":party_count_limit", 1),
(try_end),
(try_begin),
(eq, ":party_type", spt_merchant_caravan),
(gt, ":party_count_limit", 2),
(val_sub, ":party_count_limit", 1),
(try_end),
(assign, reg0, -1),
(try_begin),
(lt, ":party_count", ":party_count_limit"),
(call_script,"script_cf_create_kingdom_party", ":faction_no", ":party_type"),
(try_end),
]),
Туда же
# script_cf_create_kingdom_party
# Input: arg1 = faction_no, arg2 = party_type (variables beginning with spt_)
# Output: reg0 = party_no
("cf_create_kingdom_party",
[
(store_script_param_1, ":faction_no"),
(store_script_param_2, ":party_type"),
(str_store_faction_name, s7, ":faction_no"),
(assign, ":party_name_str", "str_no_string"),
## (faction_get_slot, ":reinforcements_a", ":faction_no", slot_faction_reinforcements_a),
(faction_get_slot, ":reinforcements_b", ":faction_no", slot_faction_reinforcements_b),
## (faction_get_slot, ":reinforcements_c", ":faction_no", slot_faction_reinforcements_c),
(try_begin),
## (eq, ":party_type", spt_forager),
## (assign, ":party_template", "pt_forager_party"),
# (assign, ":party_name_str", "str_s7_foragers"),
## (else_try),
## (eq, ":party_type", spt_scout),
## (assign, ":party_template", "pt_scout_party"),
# (assign, ":party_name_str", "str_s7_scouts"),
## (else_try),
## (eq, ":party_type", spt_patrol),
## (assign, ":party_template", "pt_patrol_party"),
# (assign, ":party_name_str", "str_s7_patrol"),
## (else_try),
(eq, ":party_type", spt_kingdom_caravan),
(assign, ":party_template", "pt_kingdom_caravan_party"),
# (assign, ":party_name_str", "str_s7_caravan"),
(else_try),
(eq, ":party_type", spt_merchant_caravan),
(assign, ":party_template", "pt_sea_traders"), #####SEATRADE Marker#####
## (else_try),
## (eq, ":party_type", spt_messenger),
## (assign, ":party_template", "pt_messenger_party"),
# (assign, ":party_name_str", "str_s7_messenger"),
## (else_try),
## (eq, ":party_type", spt_raider),
## (assign, ":party_template", "pt_raider_party"),
## (assign, ":party_name_str", "str_s7_raiders"),
## (else_try),
## (eq, ":party_type", spt_prisoner_train),
## (assign, ":party_template", "pt_prisoner_train_party"),
# (assign, ":party_name_str", "str_s7_prisoner_train"),
(try_end),
(assign, ":result", -1),
(try_begin),
(try_begin),
(this_or_next|eq, ":party_type", spt_merchant_caravan), ##SEA TRADE
(eq, ":party_type", spt_kingdom_caravan),
(call_script,"script_cf_select_random_town_with_faction", ":faction_no", -1),
(set_spawn_radius, 0),
(else_try), #not used at the moment
(call_script,"script_cf_select_random_walled_center_with_faction", ":faction_no", -1),
(set_spawn_radius, 1),
(try_end),
(assign, ":spawn_center", reg0),
(is_between, ":spawn_center", centers_begin, centers_end),
(assign, ":continue", 0), ## SEA TRADE
(try_begin),
(eq, ":party_type", spt_kingdom_caravan),
(spawn_around_party,":spawn_center",":party_template"),
(assign, ":result", reg0),
(assign, ":continue", 1),
(else_try),
(eq, ":party_type", spt_merchant_caravan),
(party_slot_ge, ":spawn_center", slot_town_is_coastal, 1),
(party_get_slot, ":radius", ":spawn_center", slot_town_is_coastal),
(party_get_position, pos0 , ":spawn_center"),
(map_get_water_position_around_position, pos1, pos0, ":radius"),
(spawn_around_party,":spawn_center",":party_template"),
(assign, ":result", reg0),
(party_set_position, ":result", pos1),
(assign, ":continue", 1),
(try_end),
(eq, ":continue", 1), ## SEA TRADE END
(party_set_faction, ":result", ":faction_no"),
(try_begin),
(this_or_next|eq, ":party_type", spt_merchant_caravan), ##SEA TRADE
(eq, ":party_type", spt_kingdom_caravan),
(party_set_slot, ":result", slot_party_home_center, ":spawn_center"),
(party_set_slot, ":result", slot_party_last_traded_center, ":spawn_center"),
(try_end),
(party_set_slot, ":result", slot_party_type, ":party_type"),
(party_set_slot, ":result", slot_party_ai_state, spai_undefined),
(try_begin),
(neq, ":party_name_str", "str_no_string"),
(party_set_name, ":result", ":party_name_str"),
(try_end),
(try_begin),
## (eq, ":party_type", spt_forager),
## (party_add_template, ":result", ":reinforcements_a"),
## (else_try),
## (eq, ":party_type", spt_scout),
## (party_add_template, ":result", ":reinforcements_c"),
## (else_try),
## (eq, ":party_type", spt_patrol),
## (party_add_template, ":result", ":reinforcements_a"),
## (party_add_template, ":result", ":reinforcements_b"),
## (else_try),
(this_or_next|eq, ":party_type", spt_merchant_caravan), ##SEA TRADE
(eq, ":party_type", spt_kingdom_caravan),
(try_begin),
(eq, ":faction_no", "fac_player_supporters_faction"),
(party_get_slot, ":reinforcement_faction", ":spawn_center", slot_center_original_faction),
(faction_get_slot, ":reinforcements_b", ":reinforcement_faction", slot_faction_reinforcements_b),
(try_end),
(party_add_template, ":result", ":reinforcements_b"),
(party_add_template, ":result", ":reinforcements_b"),
(party_set_ai_behavior,":result",ai_bhvr_travel_to_party),
(party_set_ai_object,":result",":spawn_center"),
(party_set_flags, ":result", pf_default_behavior, 1),
(store_sub, ":item_to_price_slot", slot_town_trade_good_prices_begin, trade_goods_begin),
(try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end),
(store_add, ":cur_goods_price_slot", ":cur_goods", ":item_to_price_slot"),
(party_set_slot, ":result", ":cur_goods_price_slot", average_price_factor),
(try_end),
(party_set_bandit_attraction, ":result", 75), ##ADDED THIS LINE
## (else_try),
## (eq, ":party_type", spt_messenger),
## (faction_get_slot, ":messenger_troop", ":faction_no", slot_faction_messenger_troop),
## (party_add_leader, ":result", ":messenger_troop"),
## (party_set_ai_behavior,":result",ai_bhvr_travel_to_party),
## (party_set_ai_object,":result",":spawn_center"),
## (party_set_flags, ":result", pf_default_behavior, 0),
## (else_try),
## (eq, ":party_type", spt_raider),
## (party_add_template, ":result", ":reinforcements_c"),
## (party_add_template, ":result", ":reinforcements_b"),
## (party_add_template, ":result", "pt_raider_captives"),
## (else_try),
## (eq, ":party_type", spt_prisoner_train),
## (party_add_template, ":result", ":reinforcements_b"),
## (party_add_template, ":result", ":reinforcements_a"),
## (try_begin),
## (call_script,"script_cf_faction_get_random_enemy_faction",":faction_no"),
## (store_random_in_range,":r",0,3),
## (try_begin),
## (lt, ":r", 1),
## (faction_get_slot, ":captive_reinforcements", reg0, slot_faction_reinforcements_b),
## (else_try),
## (faction_get_slot, ":captive_reinforcements", reg0, slot_faction_reinforcements_a),
## (try_end),
## (party_add_template, ":result", ":captive_reinforcements",1),
## (else_try),
## (party_add_template, ":result", "pt_default_prisoners"),
## (try_end),
(try_end),
(try_end),
(ge, ":result", 0),
(assign, reg0, ":result"),
]),
# Input: arg1 = faction_no, arg2 = party_type (variables beginning with spt_)
# Output: reg0 = party_no
("cf_create_kingdom_party",
[
(store_script_param_1, ":faction_no"),
(store_script_param_2, ":party_type"),
(str_store_faction_name, s7, ":faction_no"),
(assign, ":party_name_str", "str_no_string"),
## (faction_get_slot, ":reinforcements_a", ":faction_no", slot_faction_reinforcements_a),
(faction_get_slot, ":reinforcements_b", ":faction_no", slot_faction_reinforcements_b),
## (faction_get_slot, ":reinforcements_c", ":faction_no", slot_faction_reinforcements_c),
(try_begin),
## (eq, ":party_type", spt_forager),
## (assign, ":party_template", "pt_forager_party"),
# (assign, ":party_name_str", "str_s7_foragers"),
## (else_try),
## (eq, ":party_type", spt_scout),
## (assign, ":party_template", "pt_scout_party"),
# (assign, ":party_name_str", "str_s7_scouts"),
## (else_try),
## (eq, ":party_type", spt_patrol),
## (assign, ":party_template", "pt_patrol_party"),
# (assign, ":party_name_str", "str_s7_patrol"),
## (else_try),
(eq, ":party_type", spt_kingdom_caravan),
(assign, ":party_template", "pt_kingdom_caravan_party"),
# (assign, ":party_name_str", "str_s7_caravan"),
(else_try),
(eq, ":party_type", spt_merchant_caravan),
(assign, ":party_template", "pt_sea_traders"), #####SEATRADE Marker#####
## (else_try),
## (eq, ":party_type", spt_messenger),
## (assign, ":party_template", "pt_messenger_party"),
# (assign, ":party_name_str", "str_s7_messenger"),
## (else_try),
## (eq, ":party_type", spt_raider),
## (assign, ":party_template", "pt_raider_party"),
## (assign, ":party_name_str", "str_s7_raiders"),
## (else_try),
## (eq, ":party_type", spt_prisoner_train),
## (assign, ":party_template", "pt_prisoner_train_party"),
# (assign, ":party_name_str", "str_s7_prisoner_train"),
(try_end),
(assign, ":result", -1),
(try_begin),
(try_begin),
(this_or_next|eq, ":party_type", spt_merchant_caravan), ##SEA TRADE
(eq, ":party_type", spt_kingdom_caravan),
(call_script,"script_cf_select_random_town_with_faction", ":faction_no", -1),
(set_spawn_radius, 0),
(else_try), #not used at the moment
(call_script,"script_cf_select_random_walled_center_with_faction", ":faction_no", -1),
(set_spawn_radius, 1),
(try_end),
(assign, ":spawn_center", reg0),
(is_between, ":spawn_center", centers_begin, centers_end),
(assign, ":continue", 0), ## SEA TRADE
(try_begin),
(eq, ":party_type", spt_kingdom_caravan),
(spawn_around_party,":spawn_center",":party_template"),
(assign, ":result", reg0),
(assign, ":continue", 1),
(else_try),
(eq, ":party_type", spt_merchant_caravan),
(party_slot_ge, ":spawn_center", slot_town_is_coastal, 1),
(party_get_slot, ":radius", ":spawn_center", slot_town_is_coastal),
(party_get_position, pos0 , ":spawn_center"),
(map_get_water_position_around_position, pos1, pos0, ":radius"),
(spawn_around_party,":spawn_center",":party_template"),
(assign, ":result", reg0),
(party_set_position, ":result", pos1),
(assign, ":continue", 1),
(try_end),
(eq, ":continue", 1), ## SEA TRADE END
(party_set_faction, ":result", ":faction_no"),
(try_begin),
(this_or_next|eq, ":party_type", spt_merchant_caravan), ##SEA TRADE
(eq, ":party_type", spt_kingdom_caravan),
(party_set_slot, ":result", slot_party_home_center, ":spawn_center"),
(party_set_slot, ":result", slot_party_last_traded_center, ":spawn_center"),
(try_end),
(party_set_slot, ":result", slot_party_type, ":party_type"),
(party_set_slot, ":result", slot_party_ai_state, spai_undefined),
(try_begin),
(neq, ":party_name_str", "str_no_string"),
(party_set_name, ":result", ":party_name_str"),
(try_end),
(try_begin),
## (eq, ":party_type", spt_forager),
## (party_add_template, ":result", ":reinforcements_a"),
## (else_try),
## (eq, ":party_type", spt_scout),
## (party_add_template, ":result", ":reinforcements_c"),
## (else_try),
## (eq, ":party_type", spt_patrol),
## (party_add_template, ":result", ":reinforcements_a"),
## (party_add_template, ":result", ":reinforcements_b"),
## (else_try),
(this_or_next|eq, ":party_type", spt_merchant_caravan), ##SEA TRADE
(eq, ":party_type", spt_kingdom_caravan),
(try_begin),
(eq, ":faction_no", "fac_player_supporters_faction"),
(party_get_slot, ":reinforcement_faction", ":spawn_center", slot_center_original_faction),
(faction_get_slot, ":reinforcements_b", ":reinforcement_faction", slot_faction_reinforcements_b),
(try_end),
(party_add_template, ":result", ":reinforcements_b"),
(party_add_template, ":result", ":reinforcements_b"),
(party_set_ai_behavior,":result",ai_bhvr_travel_to_party),
(party_set_ai_object,":result",":spawn_center"),
(party_set_flags, ":result", pf_default_behavior, 1),
(store_sub, ":item_to_price_slot", slot_town_trade_good_prices_begin, trade_goods_begin),
(try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end),
(store_add, ":cur_goods_price_slot", ":cur_goods", ":item_to_price_slot"),
(party_set_slot, ":result", ":cur_goods_price_slot", average_price_factor),
(try_end),
(party_set_bandit_attraction, ":result", 75), ##ADDED THIS LINE
## (else_try),
## (eq, ":party_type", spt_messenger),
## (faction_get_slot, ":messenger_troop", ":faction_no", slot_faction_messenger_troop),
## (party_add_leader, ":result", ":messenger_troop"),
## (party_set_ai_behavior,":result",ai_bhvr_travel_to_party),
## (party_set_ai_object,":result",":spawn_center"),
## (party_set_flags, ":result", pf_default_behavior, 0),
## (else_try),
## (eq, ":party_type", spt_raider),
## (party_add_template, ":result", ":reinforcements_c"),
## (party_add_template, ":result", ":reinforcements_b"),
## (party_add_template, ":result", "pt_raider_captives"),
## (else_try),
## (eq, ":party_type", spt_prisoner_train),
## (party_add_template, ":result", ":reinforcements_b"),
## (party_add_template, ":result", ":reinforcements_a"),
## (try_begin),
## (call_script,"script_cf_faction_get_random_enemy_faction",":faction_no"),
## (store_random_in_range,":r",0,3),
## (try_begin),
## (lt, ":r", 1),
## (faction_get_slot, ":captive_reinforcements", reg0, slot_faction_reinforcements_b),
## (else_try),
## (faction_get_slot, ":captive_reinforcements", reg0, slot_faction_reinforcements_a),
## (try_end),
## (party_add_template, ":result", ":captive_reinforcements",1),
## (else_try),
## (party_add_template, ":result", "pt_default_prisoners"),
## (try_end),
(try_end),
(try_end),
(ge, ":result", 0),
(assign, reg0, ":result"),
]),
И это туда же:
# 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),
(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),
И ЭТО ТУДА ЖЕ)))
("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
]),
[
(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
]),
("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),
]),
[
(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),
]),
Module simple triggers:
#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
]),
(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
]),
P.S код новый,могут быть глюки.Если кто отпишется о рез-те.Будем благодарны.
Комментариев 2
Посетители, находящиеся в группе Гости, не могут оставлять комментарии к данной публикации.