骑砍战团MOD开发(47)-使用飞虎爪爬上城墙

一.飞虎爪

["p_song_hook_emitter", "p song hook emitter", [("p_song_hook_emitter",0)], itp_type_pistol|itp_merchandise|itp_primary ,itcf_shoot_pistol|itcf_reload_pistol, 1000, weight(1.5)|abundance(400)|difficulty(0)|spd_rtng(200)|shoot_speed(160)|thrust_damage(100 ,pierce)|max_ammo(50)|accuracy(300), imodbits_none, [
    (ti_on_weapon_attack, [
       (store_trigger_param_1, ":agent_no"),
       #pos1 shoot positiion
       (init_position, pos2),
       (init_position, pos3),
       (init_position, pos4),
       (init_position, pos5),
       (agent_get_look_position, pos3, ":agent_no"),
       (agent_get_position, pos4, ":agent_no"),
       (position_copy_origin, pos2, pos1),
       (position_copy_rotation, pos2, pos3),
       
       (cast_ray, ":hit_scene_prop_id", pos5, pos2),
       (try_begin),
          (neq, ":hit_scene_prop_id", -1),
          (set_spawn_position, pos5),
          (spawn_scene_prop, "spr_p_song_hook"),
          (assign, ":prop_instance_no", reg0),
          (set_fixed_point_multiplier, 1),
          (prop_instance_set_scale, ":prop_instance_no", 3, 3, 3),
          (agent_set_slot, ":agent_no", slot_agent_hook_instance_no, ":prop_instance_no"),
       
          #calculate string length
          (get_distance_between_positions, ":hook_agent_distance", pos2, pos5),
          (store_div, ":hook_string_scale", ":hook_agent_distance", 100),
          (set_spawn_position, pos5),
          (spawn_scene_prop, "spr_p_song_hook_string"),
          (assign, ":prop_instance_no", reg0),
          (set_fixed_point_multiplier, 1),
          (prop_instance_set_scale, ":prop_instance_no", 3, ":hook_string_scale", 1),
          (agent_set_slot, ":agent_no", slot_agent_hook_string_instance_no, ":prop_instance_no"),
          (agent_unequip_item, ":agent_no", "itm_p_song_hook_emitter"),
       (try_end),
    ]),
]],
["p_song_hook_emitter_missile", "p song hook emitter missile", [("p_song_hook_emitter_missile",0)], itp_type_bullets|itp_merchandise|itp_can_penetrate_shield|itp_default_ammo, 0, 41, weight(0.25)|abundance(90)|weapon_length(3)|thrust_damage(1,pierce)|max_ammo(400),imodbits_missile],

