本帖最后由 get.shot.with.. 于 2020-5-30 06:55 编辑
https://bbs.mountblade.com.cn/thread-2025807-1-1.html
首先我个人是从骑砍中文站@jj95198大佬的PY代码中得到的思路然后再结合@无面的无名氏大佬的代码然后自己写出的,而后我自己又用3dsMAX重新K了7个动作。
原帖大佬的代码功能是实现双击方向(0.3秒内)触发翻滚动作,以及Q键和E键对应左右闪避
我的思路是双击方向键(0.3秒内)触发向前滑步(w+w)向后撤步(s+s)以及A+A、D+D对应左右滑步(不过我右滑步K帧K的有些粗糙),然后我又增加了ALT+(W、A、D)触发向前向左向右的翻滚(向后翻滚的动作目前还没做)
现在先放出PY 的MS代码 (前半部分基本没变 )
这里是module_mission_templates.py中的 - ( 0, 0, 0, [],
- [
- (try_begin),#前
- (assign, ":coule_time", 0.3),
- (game_key_clicked, gk_move_forward),
- (store_mission_timer_a,":cur_time_a"),
- (try_begin),
- (le, ":cur_time_a", ":coule_time"),
- (game_key_clicked, gk_move_forward),
- (get_player_agent_no,":player_agent"),
- (agent_is_alive,":player_agent"),
- (agent_get_horse, ":horse_no", ":player_agent"),
- (le, ":horse_no", -1),#无马
- (agent_set_animation,":player_agent","anim_coule_forward"),
- (play_sound, "snd_tc_fangun"),
- (else_try),
- (val_add,":coule_time",1),
- (gt, ":cur_time_a", ":coule_time"),
- (reset_mission_timer_a),
- (try_end),
- (try_end),
-
- (try_begin),#后
- (assign, ":coule_time", 0.3),
- (game_key_clicked, gk_move_backward),
- (store_mission_timer_a,":cur_time_a"),
- (try_begin),
- (le, ":cur_time_a", ":coule_time"),
- (game_key_clicked, gk_move_backward),
- (get_player_agent_no,":player_agent"),
- (agent_is_alive,":player_agent"),
- (agent_get_horse, ":horse_no", ":player_agent"),
- (le, ":horse_no", -1),#无马
- (agent_set_animation,":player_agent","anim_coule_backward"),
- (play_sound, "snd_tc_fangun"),
- (else_try),
- (val_add,":coule_time",1),
- (gt, ":cur_time_a", ":coule_time"),
- (reset_mission_timer_a),
- (try_end),
- (try_end),
-
- (try_begin),#左
- (assign, ":coule_time", 0.3),
- (game_key_clicked, gk_move_left),
- (store_mission_timer_a,":cur_time_a"),
- (try_begin),
- (le, ":cur_time_a", ":coule_time"),
- (game_key_clicked, gk_move_left),
- (get_player_agent_no,":player_agent"),
- (agent_is_alive,":player_agent"),
- (agent_get_horse, ":horse_no", ":player_agent"),
- (le, ":horse_no", -1),#无马
- (agent_set_animation,":player_agent","anim_coule_left"),
- (play_sound, "snd_tc_fangun"),
- (else_try),
- (val_add,":coule_time",1),
- (gt, ":cur_time_a", ":coule_time"),
- (reset_mission_timer_a),
- (try_end),
- (try_end),
-
- (try_begin),#右
- (assign, ":coule_time", 0.3),
- (game_key_clicked, gk_move_right),
- (store_mission_timer_a,":cur_time_a"),
- (try_begin),
- (le, ":cur_time_a", ":coule_time"),
- (game_key_clicked, gk_move_right),
- (get_player_agent_no,":player_agent"),
- (agent_is_alive,":player_agent"),
- (agent_get_horse, ":horse_no", ":player_agent"),
- (le, ":horse_no", -1),#无马
- (agent_set_animation,":player_agent","anim_coule_right"),
- (play_sound, "snd_tc_fangun"),
- (else_try),
- (val_add,":coule_time",1),
- (gt, ":cur_time_a", ":coule_time"),
- (reset_mission_timer_a),
- (try_end),
- (try_end),
-
- (try_begin),#前 翻滚
- (key_is_down, key_left_alt),
- (game_key_clicked, gk_move_forward),
- (get_player_agent_no,":player_agent"),
- (agent_is_alive,":player_agent"),
- (agent_get_horse, ":horse_no", ":player_agent"),
- (le, ":horse_no", -1),#无马
- (agent_set_animation,":player_agent","anim_roll_forward"),
- (play_sound, "snd_tc_fangun"),
- (try_end),
- (try_begin),#左 翻滚
- (key_is_down, key_left_alt),
- (game_key_clicked, gk_move_left),
- (get_player_agent_no,":player_agent"),
- (agent_is_alive,":player_agent"),
- (agent_get_horse, ":horse_no", ":player_agent"),
- (le, ":horse_no", -1),#无马
- (agent_set_animation,":player_agent","anim_roll_left"),
- (play_sound, "snd_tc_fangun"),
- (try_end),
- (try_begin),#右 翻滚
- (key_is_down, key_left_alt),
- (game_key_clicked, gk_move_right),
- (get_player_agent_no,":player_agent"),
- (agent_is_alive,":player_agent"),
- (agent_get_horse, ":horse_no", ":player_agent"),
- (le, ":horse_no", -1),#无马
- (agent_set_animation,":player_agent","anim_roll_right"),
- (play_sound, "snd_tc_fangun"),
- (try_end),
- ]),
复制代码
然后这是animation.py中的
- ["roll_forward", acf_right_cut|acf_rot_vertical_bow|acf_enforce_all|acf_displace_position|acf_anim_length(100), amf_priority_attack|amf_play|amf_accurate_body|amf_client_prediction|amf_use_weapon_speed,#前
- [1.4, "roll_forward", 0, 49, blend_in_release, 0, (0,3.2133,0)],
- ],
- ["roll_backward", acf_enforce_all|acf_displace_position, amf_priority_defend_parry|amf_play|amf_accurate_body|amf_client_prediction,#后
- [1.4, "fangun_backward", 0, 72, arf_blend_in_1, 0, (0,-2,0)],
- ],
- ["roll_left", acf_enforce_all|acf_displace_position, amf_priority_defend_parry|amf_play|amf_accurate_body|amf_client_prediction,#左
- [1.4, "roll_left", 0, 49, arf_blend_in_1, 0, (-3.2133,0,0)],
- ],
- ["roll_right", acf_enforce_all|acf_displace_position, amf_priority_defend_parry|amf_play|amf_accurate_body|amf_client_prediction,#右
- [1.4, "roll_right", 0, 49, arf_blend_in_1, 0, (3.2133,0,0)],
- ],
- ["coule_forward", acf_right_cut|acf_rot_vertical_bow|acf_enforce_all|acf_displace_position|acf_anim_length(100), amf_priority_attack|amf_play|amf_accurate_body|amf_client_prediction|amf_use_weapon_speed,#前
- [1.0, "coule_forward", 0, 32, blend_in_release, 0, (0.1639,1.879,0)],
- ],
- ["coule_backward", acf_right_cut|acf_rot_vertical_bow|acf_enforce_all|acf_displace_position|acf_anim_length(100), amf_priority_attack|amf_play|amf_accurate_body|amf_client_prediction|amf_use_weapon_speed,#后
- [1.3, "coule_backward", 0, 32, blend_in_release, 0, (0.1639,-2.2901,0)],
- ],
- ["coule_left", acf_right_cut|acf_rot_vertical_bow|acf_enforce_all|acf_displace_position|acf_anim_length(100), amf_priority_attack|amf_play|amf_accurate_body|amf_client_prediction|amf_use_weapon_speed,#左
- [1.0, "coule_left", 0, 34, blend_in_release, 0, (-3.528,0,0)],
- ],
- ["coule_right", acf_right_cut|acf_rot_vertical_bow|acf_enforce_all|acf_displace_position|acf_anim_length(100), amf_priority_attack|amf_play|amf_accurate_body|amf_client_prediction|amf_use_weapon_speed,#右
- [1.0, "coule_right", 0, 34, blend_in_release, 0, (3.528,0,0)],
- ],
复制代码 而之后的sounds.py则是和大佬的一样。
而后我将编译过后的 TXT 代码粘贴到潘德MOD中,将mission_templates.txt 中所有场景中的
1152921504606847176改成1152921504606847615后就大功告成了(原理我在二楼解释)
我同时在贴吧发的贴子https://tieba.baidu.com/p/671291 ... 589007#132480157337
演示视频也过审了,大家可以去看看具体动作是怎么样的。
https://www.bilibili.com/video/BV11g4y1B7Se
|