- 好友
- 5
- 在线时间
- 0 小时
- 最后登录
- 2024-11-18
见习骑士
- UID
- 3304622
- 第纳尔
- 690
- 精华
- 0
- 互助
- 26
- 荣誉
- 3
- 贡献
- 0
- 魅力
- 158
- 注册时间
- 2021-12-28
鲜花( 31) 鸡蛋( 0)
|
本帖最后由 杰喵喵 于 2023-5-4 22:16 编辑
武器击倒众多敌人效果,主要是为了制作巨型兵种打击效果,可以在挥舞武器的范围内将敌人打倒在地,话不多说上代码与素材:
一、参考资料与素材来源:
1.[狂人的知识]较为精细的特技攻击判定方法 - MOD制作技术区 - 骑马与砍杀中文站论坛 - Powered by Discuz! (mountblade.com.cn)
2.骨骼拼接理论及应用---火影须佐能乎(代码) - MOD制作技术区 - 骑马与砍杀中文站论坛 - Powered by Discuz! (mountblade.com.cn)
3.动作地摊 - 模型贴图制作与交流区 - 骑马与砍杀中文站论坛 - Powered by Discuz! (mountblade.com.cn)
4. 花糕大佬关于动作的咨询解答
二、效果演示:
20230502-150946_单机游戏热门视频 (bilibili.com)
三、代码
(一)、module_animations
- ["fall_flyback1_near_rise", acf_enforce_all|acf_align_with_ground|acf_displace_position, amf_play|amf_priority_mount|amf_accurate_body|amf_client_prediction,
- [1.8, "ani_fall_flyback1_near_rise",0,43,arf_make_custom_sound,0, (0, -1.5, 0), 0.0],
- ],
- ["fall_flyback3_far_rise", acf_enforce_all|acf_align_with_ground|acf_displace_position, amf_play|amf_priority_mount|amf_accurate_body|amf_client_prediction,
- [3, "ani_fall_flyback3_far_rise",0,64,arf_make_custom_sound,0, (0, -4, 0), 0.0],
- ],
复制代码 (二)、module_scripts.py
- ("cf_attack_agent_play_sound",
- [
- (store_script_param, ":agent_no", 1),
- (store_script_param, ":value", 2),
-
- (agent_is_human,":agent_no"),
- (agent_get_troop_id,":troop_id",":agent_no"),
- (troop_get_type,":type",":troop_id"),
-
- (try_begin),
- (eq,":type",tf_female),
- (agent_play_sound,":agent_no", "snd_woman_hit"),
- (else_try),
- (is_between,":type",tf_undead,tf_undead_giant),
- (agent_play_sound,":agent_no", "snd_undead_hit"),
- (else_try),
- (eq,":type",tf_undead_giant),
- (agent_play_sound,":agent_no", "snd_undead_giant_hit"),
- (else_try),
- (agent_play_sound,":agent_no", "snd_man_hit"),
- (try_end),
-
- (ge,":value",1),
- (agent_get_horse,":horse",":agent_no"),
- (try_begin),
- (gt,":horse",-1),
- #(agent_set_animation,":agent_no","anim_dismount_horse"),
- (else_try),
- (try_begin),
- (ge,":value",2),
- (agent_set_animation,":agent_no","anim_fall_flyback3_far_rise"),
- (else_try),
- (agent_set_animation,":agent_no","anim_fall_flyback1_near_rise"),
- (try_end),
- (agent_force_rethink,":agent_no"),
- (try_end),
-
-
- ]
- ),
复制代码- ##########################################################奥杜因阿卡托什[狂人的知识]较为精细的特技攻击判定方法-开始 #########################################################
- #参考地址: [狂人的知识]较为精细的特技攻击判定方法 https://bbs.mountblade.com.cn/thread-2098687-1-1.html
- #input pos1, pos2 and origin position pos3.
- #pos1 is weapon end point, pos2 is enemy position, pos3 is player position
- #If pos1 and pos2 are in same direction of pos1 and long enough, return reg1 = 1, means can hit.
- ("cf_position_check_hit", [
- (set_fixed_point_multiplier, 100),
- (assign, reg1, 0),
- (get_distance_between_positions, ":cur_distance_1", pos1, pos3),#weapon attack range
- (get_distance_between_positions, ":cur_distance_2", pos2, pos3),#enemy distance
- (ge, ":cur_distance_1", ":cur_distance_2"),#can hit
- (position_get_x, ":cur_x_1", pos1),
- (position_get_y, ":cur_y_1", pos1),
- (position_get_z, ":cur_z_1", pos1),
- (position_get_x, ":cur_x_2", pos2),
- (position_get_y, ":cur_y_2", pos2),
- (position_get_z, ":cur_z_2", pos2),
- (position_get_x, ":cur_x", pos3),
- (position_get_y, ":cur_y", pos3),
- (position_get_z, ":cur_z", pos3),
- (val_sub, ":cur_x_1", ":cur_x"),
- (val_sub, ":cur_y_1", ":cur_y"),
- (val_sub, ":cur_z_1", ":cur_z"),
- (val_sub, ":cur_x_2", ":cur_x"),
- (val_sub, ":cur_y_2", ":cur_y"),
- (val_sub, ":cur_z_2", ":cur_z"),
- (val_mul, ":cur_x_1", ":cur_x_2"),
- (val_mul, ":cur_y_1", ":cur_y_2"),
- (val_mul, ":cur_z_1", ":cur_z_2"),
- (store_add, ":numerator", ":cur_x_1", ":cur_y_1"),
- (val_add, ":numerator", ":cur_z_1"),#x1*x2+y1*y2+z1*z2, dot product
- (store_mul, ":denominator", ":cur_distance_1", ":cur_distance_2"),#magnitude1*magnitude2
- #cos=numerator/denominator. When cos equals 1, these two are in the same direction. We need their included angle to be within plus or minus 60 degrees, that is, cos must be greater than 0.5
- #But considering that Python may not be able to obtain 0.5, let's transform the inequality and apply 0.5 to the denominator side, that is, the numerator must be greater than the denominator multiplied by 0.5
- # (val_mul, ":denominator", 9),
- (val_div, ":denominator", 2),
- (ge, ":numerator", ":denominator"),
- (assign, reg1, 1),#can hit
- ]),
-
- ##########################################################奥杜因阿卡托什[狂人的知识]较为精细的特技攻击判定方法-结束#########################################################
复制代码 (三)、module_mission_templates.py
- <blockquote>init_weep_weapon_hit_check = (
复制代码 将上述代码引用在lead_charge等需要地方。
|
|