二.爬墙

     (0, 0, 0, [
        (get_player_agent_no, ":player_agent"),
        (neg|agent_slot_eq, ":player_agent", slot_agent_hook_instance_no, -1),
        (neg|agent_slot_eq, ":player_agent", slot_agent_hook_string_instance_no, -1),
     ], [
        (init_position, pos2),
        (init_position, pos4),
        (get_player_agent_no, ":player_agent"),
        (agent_get_slot, ":agent_hook_string_instance_no", ":player_agent", slot_agent_hook_string_instance_no),
        (agent_get_slot, ":agent_hook_instance_no", ":player_agent", slot_agent_hook_instance_no),
        (agent_get_position, pos4, ":player_agent"),
        (prop_instance_get_position, pos2, ":agent_hook_instance_no"),
        (call_script, "script_set_hook_string_position", ":agent_hook_string_instance_no"),
        
        #move toward animation
        (agent_set_animation, ":player_agent", "anim_god_man_walk_along_hook"),
     ]),
     (0, 0, 0, [
        (get_player_agent_no, ":player_agent"),
        (neg|agent_slot_eq, ":player_agent", slot_agent_hook_instance_no, -1),
        (neg|agent_slot_eq, ":player_agent", slot_agent_hook_string_instance_no, -1),
        (game_key_is_down, gk_move_forward)
     ], [
        (get_player_agent_no, ":player_agent"),
        (call_script, "script_set_hook_agent_position", ":player_agent", 0),
     ]),
     (0, 0, 0, [
        (get_player_agent_no, ":player_agent"),
        (neg|agent_slot_eq, ":player_agent", slot_agent_hook_instance_no, -1),
        (neg|agent_slot_eq, ":player_agent", slot_agent_hook_string_instance_no, -1),
        (game_key_is_down, gk_move_backward)
     ], [
        (get_player_agent_no, ":player_agent"),
        (call_script, "script_set_hook_agent_position", ":player_agent", 1),
     ]),
     (0, 0, 0, [
        (get_player_agent_no, ":player_agent"),
        (neg|agent_slot_eq, ":player_agent", slot_agent_hook_instance_no, -1),
        (neg|agent_slot_eq, ":player_agent", slot_agent_hook_string_instance_no, -1),
        (game_key_is_down, gk_move_left)
     ], [
        (get_player_agent_no, ":player_agent"),
        (call_script, "script_set_hook_agent_position", ":player_agent", 2),
     ]), 
     (0, 0, 0, [
        (get_player_agent_no, ":player_agent"),
        (neg|agent_slot_eq, ":player_agent", slot_agent_hook_instance_no, -1),
        (neg|agent_slot_eq, ":player_agent", slot_agent_hook_string_instance_no, -1),
        (game_key_is_down, gk_move_right)
     ], [
        (get_player_agent_no, ":player_agent"),
        (call_script, "script_set_hook_agent_position", ":player_agent", 3),
     ]),
     (ti_on_agent_spawn, 0, 0, [], [
        (store_trigger_param_1, ":agent_no"),
        (agent_set_slot, ":agent_no", slot_agent_hook_string_instance_no, -1),
        (agent_set_slot, ":agent_no", slot_agent_hook_instance_no, -1),
     ]),

