本帖最后由 快乐风猫 于 2024-4-6 02:40 编辑
总会有某些叼M领主带着1个或者几十个兵天天来洗劫村庄,为了防止这些东西刷屏,加一点东西让村庄不那么单调,有一点存在感
还有一个最简单的办法就是 用下面这个来直接判断是否烧村 ,就两句代码,但是这个敌军力量数值我不知道以什么为准
- ##########
- (try_begin),
- (call_script, "script_duiwurenshu", ":selected_village"),#获取村子人数
- (assign,":village_renshu",reg0),
- (store_mul,":renshu",":village_renshu",2),
- (call_script, "script_duiwurenshu", ":party_no"),#获取领主部队人数
- (assign,":party_renshu",reg0),
- (ge,":party_renshu",":renshu"),#领主部队人数大于村子驻军2倍人数
- (call_script, "script_party_set_ai_state", ":party_no", spai_raiding_around_center, ":selected_village"),
- (else_try),
- (party_get_slot, ":exact_enemy_strength", ":selected_village", slot_center_sortie_enemy_strength),
- (ge,":exact_enemy_strength",500),
- (call_script, "script_party_set_ai_state", ":party_no", spai_raiding_around_center, ":selected_village"),
- (try_end),
- ##########
复制代码
继续script里搜索(call_script, "script_party_set_ai_state", ":party_no", spai_raiding_around_center, ":selected_village"), 在上面添加
- ##########
- (call_script, "script_duiwurenshu", ":selected_village"),#获取村子人数
- (assign,":village_renshu",reg0),
- (call_script, "script_duiwurenshu", ":party_no"),#获取领主部队人数
- (assign,":party_renshu",reg0),
- (ge,":party_renshu",":village_renshu"),#领主部队人数大于村子驻军人数
- ##########
复制代码
然后给村子加一个触发器让它自动招募民兵来壮大驻军,这里是设置一个民兵20第纳尔并且村子有钱的情况下才招募,原版村子并没有收入,给村子加收入的可以看我其他的贴子,里面有增加收入的办法
- #村庄自动招募民兵
- (72,
- [
- (try_for_range, ":village_no", villages_begin, villages_end),
- (party_get_slot, ":village_wealth", ":village_no", slot_town_wealth),
- (store_faction_of_party, ":village_faction", ":village_no"),
- (faction_get_slot, ":culture", ":village_faction", slot_faction_culture),
- (faction_get_slot, ":troop", ":culture", slot_faction_tier_2_troop),
- (party_get_slot, ":prosperity", ":village_no", slot_town_prosperity),
- (val_div, ":prosperity", 20),
-
- (store_random_in_range, ":jilv", 1, 101),
-
- (try_begin),
- (eq, ":prosperity", 0),
- (store_random_in_range, ":renshu", 1, 10),
- (le, ":jilv", 10),#非常贫穷的村子10%几率
- (store_mul,":gongzi",":renshu",20),
- (gt, ":village_wealth", ":gongzi"),
- (party_add_members,":village_no",":troop",":renshu"),
- (else_try),
- (eq, ":prosperity", 1),
- (store_random_in_range, ":renshu", 1, 10),
- (le, ":jilv", 20),#贫穷的村子20%几率
- (store_mul,":gongzi",":renshu",20),
- (gt, ":village_wealth", ":gongzi"),
- (party_add_members,":village_no",":troop",":renshu"),
- (else_try),
- (eq, ":prosperity", 2),
- (store_random_in_range, ":renshu", 1, 10),
- (le, ":jilv", 30),#一般的村子30%几率
- (store_mul,":gongzi",":renshu",20),
- (gt, ":village_wealth", ":gongzi"),
- (party_add_members,":village_no",":troop",":renshu"),
- (else_try),
- (eq, ":prosperity", 3),
- (store_random_in_range, ":renshu", 1, 10),
- (le, ":jilv", 40),#富有的村子40%几率
- (store_mul,":gongzi",":renshu",20),
- (gt, ":village_wealth", ":gongzi"),
- (party_add_members,":village_no",":troop",":renshu"),
- (else_try),
- (gt, ":prosperity", 3),
- (store_random_in_range, ":renshu", 1, 10),
- (le, ":jilv", 50),#非常富有的村子50%几率
- (store_mul,":gongzi",":renshu",20),
- (gt, ":village_wealth", ":gongzi"),
- (party_add_members,":village_no",":troop",":renshu"),
- (try_end),
-
- (val_sub,":village_wealth",":gongzi"),
- (party_set_slot, ":village_no", slot_town_wealth, ":village_wealth"),
- (try_end),
-
- ]),
复制代码
给村庄新加一个管理驻军的选项,在game_menus里面搜索village_wait ,在上面新加
- ("village_station_troops",
- [
- (party_get_slot, ":town_lord", "$current_town", slot_town_lord),
- (str_clear, s10),
-
- (assign, ":player_can_draw_from_garrison", 0),
- (try_begin), #option 1 - player is town lord
- (eq, ":town_lord", "trp_player"),
- (assign, ":player_can_draw_from_garrison", 1),
- (else_try), #option 2 - town is unassigned and part of the player faction
- (store_faction_of_party, ":faction", "$g_encountered_party"),
- (eq, ":faction", "fac_player_supporters_faction"),
- (neg|party_slot_ge, "$g_encountered_party", slot_town_lord, active_npcs_begin), #ie, zero or -1
- (assign, ":player_can_draw_from_garrison", 1),
- (else_try), #option 3 - town was captured by player
- (lt, ":town_lord", 0), #ie, unassigned
- (store_faction_of_party, ":castle_faction", "$g_encountered_party"),
- (eq, "$players_kingdom", ":castle_faction"),
-
- (eq, "$g_encountered_party", "$g_castle_requested_by_player"),
- (str_store_string, s10, "str_retrieve_garrison_warning"),
- (assign, ":player_can_draw_from_garrison", 1),
- (else_try),
- (lt, ":town_lord", 0), #ie, unassigned
- (store_faction_of_party, ":castle_faction", "$g_encountered_party"),
- (eq, "$players_kingdom", ":castle_faction"),
-
- (store_party_size_wo_prisoners, ":party_size", "$g_encountered_party"),
- (eq, ":party_size", 0),
-
- (str_store_string, s10, "str_retrieve_garrison_warning"),
- (assign, ":player_can_draw_from_garrison", 1),
- (else_try),
- (party_slot_ge, "$g_encountered_party", slot_town_lord, active_npcs_begin),
- (store_faction_of_party, ":castle_faction", "$g_encountered_party"),
- (eq, "$players_kingdom", ":castle_faction"),
-
- (troop_slot_eq, "trp_player", slot_troop_spouse, ":town_lord"),
- (assign, ":player_can_draw_from_garrison", 1),
- (try_end),
- (eq, ":player_can_draw_from_garrison", 1),
- ],
- "Manage the garrison {s10}",
- [
- (change_screen_exchange_members,1),
- ]),
复制代码
最后在module_parties里把pf_village改掉来显示村庄驻军
- pf_village = pf_is_static|pf_always_visible|pf_label_small
复制代码
完事儿后领主掠夺村子时必须兵力大于等于村庄驻军才能掠夺了,对所有NPC领主都生效,但不限制玩家
终于摆脱了村子稍微富有一点就被烧掉非常贫穷了
|