- 好友
- 15
- 在线时间
- 95 小时
- 最后登录
- 2024-11-15
见习骑士
- UID
- 2462463
- 第纳尔
- 1582
- 精华
- 0
- 互助
- 23
- 荣誉
- 0
- 贡献
- 0
- 魅力
- 83
- 注册时间
- 2015-3-3
鲜花( 57) 鸡蛋( 0)
|
本帖最后由 战争傀儡阿格兰 于 2023-3-6 22:25 编辑
代码环境1.171
参考资料:
https://bbs.mountblade.com.cn/thread-41928-1-1.html0.960提高ai攻城几率,以及纠正玩家0血守城等问题的办法。
按照原来代码,ai最快24小时攻城的兵力需求极高,很浪费时间。修改旧的触发器容易bug、奔溃。索性新写个触发器,围城只要6小时ai就可以带兵进城战斗。此时老触发器任然在运作,甚至判断攻不下来需要放弃围城直接逃跑。。。
代码实际效果:围城只要6小时ai领主就可以带兵进城战斗。满足条件时会黄字提示X国攻城部队数量Y,目标Z。若要改6小时以外的进攻准备,改(ge,":var_5",6),
代码使用方式:魔球触发器。选左边“网络模型”下面的“触发器”,选中第1个触发器,点中间最下面的“创建”。时间0、0、2.98,触发条件不变。然后把下面的抄进TXT栏即可。不用新开档,直接能用。
bug:为什么黄字报告这么别扭?为了省的改strings.txt了 。触发器时间要小于3,因为原版攻城ai每3小时判断一次。
txt码:2270 1 1224979098644774912 11 1 1224979098644774913 521 3 1224979098644774914 1224979098644774913 54 32 2 1224979098644774914 0 132 1 1224979098644774914 2204 2 1224979098644774915 1224979098644774914 561 3 1224979098644774913 54 1 521 3 1224979098644774916 1224979098644774913 64 2121 3 1224979098644774917 1224979098644774912 1224979098644774916 30 2 1224979098644774917 6 501 3 1224979098644774913 46 0 11 1 1224979098644774918 521 3 1224979098644774919 1224979098644774918 0 31 2 1224979098644774919 13 132 1 1224979098644774918 2204 2 1224979098644774920 1224979098644774918 31 2 1224979098644774920 1224979098644774915 2281 3 1224979098644774921 1224979098644774918 1224979098644774913 2147483678 2 1224979098644774921 5 521 3 1224979098644774922 1224979098644774913 46 2105 2 1224979098644774922 1 501 3 1224979098644774913 46 1224979098644774922 3 0 2121 3 1224979098644774916 1224979098644774916 600 501 3 1224979098644774913 64 1224979098644774916 2121 3 1224979098644774923 0 240 501 3 1224979098644774913 65 1224979098644774923 2335 2 5 1224979098644774915 2320 2 5 216172782113783822 2133 2 72057594037927937 1224979098644774922 2320 2 51 216172782113783817 2320 2 50 216172782113783990 2330 2 51 1224979098644774913 1106 2 216172782113783818 16776960 3 0
py码:大幅度创新,修改处标记#Agland
(0, 0, 3.1, [(map_free,0)], [
(store_current_hours, ":cur_hours"),
(try_for_parties, ":center_no"),
(party_get_slot, ":besieger_party", ":center_no", slot_center_is_besieged_by),
(gt, ":besieger_party", 0),
(party_is_active, ":besieger_party"),
(store_faction_of_party, ":besieger_faction", ":besieger_party"),
(party_slot_ge, ":center_no", slot_center_is_besieged_by, 1),
(party_get_slot, ":siege_begin_hours", ":center_no", slot_center_siege_begin_hours),
(store_sub, ":siege_hours", ":cur_hours", ":siege_begin_hours"),
(ge, ":siege_hours", 6),
#Agland:Calculate the number of vessel
(party_set_slot, ":center_no", slot_village_player_can_not_steal_cattle, 0),
(try_for_parties, ":party_no"),
(party_get_slot,":party_type",":party_no",0),
(eq, ":party_type", spt_kingdom_hero_party),
(party_is_active, ":party_no"),
(store_faction_of_party, ":party_faction", ":party_no"),
(eq, ":party_faction", ":besieger_faction",),
(store_distance_to_party_from_party, ":party_distance", ":party_no", ":center_no"),
(lt, ":party_distance", 5),
(party_get_slot, ":num", ":center_no", slot_village_player_can_not_steal_cattle),
(val_add,":num",1),
(party_set_slot, ":center_no", slot_village_player_can_not_steal_cattle, ":num"),#Agland
(try_end),
#Modify parameters for "script_begin_assault_on_center"
(store_sub, ":siege_begin_hours", ":siege_begin_hours", 600),
(party_set_slot, ":center_no", slot_center_siege_begin_hours, ":siege_begin_hours"),
(store_sub, ":siege_hardness", 0, 240),
(party_set_slot, ":center_no", slot_center_siege_hardness, ":siege_hardness"),
#(call_script, "script_begin_assault_on_center", ":center_no"),
(str_store_faction_name, s5, ":besieger_faction"),
(str_store_string, s5, "str_s5_s_party"),
(assign, reg1, ":num"),
(str_store_string, s51, "str_reg1"),
(str_store_string, s50, "str_s5_is_s51"),
(str_store_party_name, s51, ":center_no"),
(display_message, "str_s50_comma_s51",0xFFFF00),
#(str_store_faction_name, s5, ":besieger_faction"),str_s52_comma_s51 str_reg1 str_s50_comma_s51 str_s5_is_s51 str_s3s_s2
#(str_store_troop_name, s7, ":troop_no"),
#(str_store_string, s2, "str_s7_raiders"),
#(str_store_string, s50, "str_s3s_s2"),
#(str_store_party_name, s51, ":center_no"),
#(display_message, "str_s52_comma_s51",0xFFFF00),
#(tutorial_message, "str_s50_comma_s51", 0),done
#(str_store_string, s1, "str_s5_s_party"),
#(str_store_string, s2, "str_s7_raiders"),
#(tutorial_box,s2,s1),#done
#(tutorial_box,":besieger_faction",":center_no"),#nonono
#(display_message, "@{s20} is besieging {s21}",0xFFFF00),
#(assign, reg1, ":siege_begin_hours"),
#(assign, reg2, ":defender_strength"),
#(display_message, "str_january_reg1_reg2"),
#(assign, reg1, ":siege_hardness"),
#(assign, reg2, ":cur_hours"),
#(display_message, "str_may_reg1_reg2"),
(try_end),
]),
以下是旧版,出自module_simple_triggers.py
弃用原因:因为旧版用到(call_script, "script_begin_assault_on_center", ":center_no"),而里面包含改AI的代码。然后游戏10秒左右一次更新的领主ai,把这个进攻ai刷掉了,导致进攻失败。
(party_set_ai_behavior, ":party_no", ai_bhvr_attack_party),
(party_set_ai_object, ":party_no", ":center_no"),
(party_set_flags, ":party_no", pf_default_behavior, 1),
(party_set_slot, ":party_no", slot_party_ai_substate, 1),
修改处标记#Agland
(1.0, 0, 3.0, [(map_free,0)], [
(store_current_hours, ":cur_hours"),
(try_for_range, ":center_no", towns_begin, villages_begin),#Agland
(party_get_slot, ":besieger_party", ":center_no", slot_center_is_besieged_by),
(gt, ":besieger_party", 0),
(party_is_active, ":besieger_party"),
(store_faction_of_party, ":besieger_faction", ":besieger_party"),
(party_slot_ge, ":center_no", slot_center_is_besieged_by, 1),
(party_get_slot, ":siege_begin_hours", ":center_no", slot_center_siege_begin_hours),
(store_sub, ":siege_begin_hours", ":cur_hours", ":siege_begin_hours"),
(assign, ":marshall_attacking", 19),
(try_for_range, ":troop_no", active_npcs_begin, kingdom_ladies_end),#Agland
(troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
(neg|troop_slot_ge, ":troop_no", slot_troop_prisoner_of_party, 0),
(troop_get_slot, ":party_no", ":troop_no", slot_troop_leaded_party),
(gt, ":party_no", 0),
(party_is_active, ":party_no"),
(store_troop_faction, ":troop_faction_no", ":troop_no"),
(eq, ":troop_faction_no", ":besieger_faction"),
(assign, ":continue", 0),
(try_begin),
(party_slot_eq, ":party_no", slot_party_ai_state, spai_besieging_center),
(party_slot_eq, ":party_no", slot_party_ai_object, ":center_no"),
(assign, ":continue", 1),
(else_try),
(party_slot_eq, ":party_no", slot_party_ai_state, spai_accompanying_army),
(party_get_slot, ":commander_party", ":party_no", slot_party_ai_object),
(gt, ":commander_party", 0),
(party_is_active, ":commander_party"),
(party_slot_eq, ":commander_party", slot_party_ai_state, spai_besieging_center),
(party_slot_eq, ":commander_party", slot_party_ai_object, ":center_no"),
(assign, ":continue", 1),
(try_end),
(eq, ":continue", 1),
(party_get_battle_opponent, ":opponent", ":party_no"),
(this_or_next|lt, ":opponent", 0),
(eq, ":opponent", ":center_no"),
(try_begin),
(faction_slot_eq, ":besieger_faction", slot_faction_marshall, ":troop_no"),
#Agland
(assign, ":marshall_attacking", 33),
(else_try),
(assign, ":marshall_attacking", 11),
(try_end),
(gt, ":marshall_attacking", 29),
(party_set_slot, ":center_no", slot_center_siege_hardness, -100),#Modify the calculation method of defensive force
(gt, ":siege_begin_hours", 6),
(call_script, "script_begin_assault_on_center", ":center_no"),
(str_store_faction_name, s7, ":besieger_faction"),
(str_store_party_name, s51, ":center_no"),
(str_store_string, s50, "str_s7_raiders"),
(display_message, "str_s50_comma_s51",0xFFFF00),
#Agland
(try_end),
(try_end),
]),
|
评分
-
查看全部评分
|