一.飞虎爪
["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, pos5),
(agent_get_look_position, pos3, ":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],
二.飞虎爪爬墙
hook_triggers = [
(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),
(prop_instance_get_position, pos2, ":agent_hook_instance_no"),
(agent_get_bone_position, pos4, ":player_agent", 18, 1),
(call_script, "script_set_hook_string_position", ":agent_hook_string_instance_no"),
#move toward animation
(agent_set_animation, ":player_agent", "anim_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),
]),
(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_clicked, gk_toggle_weapon_mode)
], [
(get_player_agent_no, ":player_agent"),
(call_script, "script_unequip_hook_weapon", ":player_agent"),
]),
(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),
]),
]
三.挠钩
["p_song_weapon_7", "p_song_weapon_7", [("p_song_weapon_7",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(0 ,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"),
(position_copy_origin, pos2, pos1),
(position_copy_rotation, pos2, pos3),
(assign, ":min_distance_to_catched_agent", 0),
(assign, ":catched_agent_no", -1),
(try_for_agents, ":target_agent_no"),
(agent_is_alive, ":target_agent_no"),
(agent_is_human, ":target_agent_no"),
(neg|agent_is_ally, ":target_agent_no"),
(agent_get_position, pos4, ":target_agent_no"),
(position_transform_position_to_local, pos5, pos2, pos4),
(get_distance_between_positions, ":distance_to_catch_agent", 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),
(val_abs, ":relative_x"),
(val_abs, ":relative_z"),
(lt, ":relative_x", 100),
(lt, ":relative_z", 100),
(try_begin),
(eq, ":catched_agent_no", -1),
(assign, ":catched_agent_no", ":target_agent_no"),
(assign, ":min_distance_to_catched_agent", ":distance_to_catch_agent"),
(else_try),
(lt, ":distance_to_catch_agent", ":min_distance_to_catched_agent"),
(assign, ":catched_agent_no", ":target_agent_no"),
(assign, ":min_distance_to_catched_agent", ":distance_to_catch_agent"),
(try_end),
(try_end),
(agent_get_slot, ":agent_catched_agent_num", ":agent_no", slot_agent_catched_agent_num),
(try_begin),
(neq, ":catched_agent_no", -1),
(le, ":agent_catched_agent_num", 10),
(agent_is_human, ":catched_agent_no"),
(agent_get_horse, ":catch_horse_agent_no", ":catched_agent_no"),
(try_begin),
(ge, ":catch_horse_agent_no", 0),
(agent_get_troop_id, ":agent_troop_id", ":catched_agent_no"),
(ge, ":agent_troop_id", 0),
(troop_get_inventory_slot, ":horse_item_id", ":agent_troop_id", ek_horse),
(ge, ":horse_item_id", 0),
(agent_get_position, pos2, ":catch_horse_agent_no"),
(agent_unequip_item, ":catched_agent_no", ":horse_item_id"),
(remove_agent, ":catch_horse_agent_no"),
(set_spawn_position, pos2),
(spawn_horse, ":horse_item_id"),
(try_end),
#generate hook string
(agent_get_slot, ":agent_hook_string_instance_no", ":agent_no", slot_agent_hook_string_instance_no),
(try_begin),
(eq, ":agent_hook_string_instance_no", -1),
(set_spawn_position, pos1),
(spawn_scene_prop, "spr_p_song_hook_string"),
(assign, ":agent_hook_string_instance_no", reg0),
(try_end),
#set slot value
(agent_set_slot, ":catched_agent_no", slot_agent_catch_agent_no, ":agent_no"),
(agent_set_slot, ":catched_agent_no", slot_agent_hook_string_instance_no, ":agent_hook_string_instance_no"),
(val_add, ":agent_catched_agent_num", 1),
(agent_set_slot, ":agent_no", slot_agent_catched_agent_num, ":agent_catched_agent_num"),
(try_end),
]),
]],
["p_song_weapon_8", "p_song_weapon_8", [("p_song_weapon_8",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(0,pierce)|max_ammo(400),imodbits_missile],
四.马上拖拽
catch_agent_hook_triggers = [
(0, 0, 0, [
(game_key_clicked, gk_toggle_weapon_mode)
], [
(get_player_agent_no, ":player_agent"),
(try_for_agents, ":agent_no"),
(agent_is_alive, ":agent_no"),
(agent_is_human, ":agent_no"),
(agent_slot_eq, ":agent_no", slot_agent_catch_agent_no, ":player_agent"),
(call_script, "script_unequip_catch_agent_hook_weapon", ":player_agent", ":agent_no"),
(try_end),
]),
(0, 0, 0, [], [
(try_for_agents, ":agent_no"),
(agent_is_alive, ":agent_no"),
(agent_is_human, ":agent_no"),
(neg|agent_slot_eq, ":agent_no", slot_agent_catch_agent_no, -1),
(agent_get_slot, ":agent_catch_agent_no", ":agent_no", slot_agent_catch_agent_no),
(call_script, "script_set_catched_agent_position", ":agent_catch_agent_no", ":agent_no"),
(try_end),
]),
(3, 0, 0, [], [
(try_for_agents, ":agent_no"),
(agent_is_alive, ":agent_no"),
(agent_is_human, ":agent_no"),
(neg|agent_slot_eq, ":agent_no", slot_agent_catch_agent_no, -1),
(agent_get_slot, ":agent_catch_agent_no", ":agent_no", slot_agent_catch_agent_no),
(agent_deliver_damage_to_agent, ":agent_catch_agent_no", ":agent_no", 30, "itm_khergit_arrows"),
(try_end),
]),
(ti_on_agent_spawn, 0, 0, [], [
(store_trigger_param_1, ":agent_no"),
(agent_is_human, ":agent_no"),
(agent_set_slot, ":agent_no", slot_agent_hook_string_instance_no, -1),
(agent_set_slot, ":agent_no", slot_agent_catch_agent_no, -1),
(agent_set_slot, ":agent_no", slot_agent_catched_agent_num, 0),
]),
(ti_on_agent_killed_or_wounded, 0, 0, [], [
(store_trigger_param_1, ":dead_agent_no"),
(store_trigger_param_2, ":killer_agent_no"),
(try_begin),
(agent_is_human, ":dead_agent_no"),
(agent_get_slot, ":agent_catch_agent_no", ":dead_agent_no", slot_agent_catch_agent_no),
(neq, ":agent_catch_agent_no", -1),
(neq, ":dead_agent_no", -1),
(call_script, "script_unequip_catch_agent_hook_weapon", ":agent_catch_agent_no", ":dead_agent_no"),
(try_end),
]),
]
五.新增函数
# 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),
(init_position, pos3),
(agent_get_position, pos1, ":agent_no"),
(agent_get_slot, ":agent_hook_instance_no", ":agent_no", slot_agent_hook_instance_no),
(prop_instance_get_position, pos2, ":agent_hook_instance_no"),
(position_transform_position_to_local, pos3, pos1, pos2),
(set_fixed_point_multiplier, 100),
(position_get_x, ":relative_x", pos3),
(position_get_y, ":relative_y", pos3),
(position_get_z, ":relative_z", pos3),
(val_abs, ":relative_x"),
(val_abs, ":relative_y"),
(try_begin),
(lt, ":relative_y", 100),
(lt, ":relative_x", 100),
(try_begin),
(lt, ":relative_z", 0),
(agent_set_no_dynamics, ":agent_no", 0),
(agent_get_position, pos1, ":agent_no"),
(position_move_z, pos1, 200),
(position_move_y, pos1, 200),
(set_fixed_point_multiplier, 100),
(position_get_distance_to_ground_level, ":distance_to_ground", pos1),
(try_begin),
(lt, ":distance_to_ground", 500),
(agent_set_position, ":agent_no", pos1),
(try_end),
(call_script, "script_unequip_hook_weapon", ":agent_no"),
(else_try),
(agent_set_no_dynamics, ":agent_no", 1),
(agent_get_position, pos1, ":agent_no"),
(position_move_z, pos1, 1),
(agent_set_position, ":agent_no", pos1),
(agent_set_animation, ":agent_no", "anim_walk_rotate_hook"),
(try_end),
(else_try),
(agent_set_no_dynamics, ":agent_no", 0),
(try_begin),
(eq, ":direction", 0),
(position_move_y, pos1, 5),
(else_try),
(eq, ":direction", 1),
(position_move_y, pos1, -5),
(else_try),
(eq, ":direction", 2),
(position_move_x, pos1, -5),
(else_try),
(eq, ":direction", 3),
(position_move_x, pos1, 5),
(try_end),
(set_fixed_point_multiplier, 100),
(position_get_distance_to_ground_level, ":distance_to_ground", pos1),
(try_begin),
(gt, ":distance_to_ground", 500),
(call_script, "script_unequip_hook_weapon", ":agent_no"),
(else_try),
(agent_set_position, ":agent_no", pos1),
(agent_set_animation, ":agent_no", "anim_walk_along_hook"),
(try_end),
(try_end),
]),
# script_set_hook_string_position
# Input: hook_string_instance_no, pos2 hook position, pos4 agent position
("set_hook_string_position", [
(store_script_param_1, ":hook_string_instance_no"),
(init_position, pos5),
#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),
]),
# script_set_catched_agent_position
# Input: agent no, agent_catched_agent_no
("set_catched_agent_position", [
(store_script_param_1, ":agent_no"),
(store_script_param_2, ":agent_catched_agent_no"),
(init_position, pos1),
(init_position, pos2),
(init_position, pos3),
(init_position, pos4),
(agent_get_slot, ":agent_hook_string_instance_no", ":agent_catched_agent_no", slot_agent_hook_string_instance_no),
(agent_get_position, pos1, ":agent_no"),
(agent_get_position, pos2, ":agent_catched_agent_no"),
(get_distance_between_positions, ":agent_to_catched_agent_distance", pos1, pos2),
(position_transform_position_to_local, pos3, pos1, pos2),
(set_fixed_point_multiplier, 100),
(position_get_x, ":relative_x", pos3),
(position_get_y, ":relative_y", pos3),
(position_get_z, ":relative_z", pos3),
(store_atan2, ":rotation_around_z", ":relative_x", ":relative_y"),
(position_set_z, pos3, 0),
(position_transform_position_to_parent, pos4, pos1, pos3),
(get_distance_between_positions, ":relative_xy", pos1, pos4),
(store_atan2, ":rotation_around_x", ":relative_z", ":relative_xy"),
(val_mul, ":rotation_around_z", -1),
(position_rotate_z_floating, pos1, ":rotation_around_z"),
(position_rotate_x_floating, pos1, ":rotation_around_x"),
(try_begin),
(gt, ":agent_to_catched_agent_distance", 1500),
(position_move_y, pos1, 1500),
(position_rotate_z, pos1, 180),
(agent_set_position, ":agent_catched_agent_no", pos1),
(try_end),
(agent_set_animation, ":agent_catched_agent_no", "anim_catched_by_agent"),
(try_begin),
(neq, ":agent_hook_string_instance_no", -1),
(agent_get_bone_position, pos4, ":agent_no", 18, 1),
(call_script, "script_set_hook_string_position", ":agent_hook_string_instance_no", pos2, pos4),
(try_end),
]),
# script_unequip_catch_agent_hook_weapon
# Input: catch_agent_no, catched_agent_no
# Output: none
("unequip_catch_agent_hook_weapon", [
(store_script_param_1, ":catch_agent_no"),
(store_script_param_2, ":catched_agent_no"),
(agent_get_slot, ":agent_hook_string_instance_no", ":catched_agent_no", slot_agent_hook_string_instance_no),
(neq, ":catch_agent_no", -1),
(neq, ":catched_agent_no", -1),
(neq, ":agent_hook_string_instance_no", -1),
(try_begin),
(agent_is_alive, ":catched_agent_no"),
(agent_is_human, ":catched_agent_no"),
(agent_set_animation, ":catched_agent_no", "anim_jump_from_tank"),
(try_end),
(scene_prop_fade_out, ":agent_hook_string_instance_no", 100),
(agent_set_slot, ":catched_agent_no", slot_agent_catch_agent_no, -1),
(agent_set_slot, ":catched_agent_no", slot_agent_hook_string_instance_no, -1),
(agent_get_slot, ":agent_catched_agent_num", ":catch_agent_no", slot_agent_catched_agent_num),
(val_sub, ":agent_catched_agent_num", 1),
(agent_set_slot, ":catch_agent_no", slot_agent_catched_agent_num, ":agent_catched_agent_num"),
]),
# script_unequip_hook_weapon
# Input: arg1 agent_no
# Output: none
("unequip_hook_weapon", [
(store_script_param_1, ":agent_no"),
(agent_set_no_dynamics, ":agent_no", 0),
(agent_get_slot, ":agent_hook_instance_no", ":agent_no", slot_agent_hook_instance_no),
(agent_get_slot, ":agent_hook_string_instance_no", ":agent_no", slot_agent_hook_string_instance_no),
(scene_prop_fade_out, ":agent_hook_instance_no", 100),
(scene_prop_fade_out, ":agent_hook_string_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_set_animation, ":agent_no", "anim_jump_from_tank"),
(agent_equip_item, ":agent_no", "itm_p_song_weapon_5"),
]),