三.新增函数

  # script_set_hook_agent_position
  # Input: agent no, direction 0 forward 1 backward 2 left 3 right
  ("set_hook_agent_position", [
     (store_script_param_1, ":agent_no"),
     (store_script_param_2, ":direction"),
     (init_position, pos1),
     (init_position, pos2),
     (agent_get_position, pos1, ":agent_no"),
     (agent_get_slot, ":agent_hook_instance_no", ":agent_no", slot_agent_hook_instance_no),
     (agent_get_slot, ":agent_hook_stirng_instance_no", ":agent_no", slot_agent_hook_string_instance_no),
     (prop_instance_get_position, pos2, ":agent_hook_instance_no"),
        
     #hook terrain center radius 100cm around agent detect
     (set_fixed_point_multiplier, 100),
     (position_get_distance_to_terrain, ":distance_to_terrain", pos2),
     (val_mul, ":distance_to_terrain", -1),
     (position_move_z, pos2, ":distance_to_terrain", 1),
     (get_distance_between_positions, ":hook_center_radius", pos1, pos2),
     (position_get_distance_to_terrain, ":agent_distance_to_terrain", pos1),
     (val_mul, ":distance_to_terrain", -1),
        
     (try_begin),
        (gt, ":agent_distance_to_terrain", ":distance_to_terrain"),
        (position_copy_origin, pos1, pos2),
        (val_add, ":distance_to_terrain", 50),
        (position_move_z, pos1, ":distance_to_terrain", 1),
        (position_move_y, pos1, 20),
        (agent_set_position, ":agent_no", pos1),
        (agent_set_animation, ":agent_no", "anim_god_horse_man_sit_down_reback"),
        (agent_set_no_dynamics, ":agent_no", 0),
        (scene_prop_fade_out, ":agent_hook_instance_no", 100),
        (scene_prop_fade_out, ":agent_hook_stirng_instance_no", 100),
        (agent_set_slot, ":agent_no", slot_agent_hook_instance_no, -1),
        (agent_set_slot, ":agent_no", slot_agent_hook_string_instance_no, -1),
        (agent_equip_item, ":agent_no", "itm_p_song_hook_emitter"),
     (else_try),
        (gt, ":agent_distance_to_terrain", 10),
        (agent_set_no_dynamics, ":agent_no", 1),
        (position_copy_origin, pos1, pos2),
        (val_add, ":agent_distance_to_terrain", 1),
        (position_move_z, pos1, ":agent_distance_to_terrain", 1),
        (position_move_y, pos1, -100),
        (agent_set_position, ":agent_no", pos1),
        (agent_set_animation, ":agent_no", "anim_god_man_walk_rotate_hook"),
     (else_try),
        (lt, ":hook_center_radius", 200),
        (agent_set_no_dynamics, ":agent_no", 1),
        (position_copy_origin, pos1, pos2),
        (val_add, ":agent_distance_to_terrain", 1),
        (position_move_z, pos1, ":agent_distance_to_terrain", 1),
        (position_move_y, pos1, -100),
        (agent_set_position, ":agent_no", pos1),
        (agent_set_animation, ":agent_no", "anim_god_man_walk_rotate_hook"),
     (else_try),
        (agent_set_no_dynamics, ":agent_no", 0),
        (try_begin),
           (eq, ":direction", 0),
           (position_move_y, pos1, 2),
        (else_try),
           (eq, ":direction", 1),
           (position_move_y, pos1, -2), 
        (else_try),
           (eq, ":direction", 2),
           (position_move_x, pos1, -2), 
        (else_try),
           (eq, ":direction", 3),
           (position_move_x, pos1, 2), 
        (try_end),
        (agent_set_position, ":agent_no", pos1),
        (agent_set_animation, ":agent_no", "anim_god_man_walk_along_hook"),
     (try_end),
  ]),
  
  
  # script_set_hook_string_position
  # Input: hook_string_instance_no, pos2 hook position, pos4 agent position
  ("set_hook_string_position", [
     (init_position, pos5),
     (store_script_param_1, ":hook_string_instance_no"),
     (position_move_z, pos4, 100),
     (position_move_y, pos4, 10),
     #calculate string length and scale
     (get_distance_between_positions, ":hook_string_length", pos2, pos4),
     (store_div, ":hook_string_scale", ":hook_string_length", 100),
     (set_fixed_point_multiplier, 1),
     (prop_instance_set_scale, ":hook_string_instance_no", 3, ":hook_string_scale", 1),
     
     #calculate string rotation angle
     (position_transform_position_to_local, pos5, pos2, pos4),
     (set_fixed_point_multiplier, 100),
     (position_get_x, ":relative_x", pos5),
     (position_get_y, ":relative_y", pos5),
     (position_get_z, ":relative_z", pos5),
     (store_atan2, ":rotation_around_z", ":relative_x", ":relative_y"),
     (store_sub, ":rotation_around_z", 18000, ":rotation_around_z"),
     
     (position_set_z, pos5, 0),
     (position_transform_position_to_parent, pos4, pos2, pos5),                                             
     (get_distance_between_positions, ":relative_xy", pos2, pos4),
     (store_atan2, ":rotation_around_x", ":relative_z", ":relative_xy"),
     (val_mul, ":rotation_around_x", -1),
     
     (position_rotate_z_floating, pos2, ":rotation_around_z"),
     (position_rotate_x_floating, pos2, ":rotation_around_x"),
     (prop_instance_set_position, ":hook_string_instance_no", pos2),     
  ]),
相关推荐
霸王•吕布2 个月前
骑砍战团MOD开发(52)-使用BrfExporter&Blender制作BRF文件
骑马与砍杀·骑砍战团·brfexporter·blender导出brf文件·blender导出顶点动画·blender制作顶点动画
霸王•吕布8 个月前
骑砍战团MOD开发(39)-RTS塔防保卫卡拉迪亚大陆
游戏开发·骑马与砍杀·骑砍战团·mod开发·rts塔防·rts视角·rts游戏