本帖最后由 奥杜因阿卡托什 于 2024-10-14 10:21 编辑
大家好啊,我是奥内的手,今天来点大家想看的东西。
这是一个集中式使用slot的私兵添加(不是部队模板,而是直接增加到部队里),是https://bbs.mountblade.com.cn/thread-2091625-1-1.html的改进版。
改进点有:
1.所有NPC适用,不仅包括领主,还包括有些mod里会有的领主伙伴NPC,甚至可以包括主角和主角的手下,乃至一般小兵。
2.所有部队适用,不仅包括领主部队,哪怕这人便乘野怪领主商队首领了也能适用(当然俘虏不适用)。另外,领主在给自己部队添加私兵的同时也会给所管理的城镇添加。
3.更加高效,占用算力更少。
这个东西是魔球适用的(或许)。
先加constant
- #私兵
- slot_bodygaurd_troop_1 = 163
- slot_bodygaurd_troop_2 = 164
复制代码
再加一个脚本。
- #录入私兵
- #比如123|041|1024就是1024号兵种作为私兵,每次增员41个最多123人。
- ("bodyguard_troop_import", [
- (store_script_param, ":lord_troop_no", 1),
- (store_script_param, ":bodyguard_troop_no", 2),
- (store_script_param, ":num_increase", 3), #每次增员的数量
- (store_script_param, ":num_limit", 4), #上限
- (store_script_param, ":slot_no", 5), #槽1或者2
- (val_mul, ":num_increase", 10000),
- (val_mul, ":num_limit", 10000000),
- (val_add, ":num_limit", ":num_increase"),
- (val_add, ":bodyguard_troop_no", ":num_limit"),
- (val_sub, ":slot_no", 1),
- (val_add, ":slot_no", slot_bodygaurd_troop_1),
- (troop_set_slot, ":lord_troop_no", ":slot_no", ":bodyguard_troop_no"),
- ]),
复制代码 然后开局的时候录入一次,比如写在那个trigger第一个触发器,那个弹教程的下面。
- 形如
- (call_script, "script_bodyguard_troop_import", "trp_kingdom_1_lord", "trp_holy_dragoon_knight", 2, 6, 1), #第1种私兵每次增员2个最多6个
- (call_script, "script_bodyguard_troop_import", "trp_kingdom_1_lord", "trp_crown_knight", 4, 120, 2), #第2种私兵每次增员4个最多120个。
复制代码 最后找个触发器写上
- (24,
- [
- (assign, ":current_modula", "$g_kingdom_prisoner_modula"), #降压用
- (val_add, "$g_kingdom_prisoner_modula", 1),
- (try_begin),
- (eq, "$g_kingdom_prisoner_modula", 7),
- (assign, "$g_kingdom_prisoner_modula", 0),
- (try_end),
- (try_for_parties, ":center_no"),
- (store_mod, ":center_modula", ":center_no", 7),
- (eq, ":center_modula", ":current_modula"),
- (try_begin),
- (is_between, ":center_no", centers_begin, centers_end), #据点增加私兵的模式:领主不在城镇里,也会给城镇增加私兵
- (party_get_slot, ":troop_no", ":center_no", slot_town_lord),
- (gt, ":troop_no", 0), #暂不包括玩家
- (try_for_range, ":slot_no", 0, 2),
- (val_add, ":slot_no", slot_bodygaurd_troop_1),
- (troop_get_slot, ":bodyguard_troop_no", ":troop_no", ":slot_no"),
- (gt, ":bodyguard_troop_no", 0),
- (store_div, ":num_limit", ":bodyguard_troop_no", 10000000),#上限
- (val_mod, ":bodyguard_troop_no", 10000000),
- (store_div, ":num_add", ":bodyguard_troop_no", 10000),#增员数额
- (val_mod, ":bodyguard_troop_no", 10000),
- (party_count_members_of_type, ":cur_num", ":center_no", ":bodyguard_troop_no"),
- (lt, ":cur_num", ":num_limit"), #可以添加
- (try_begin),
- (val_sub, ":num_limit", ":cur_num"),
- (lt, ":num_limit", ":num_add"),
- (assign, ":num_add", ":num_limit"),#剩余员额不足以完整增员一次
- (try_end),
- (party_add_members, ":center_no", ":bodyguard_troop_no", ":num_add"),#添加
- (try_end),
- (try_end),
- (party_get_num_companion_stacks, ":num_companion_stacks",":center_no"), #直接给所在部队增加私兵的模式
- (try_for_range, ":stack_no", 0, ":num_companion_stacks"),
- (party_stack_get_troop_id, ":stack_troop",":center_no",":stack_no"),
- (troop_is_hero, ":stack_troop"), #英雄单位
- (try_for_range, ":slot_no", 0, 2),
- (val_add, ":slot_no", slot_bodygaurd_troop_1),
- (troop_get_slot, ":bodyguard_troop_no", ":stack_troop", ":slot_no"),
- (gt, ":bodyguard_troop_no", 0),
- (store_div, ":num_limit", ":bodyguard_troop_no", 10000000),#上限
- (val_mod, ":bodyguard_troop_no", 10000000),
- (store_div, ":num_add", ":bodyguard_troop_no", 10000),#增员数额
- (val_mod, ":bodyguard_troop_no", 10000),
- (party_count_members_of_type, ":cur_num", ":center_no", ":bodyguard_troop_no"),
- (lt, ":cur_num", ":num_limit"), #可以添加
- (try_begin),
- (val_sub, ":num_limit", ":cur_num"),
- (lt, ":num_limit", ":num_add"),
- (assign, ":num_add", ":num_limit"),#剩余员额不足以完整增员一次
- (try_end),
- (party_add_members, ":center_no", ":bodyguard_troop_no", ":num_add"),#添加
- (try_end),
- (try_end),
- (try_end),
- ]),
复制代码 建议找个24小时的触发器,因为我这里用了https://bbs.mountblade.com.cn/thread-2096862-1-1.html的降压方法,每次处理七分之一的部队。所以24小时一次就是7天完成一轮。
|