本帖最后由 ggfgfgf 于 2024-9-21 20:00 编辑
如题,战团模仿砍2 ,长杆武器一定条件下有几率将骑兵从马上捅落
受@武安apk43 的mod启发
py代码写的简易功能
分wse和普通战团两个版本
wse版本需要wse2,部分module_system可能无法正常编译,需要在header_operations.py最后添加一行:
agent_set_horse = 3313
module_misson_templates.py中开头定义
添加
wse版本
lance_pierce_down_horse = (
ti_on_agent_hit, 0, 0, [],
[
(store_trigger_param_1, ":victim"),
(store_trigger_param_2, ":attacker"),
(store_trigger_param_3, ":injury"),
(ge, ":injury", 25),
(agent_get_horse, ":horse", ":victim"),
(ge, ":horse", 0),
(store_trigger_param, ":key", 9),
(eq, ":key", 1),
# (agent_is_active, ":victim"),
(agent_is_human, ":attacker"),
(agent_is_human, ":victim"),
(agent_is_alive, ":victim"),
(agent_get_wielded_item, ":weapon", ":attacker"),
(item_get_type, ":type", ":weapon"),
(eq, ":type", 4),
(store_agent_hit_points, ":hp", ":victim",1),
(gt, ":hp", ":injury"),
(agent_get_position, pos1, ":attacker"),
(agent_get_position, pos2, ":victim"),
(neg|position_is_behind_position, pos2, pos1),
(assign, ":rnd", 0),
(val_add, ":rnd", ":injury"),
(agent_get_troop_id, ":troop", ":victim"),
(store_skill_level, ":skl", "skl_riding", ":troop"),
(store_mul, ":skl2", ":skl", 5),
(val_sub, ":rnd", ":skl2"),
(val_max, ":rnd", 0),
(val_min, ":rnd", 100),
(store_random_in_range, ":R", 0, 100),
(neg|ge, ":R", ":rnd"),
(agent_set_animation, ":victim", 437),
(agent_set_horse, ":victim", -1),#agent_set_horse = 3313
])
普通战团版本
lance_pierce_down_horse = (
ti_on_agent_hit, 0, 0, [],
[
(store_trigger_param_1, ":victim"),
(store_trigger_param_2, ":attacker"),
(store_trigger_param_3, ":injury"),
(ge, ":injury", 25),
(agent_get_horse, ":horse", ":victim"),
(ge, ":horse", 0),
(store_trigger_param, ":key", 9),
(eq, ":key", 1),
# (agent_is_active, ":victim"),
(agent_is_human, ":attacker"),
(agent_is_human, ":victim"),
(agent_is_alive, ":victim"),
(agent_get_wielded_item, ":weapon", ":attacker"),
(item_get_type, ":type", ":weapon"),
(eq, ":type", 4),
(store_agent_hit_points, ":hp", ":victim",1),
(gt, ":hp", ":injury"),
(agent_get_position, pos1, ":attacker"),
(agent_get_position, pos2, ":victim"),
(neg|position_is_behind_position, pos2, pos1),
(assign, ":rnd", 0),
(val_add, ":rnd", ":injury"),
(agent_get_troop_id, ":troop", ":victim"),
(store_skill_level, ":skl", "skl_riding", ":troop"),
(store_mul, ":skl2", ":skl", 5),
(val_sub, ":rnd", ":skl2"),
(val_max, ":rnd", 0),
(val_min, ":rnd", 100),
(store_random_in_range, ":R", 0, 100),
(neg|ge, ":R", ":rnd"),
(agent_set_animation, ":victim", 437),
(agent_get_horse, ":horse", ":victim"),
(agent_start_running_away,":horse"),
])
在你需要的战场触发器中添加:
lance_pierce_down_horse,
这里以野战(lead_charge)为例
(
"lead_charge",mtf_battle_mode|mtf_synch_inventory,charge,
"You lead your men to battle.",
[
(1,mtef_defenders|mtef_team_0,0,aif_start_alarmed,12,[]),
(0,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
(4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
(4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),
],
[
(ti_on_agent_spawn, 0, 0, [],
[
(store_trigger_param_1, ":agent_no"),
(call_script, "script_agent_reassign_team", ":agent_no"),
(assign, ":initial_courage_score", 5000),
............
lance_pierce_down_horse, #新增代码
common_battle_order_panel,
common_battle_order_panel_tick,
],
),
中文注释
lance_pierce_down_horse = (
ti_on_agent_hit, 0, 0, [],#有个体被击打时
[
(store_trigger_param_1, ":victim"),#获取被击打者 victim
(store_trigger_param_2, ":attacker"),#获取被击打者 attacker
(store_trigger_param_3, ":injury"),#获取击打伤害值 injury
(store_trigger_param, ":key", 9),#获取参数9,伤害类型 key
(assign, ":weapon", reg0), #获取击打武器 weapon
# (agent_is_active, ":victim"), #被击打者活着,确切说是任活动,大约死亡后失去布娃娃效果前
#如果只是判断存活,可以用 (agent_is_alive,":victim"),
#这段是为了保险,我看到很多人都这么写,不过无意外的话,普通mod这句作用不大
(agent_is_human, ":attacker"), #击打者是人
(agent_is_human, ":victim"), #被击打者是人
(agent_is_alive, ":victim"), #被击打者活着
(eq, ":key", 1), #伤害类型为刺击
(item_get_type, ":type", ":weapon"),#获取武器类型 type
(eq, ":type", 4), #是长杆类武器
(agent_get_horse, ":horse", ":victim"),#获取被击打者的马
(ge, ":horse", 0), #被击打者骑马
(ge, ":injury", 25), #击打伤害大于25
(store_agent_hit_points, ":hp", ":victim",1),#获取被击打者生命值,直接数值 hp
(gt, ":hp", ":injury"), #被击打者生命值大于伤害,不会死
(agent_get_position, pos1, ":attacker"), #获取击打者位置矢量 pos1
(agent_get_position, pos2, ":victim"), #获取被击打者位置矢量 pos2
(neg|position_is_behind_position, pos2, pos1),#两个位置矢量 pos1 ,pos2 相对,类似对冲
(assign, ":rnd", 0), #初始化限度值 rnd
(val_add, ":rnd", ":injury"),
(agent_get_troop_id, ":troop", ":victim"), #获取被击打者兵种 troop
(store_skill_level, ":skl", "skl_riding", ":troop"), #获取被击打者兵种骑术技能值 skl
(store_mul, ":skl2", ":skl", 5),
(val_sub, ":rnd", ":skl2"),
(val_max, ":rnd", 0),
(val_min, ":rnd", 100), #以上为对 rnd 的一些运算操作
(store_random_in_range, ":R", 0, 100), #生成 1 到 100 随机值 R
(neg|ge, ":R", ":rnd"), #R 小于等于 rnd
(agent_set_animation, ":victim", 437), #被击打者设置动作为437号,落马动画
(agent_set_horse, ":victim", -1),#agent_set_horse = 3313 被击打者设置所骑马为-1:无
])
补充关于 ti_on_agent_hit 的参数问题
ti_on_agent_hit = -28.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: receiver agent no
# Trigger Param 2: dealer agent no
# Trigger Param 3: inflicted damage
# Trigger Param 4: hit bone
# Trigger Param 5: missile item kind no
# Trigger Param 6: raw damage (before being soaked by armor)
# Trigger Param 7: item modifier
# Trigger Param 8: missile item modifier
# Trigger Param 9: damage type
# Register 0: item kind no
# Register 1: hit bone
# Position Register 0: position of the blow
# rotation gives the direction of the blow
# Trigger Result: if set, damage dealt to agent
|