- 好友
- 6
- 在线时间
- 266 小时
- 最后登录
- 2024-9-2
见习骑士
- UID
- 286084
- 第纳尔
- 1293
- 精华
- 0
- 互助
- 13
- 荣誉
- 0
- 贡献
- 0
- 魅力
- 26
- 注册时间
- 2010-7-23
鲜花( 33) 鸡蛋( 0)
|
发表于 2020-3-30 10:13:13
|
显示全部楼层
本帖最后由 yunwei1237 于 2020-3-30 10:24 编辑
可以从以下情况着手,
slot_faction_ai_state该slot保存着一个国家当前的ai情况,大概有以下几个情况:
#slot_faction_ai_state values
'''
默认行为(防守)
'''
sfai_default = 0 #also defending
'''
集结军队
'''
sfai_gathering_army = 1
'''
攻城
'''
sfai_attacking_center = 2
'''
洗劫村庄
'''
sfai_raiding_village = 3
'''
攻击敌军
'''
sfai_attacking_enemy_army = 4
'''
攻击某个城堡附近的敌人
'''
sfai_attacking_enemies_around_center = 5
'''
宴会(婚礼,竞技大会)
'''
sfai_feast = 6 #can be feast, wedding, or major tournament
可以创建一个简单触发器,每隔一段时间检测国家的ai情况,然后再让领主从地图上刷出来。
游戏开始时,已经刷新的时候,可以在游戏一开始就检测一次,让所有领主一开始就进入城镇。
在简单触发器中,有一个触发器,每隔一段时间会检测领主是否战败,然后重新刷领主与招募相应的士兵。也可以从这个触发器着手,添加一个条件,只有国家当前的ai情况是集结,攻击,攻城等等行为时,才刷新,否都进入城镇休息。
以前只是一个设想,并没有写代码验证,我想应该可以解决。
这就是简单触发器(大概在simple_triggers.py中的1845行左右):
- # Respawn hero party after kingdom hero is released from captivity.
- (48,
- [
- (try_for_range, ":troop_no", active_npcs_begin, active_npcs_end),
- (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
- (str_store_troop_name, s1, ":troop_no"),
-
- (neg|troop_slot_ge, ":troop_no", slot_troop_prisoner_of_party, 0),
- (neg|troop_slot_ge, ":troop_no", slot_troop_leaded_party, 1),
- (store_troop_faction, ":cur_faction", ":troop_no"),
- (try_begin),
- (eq, ":cur_faction", "fac_outlaws"), #Do nothing
- (else_try),
- (try_begin),
- (eq, "$cheat_mode", 2),
- (str_store_troop_name, s4, ":troop_no"),
- (display_message, "str_debug__attempting_to_spawn_s4"),
- (try_end),
-
- (call_script, "script_cf_select_random_walled_center_with_faction_and_owner_priority_no_siege", ":cur_faction", ":troop_no"),#Can fail
- (assign, ":center_no", reg0),
- (try_begin),
- (eq, "$cheat_mode", 2),
- (str_store_party_name, s7, ":center_no"),
- (str_store_troop_name, s0, ":troop_no"),
- (display_message, "str_debug__s0_is_spawning_around_party__s7"),
- (try_end),
-
- (call_script, "script_create_kingdom_hero_party", ":troop_no", ":center_no"),
- (try_begin),
- (eq, "$g_there_is_no_avaliable_centers", 0),
- (party_attach_to_party, "$pout_party", ":center_no"),
- (try_end),
-
- #new
- #(troop_get_slot, ":party_no", ":troop_no", slot_troop_leaded_party),
- #(call_script, "script_npc_decision_checklist_party_ai", ":troop_no"), #This handles AI for both marshal and other parties
- #(call_script, "script_party_set_ai_state", ":party_no", reg0, reg1),
- #new end
- (troop_get_slot, ":party_no", ":troop_no", slot_troop_leaded_party),
- (call_script, "script_party_set_ai_state", ":party_no", spai_holding_center, ":center_no"),
-
- (else_try),
- (neg|faction_slot_eq, ":cur_faction", slot_faction_state, sfs_active),
- (try_begin),
- (is_between, ":troop_no", kings_begin, kings_end),
- (troop_set_slot, ":troop_no", slot_troop_change_to_faction, "fac_commoners"),
- (else_try),
- (store_random_in_range, ":random_no", 0, 100),
- (lt, ":random_no", 10),
- (call_script, "script_cf_get_random_active_faction_except_player_faction_and_faction", ":cur_faction"),
- (troop_set_slot, ":troop_no", slot_troop_change_to_faction, reg0),
- (try_end),
- (try_end),
- (try_end),
- ]),
复制代码
|
评分
-
查看全部评分
|