綠色部分是我添加的,其他是我分析原文:
適用戰團1.134版本
module_scripts.py中查找#script_update_volunteer_troops_in_village
#script_update_volunteer_troops_in_village
# INPUT: arg1 = center_no
# OUTPUT: none
("update_volunteer_troops_in_village",#村莊招兵類型與數量的判斷
[
(store_script_param, ":center_no", 1),
(party_get_slot, ":player_relation", ":center_no", slot_center_player_relation),#村莊與玩家關系
(party_get_slot, ":center_culture", ":center_no", slot_center_culture),#開局村莊所屬勢力文化
## (try_begin),
## (eq, "$cheat_mode", 2),
## (str_store_party_name, s4, ":center_no"),
## (str_store_faction_name, s5, ":center_culture"),
## (display_message, "str_updating_volunteers_for_s4_faction_is_s5"),
## (try_end),
(faction_get_slot, ":volunteer_troop", ":center_culture", slot_faction_tier_1_troop),
(assign, ":volunteer_troop_tier", 1),#招兵數量用
(store_div, ":tier_upgrades", ":player_relation", 10),#關系除10
(try_for_range, ":unused", 0, ":tier_upgrades"),
(store_random_in_range, ":random_no", 0, 100),
(lt, ":random_no", 10),#10%幾率招高級兵
(store_random_in_range, ":random_no", 0, 2),
(troop_get_upgrade_troop, ":upgrade_troop_no", ":volunteer_troop", ":random_no"),# 兵種1升級後
(try_begin),
(le, ":upgrade_troop_no", 0),#如果不存在
(troop_get_upgrade_troop, ":upgrade_troop_no", ":volunteer_troop", 0),#兵種1
(try_end),
(gt, ":upgrade_troop_no", 0),
(val_add, ":volunteer_troop_tier", 1),#招兵數量用
(assign, ":volunteer_troop", ":upgrade_troop_no"),
(try_end),
(assign, ":upper_limit", 7),#招兵數量用
(try_begin),
(ge, ":player_relation", 5),
(assign, ":upper_limit", ":player_relation"),
(val_div, ":upper_limit", 2),
(val_add, ":upper_limit", 10),
(else_try),
(lt, ":player_relation", 0),
(assign, ":upper_limit", 0),
(try_end),
(val_mul, ":upper_limit", 3),
(store_add, ":amount_random_divider", 2, ":volunteer_troop_tier"),
(val_div, ":upper_limit", ":amount_random_divider"),#最大招兵數
(store_faction_of_party, ":center_faction", ":center_no"),#村莊所屬勢力
(try_begin),
(this_or_next|eq, ":center_faction", "fac_player_supporters_faction"),#城市/村莊 所屬勢力 是 玩家YY王國的話
(eq, ":center_faction", "$players_kingdom"), #或者是玩家目前所在勢力 #就是跟玩家同壹勢力
(else_try),#如果玩家沒加入這個勢力
(assign, ":volunteer_troop", "trp_farmer"),#只能招農民
(try_end),
(store_random_in_range, ":amount", 0, ":upper_limit"),#在0和最大招兵數 之間 隨機壹個數
(party_set_slot, ":center_no", slot_center_volunteer_troop_type, ":volunteer_troop"),#保存要招募兵種
(party_set_slot, ":center_no", slot_center_volunteer_troop_amount, ":amount"),#保存要招募兵數量
]),
在 module_simple_triggers.py 查找 Adding mercenary troops to the towns
# Adding mercenary troops to the towns
(72,
[
(call_script, "script_update_mercenary_units_of_towns"),
#NPC changes begin
# removes (call_script, "script_update_companion_candidates_in_taverns"),
#NPC changes end
(call_script, "script_update_ransom_brokers"),
(call_script, "script_update_tavern_travellers"),
(call_script, "script_update_tavern_minstrels"),
(call_script, "script_update_booksellers"),
(call_script, "script_update_villages_infested_by_bandits"),
(try_for_range, ":village_no", villages_begin, villages_end),
(call_script, "script_update_volunteer_troops_in_village", ":village_no"),
(call_script, "script_update_npc_volunteer_troops_in_village", ":village_no"),
(try_end),
]),