- 好友
- 0
- 在线时间
- 114 小时
- 最后登录
- 2024-4-17
平民
- UID
- 650235
- 第纳尔
- 228
- 精华
- 0
- 互助
- 0
- 荣誉
- 0
- 贡献
- 0
- 魅力
- 2
- 注册时间
- 2012-2-7
鲜花( 2) 鸡蛋( 0)
|
本帖最后由 n_light 于 2023-11-25 01:44 编辑
基于16世纪北半球测试,之前参考论坛里的代码,,觉得随机选择攻城目标还得全世界跑图,,因此做了优化
前提:
1、创建一个属于 不法之徒 阵营的 部队模板
2、编写刷新部队的
前两部论坛里很多,这里就不写了
下面是随机选择野怪的一支部队,选择距离最近的城堡/城镇,攻略目标后,自动驻军
- (try_begin),
- (gt,1,"$l_attack_budui"),
- (store_random_party_of_template,"$l_attack_budui","pt_qi_yi_jun"),
- (assign,"$l_attack_city",0),
- (try_end),
- (try_begin),
- (neg|party_is_active,"$l_attack_budui"),#当前选中的野怪是否被消灭
- (assign,"$l_attack_city",0),
- (assign,"$l_attack_budui",0),
- (else_try),
- (eq,"$l_attack_city",0),
- (assign,":var_1",9999),
- (assign,":var_0","p_town_1"),
- (try_for_range,":var_2","p_town_1","p_village_1"),
- (try_begin),
- (store_faction_of_party,":var_5",":var_2"),
- (gt,":var_5","fac_outlaws"),
- (2281,":var_4","$l_attack_budui",":var_2"),
- (gt,":var_1",":var_4"),#找距离最短的
- (assign,":var_1",":var_4"),
- (assign,":var_0",":var_2"),
- (try_end),
- (try_end),
- (assign,"$l_attack_city",":var_0"),
- (party_set_flags,"$l_attack_budui",pf_default_behavior,1),
- (party_set_ai_object,"$l_attack_budui",":var_0"),
- (party_set_ai_behavior,"$l_attack_budui",ai_bhvr_attack_party),
- (else_try),
- (store_faction_of_party,":var_6","$l_attack_city"),
- (eq,":var_6","fac_outlaws"),#攻略成功,配置驻军
- (party_add_members,"$l_attack_city","trp_nord_archer_multiplayer_ai",20),
- (party_add_members,"$l_attack_city","trp_nord_scout_multiplayer_ai",20),
- (party_add_members,"$l_attack_city","trp_nord_veteran_multiplayer_ai",30),
- (assign,"$l_attack_budui",0),
- (try_end),
复制代码
|
|