自己制作的载具坦克效果展示:
一、制作过程的经验:
1.场景道具千万不要之间使用openBrf生成的碰撞体,复杂面数很高的模型很有可能碰到agent之间闪退,最好直接使用简单立体几何!!!
二、目前缺陷:
1.没有漂移。
2.没有制作瞄准界面,与优化瞄准方面的代码,目前瞄准全部凭手感。
3.未编写普通agent的AI后续尝试一下,兴许能实现一个简单的坦克大战。
三、代码
1.module_scripts
- #车辆载具代码-开始#
- ("cf_cast_ray_pos_is_terrain", [
-
- (store_script_param, ":ray_position_register", 1),
- (store_script_param, ":ray_length_fixed_point", 2),
-
- (cast_ray, ":hit_position_register", pos51, ":ray_position_register",":ray_length_fixed_point"),
- (assign,reg62,":hit_position_register"),
- #(particle_system_burst,"psys_torch_fire_big",pos51,100),
- #(display_message,"@D cast_ray test {reg62}"),
- (assign,reg63,1),
-
- #碰撞地方为地板则允许前进
- (try_begin),
- (le,":hit_position_register",-1),
- (position_get_distance_to_terrain,":distance_to_terrain",pos51),
- (le,":distance_to_terrain",100),
- (assign,reg63,0),
- (try_end),
- ]),
-
- ("clear_pos_around_x", [
-
- (store_script_param, ":position_register", 1),
-
- (position_get_rotation_around_x,":around_x",":position_register"),
- (assign,reg62,":around_x"),
- #(display_message,"@around_x {reg62}"),
-
- #保证绕X轴的数据是0
- (try_begin),
- (is_between,":around_x",181,360),
- (val_sub,":around_x",360),
- (try_end),
-
- (try_begin),
- (neq,":around_x",0),
- (val_mul,":around_x",-1),
- (position_rotate_x,":position_register",":around_x"),
- (try_end),
-
-
- #(try_begin),
- #(gt,":around_x",0),
- #(val_mul,":around_x",-1),
- #(position_rotate_x,":position_register",":around_x"),
- #(else_try),
- #(lt,":around_x",0),
- #(val_mul,":around_x",-1),
- #(position_rotate_x,":position_register",":around_x"),
- #(try_end),
- ]),
-
- ("clear_pos_around_y", [
-
- (store_script_param, ":position_register", 1),
-
- (position_get_rotation_around_y,":around_y",":position_register"),
-
- #保证绕X轴的数据是0
- (try_begin),
- (is_between,":around_y",181,360),
- (val_sub,":around_y",360),
- (try_end),
-
- (try_begin),
- (neq,":around_y",0),
- (val_mul,":around_y",-1),
- (position_rotate_y,":position_register",":around_y"),
- (try_end),
- ]),
-
- ("clear_pos_around_z", [
-
- (store_script_param, ":position_register", 1),
-
- (position_get_rotation_around_z,":around_z",":position_register"),
-
- #保证绕X轴的数据是0
- (try_begin),
- (is_between,":around_z",181,360),
- (val_sub,":around_z",360),
- (try_end),
-
- (try_begin),
- (neq,":around_z",0),
- (val_mul,":around_z",-1),
- (position_rotate_z,":position_register",":around_z"),
- (try_end),
- ]),
-
- ("set_pos_around_x", [
-
- (store_script_param, ":position_register", 1),
- (store_script_param, ":target_around_x", 2),
-
- (call_script,"script_clear_pos_around_x",":position_register"),
- (position_rotate_x,":position_register",":target_around_x"),
- ]),
-
- ("set_pos_around_y", [
-
- (store_script_param, ":position_register", 1),
- (store_script_param, ":target_around_y", 2),
-
- (call_script,"script_clear_pos_around_y",":position_register"),
- (position_rotate_y,":position_register",":target_around_y"),
- ]),
-
- ("set_pos_around_z", [
-
- (store_script_param, ":position_register", 1),
- (store_script_param, ":target_around_z", 2),
-
- (call_script,"script_clear_pos_around_z",":position_register"),
- (position_rotate_z,":position_register",":target_around_z"),
- ]),
-
-
-
- ("set_pos_around_z", [
-
- (store_script_param, ":position_register", 1),
- (store_script_param, ":target_around_z", 2),
-
- (call_script,"script_clear_pos_around_z",":position_register"),
- (position_rotate_z,":position_register",":target_around_z"),
- ]),
-
-
- #车辆X轴与Y轴处理 使用61和62位置寄存器,参数1进入的位置寄存器,参数2车辆的速度
- ("set_vehicle_X_and_Y_axis_processing", [
-
- (store_script_param, ":pos", 1),
- (store_script_param, ":animation_speed", 2),
- (store_script_param, ":rotate_z", 3),
-
- #车头车位角度
- (assign,":rotate_x",0),
- (try_begin),
- (neq|this_or_next,":animation_speed",0),
- (neq,":rotate_z",0),
- (copy_position,pos61,":pos"),
- (copy_position,pos32,":pos"),
- (position_move_y,pos61,350), #pos61 前移350厘米(y轴)
- (position_move_y,pos62,-350), #pos62 后移350厘米(y轴)
- (position_set_z_to_ground_level, pos61), #取 pos61 地面海拔(z轴)
- (position_set_z_to_ground_level, pos62), #取 pos62 地面海拔(z轴)
- (position_get_z,":z_front",pos61), #获取 pos61 地面海拔(z轴),存 变量 z_front
- (position_get_z,":z_behind",pos62), #获取 pos62 地面海拔(z轴),存 变量 z_behind
- (store_sub,":z_sub",":z_front", ":z_behind"), #获取高度差(z_front 与 z_behind 相减)
- (assign,reg62,":z_sub"),
- (assign,reg63,":z_front"),
- (assign,reg60,":z_behind"),
- #(display_message,"@z_sub {reg62},z_front{reg63},z_behind{reg60}"),
- #得到新的around_x角度
- (store_atan2,":atan2",":z_sub",700),
- (assign,reg62,":atan2"),
- #(display_message,"@atan2 {reg62}"),
- (val_div,":atan2",100),
- (assign,":rotate_x",":atan2"),
- (assign,reg62,":rotate_x"),
- #(display_message,"@rotate_x {reg62}"),
- (call_script,"script_set_pos_around_x",":pos",":rotate_x"),
- (try_end),
-
- #车身左右倾斜角度
- (assign,":rotate_y",0),
- (try_begin),
- (neq|this_or_next,":animation_speed",0),
- (neq,":rotate_z",0),
- (copy_position,pos61,":pos"),
- (copy_position,pos62,":pos"),
- (position_move_x,pos61,250), #right
- (position_move_x,pos62,-250), #left
- (position_set_z_to_ground_level, pos61), #取 pos61 地面海拔(z轴)
- (position_set_z_to_ground_level, pos62), #取 pos62 地面海拔(z轴)
- (position_get_z,":z_right",pos61),
- (position_get_z,":z_left",pos62),
- (store_sub,":z_sub",":z_right", ":z_left"),
- (assign,reg62,":z_sub"),
- (assign,reg63,":z_right"),
- (assign,reg60,":z_left"),
- #(display_message,"@z_sub {reg62},z_right{reg63},z_left{reg60}"),
- #得到新的around_x角度
- (store_atan2,":atan2",":z_sub",500),
- (assign,reg62,":atan2"),
- #(display_message,"@atan2 z_right z_left{reg62}"),
- (val_div,":atan2",100),
- (assign,":rotate_y",":atan2"),
- (val_mul,":rotate_y",-1),
- (assign,reg62,":rotate_y"),
- #(display_message,"@rotate_y {reg62}"),
- (call_script,"script_set_pos_around_y",":pos",":rotate_y"),
- (try_end),
-
- (position_set_z_to_ground_level, ":pos"),
-
- ]),
- #车辆载具代码-结束#
-
复制代码 2.module_scene_props
-
- #坦克代码测试
- ("abrams_turret",sokf_moveable,"abramsTurret","bo_abramsTurret",
- []),
- #X -0.2695 Y 2.7818 Z 1.3670
- ("abrams_gun",sokf_moveable,"abramsGun","0",
- []),
- ("abrams_chassis",sokf_moveable|sokf_destructible|spr_use_time(1),"abramsChassis","bo_abramsChassis",
- [
- (ti_on_init_scene_prop,
- [
- ]),
-
- (ti_on_scene_prop_start_use,
- [
- (store_trigger_param_2,":sprop_instance"),
- (prop_instance_deform_in_range,":sprop_instance",10,20,1000),
- ]),
-
- # ti_on_scene_prop_use = -44.0 #can only be used in module_scene_props triggers
- # Trigger Param 1: user agent id
- # Trigger Param 2: prop instance number
- (ti_on_scene_prop_use,
- [
- (store_trigger_param_1,":use_agent"),
- (store_trigger_param_2, ":sprop_instance"),
-
- (gt,":use_agent",0),
- (agent_is_alive,":use_agent"),
- (prop_instance_get_position,pos30,":sprop_instance"),
- (scene_prop_set_slot,":sprop_instance",scene_prop_slot_use_agent,":use_agent"),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_animation_speed,0),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly,0),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,0),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_cnt_time,0),
- (scene_prop_set_slot, ":sprop_instance",scene_prop_slot_opnen_fire_cnt_time,0),
- (agent_set_speed_modifier,":use_agent",0),
- (agent_set_visibility,":use_agent",0),
- (agent_set_no_dynamics,":use_agent",1),#set no dynamics
- (agent_set_slot, ":use_agent", slot_agent_driving_vehicle, ":sprop_instance"),
- #(agent_set_wielded_item,":use_agent",-1),
- #(mission_cam_set_mode,1,0,0),
- (agent_set_position,":use_agent",pos30),
- (prop_instance_animate_to_position,":sprop_instance",pos30,10),
- (play_sound_at_position, "snd_tank_init", pos30),
-
- ]),
-
- #ti_on_scene_prop_animation_finished
- (ti_on_scene_prop_animation_finished,
- [
- (set_fixed_point_multiplier, 100),
-
- (store_trigger_param_1, ":sprop_instance"),
- (init_position,pos30),
- (prop_instance_get_position, pos30, ":sprop_instance"),
- (copy_position,pos40,pos30),#旧的位置
- (copy_position,pos41,pos30),#旧的位置
- (scene_prop_get_slot, ":use_agent", ":sprop_instance", scene_prop_slot_use_agent),
- (scene_prop_get_slot, ":sprop_instance_turret", ":sprop_instance", scene_prop_slot_turret),
- (scene_prop_get_slot, ":sprop_instance_gun", ":sprop_instance", scene_prop_slot_gun),
-
- (try_begin),
- (gt,":use_agent",0),
- (key_is_down,key_g),
- (agent_set_speed_modifier,":use_agent",100),
- (agent_set_visibility,":use_agent",1),
- (agent_set_no_dynamics,":use_agent",0),#set no dynamics
- (position_move_z,pos30,300),
- (position_set_z_to_ground_level,pos30),
- (agent_set_position,":use_agent",pos30),
- (agent_set_slot, ":use_agent", slot_agent_driving_vehicle,-1),
- (assign,":use_agent",-1),
- (scene_prop_set_slot,":sprop_instance",scene_prop_slot_use_agent,":use_agent"),
- (try_end),
-
- (gt,":use_agent",0),
- (agent_set_wielded_item, ":use_agent", -1),
- (agent_is_alive,":use_agent"),
- (agent_is_human,":use_agent"),
-
- (assign,":no_can_animation_forward",0),
- (assign,":no_can_animation_backward",0),
- (assign,":no_can_animation_left",0),
- (assign,":no_can_animation_right",0),
-
- #障碍判断开始
- (try_begin),
- (copy_position,pos50,pos41),
- (position_move_y,pos50,550),
- (position_move_x,pos50,250),
- (position_move_z,pos50,120),
- (position_rotate_z,pos50,90),
- #(particle_system_burst,"psys_torch_fire_big",pos50,5),
- (call_script,"script_cf_cast_ray_pos_is_terrain",pos50,300),
- (assign,":no_can_animation_forward",reg63),
- (try_end),
-
- (try_begin),
- (copy_position,pos50,pos41),
- (position_move_y,pos50,-550),
- (position_move_x,pos50,250),
- (position_move_z,pos50,120),
- (position_rotate_z,pos50,90),
- #(particle_system_burst,"psys_torch_fire_big",pos50,5),
- (call_script,"script_cf_cast_ray_pos_is_terrain",pos50,300),
- (assign,":no_can_animation_backward",reg63),
- (try_end),
-
-
- #障碍判断右部分
- (try_begin),
- (copy_position,pos50,pos41),
- (position_move_y,pos50,-500),
- (position_move_x,pos50,250),
- (position_move_z,pos50,90),
- #(particle_system_burst,"psys_torch_fire_big",pos50,5),
- (call_script,"script_cf_cast_ray_pos_is_terrain",pos50,700),
- (assign,":no_can_animation_right",reg63),
- (try_end),
-
- #障碍判断左部分
- (try_begin),
- (copy_position,pos50,pos41),
- (position_move_y,pos50,-500),
- (position_move_x,pos50,-250),
- (position_move_z,pos50,90),
- #(particle_system_burst,"psys_torch_fire_big",pos50,5),
- (call_script,"script_cf_cast_ray_pos_is_terrain",pos50,700),
- (assign,":no_can_animation_left",reg63),
- (try_end),
-
- (scene_prop_get_slot, ":animation_speed", ":sprop_instance", scene_prop_slot_animation_speed),
- (scene_prop_get_slot, ":is_fly", ":sprop_instance", scene_prop_slot_is_fly),
-
- (try_begin),
- (le, ":is_fly",0),
- #地盘运动处理速度
- (try_begin),
- (game_key_is_down,gk_move_forward),
- (assign,":forward_speed",2),
- (try_begin),
- (lt,":animation_speed",0),
- (store_div,":forward_speed",":animation_speed",5),
- (val_mul,":forward_speed",-1),
- (try_end),
- (val_max,":forward_speed",2),
- (val_add,":animation_speed",":forward_speed"),
- (val_min,":animation_speed",18),
- (else_try),
- (eq,":no_can_animation_backward",0),
- (game_key_is_down,gk_move_backward),
- (assign,":backward_speed",1),
- (try_begin),
- (gt,":animation_speed",0),
- (store_div,":backward_speed",":animation_speed",5),
- (val_mul,":forward_speed",1),
- (try_end),
- (val_max,":backward_speed",1),
- (val_sub,":animation_speed",":backward_speed"),
- (val_max,":animation_speed",-18),
- (try_end),
- (try_begin),
- (eq,":no_can_animation_forward",1),
- (gt,":animation_speed",0),
- (assign,":animation_speed",0),
- (else_try),
- (eq,":no_can_animation_backward",1),
- (lt,":animation_speed",0),
- (assign,":animation_speed",0),
- (try_end),
-
- (assign,":animation_speed_abs",":animation_speed"),
- (val_abs,":animation_speed_abs"),
- (assign,":rotate_z",0),
- (try_begin),
- (game_key_is_down,gk_move_right),
- (store_div,":rotate_z",":animation_speed_abs",10),
- (val_max,":rotate_z",1),
- (val_mul,":rotate_z",-1),
- (else_try),
- (game_key_is_down,gk_move_left),
- (store_div,":rotate_z",":animation_speed_abs",10),
- (val_max,":rotate_z",1),
- (val_mul,":rotate_z",1),
- (try_end),
-
-
- (try_begin),
- (eq,":no_can_animation_left",1),
- (gt,":rotate_z",0),
- (assign,":rotate_z",0),
- (else_try),
- (eq,":no_can_animation_right",1),
- (lt,":rotate_z",0),
- (assign,":rotate_z",0),
- (try_end),
-
- #刹车
- (try_begin),
- (game_key_is_down|this_or_next,gk_jump),
- (game_key_clicked,gk_jump),
- #刹车音效
- (try_begin),
- (ge|this_or_next,":animation_speed",3),
- (le,":animation_speed",-3),
- (play_sound_at_position, "snd_car_brake", pos30),
- (try_end),
-
- (assign,":animation_speed",0),
- (assign,":rotate_z",0),
- (try_end),
-
- (position_move_y,pos30,":animation_speed"),
- (position_rotate_z,pos30,":rotate_z"),
-
-
- (try_end),
-
- #正常运行记录,仅仅是为了播放音效!
- (scene_prop_get_slot, ":animation_normal_cnt", ":sprop_instance", scene_prop_slot_is_animation_normal_cnt),
- #进入飞车判断
- (copy_position,pos31,pos30),
- (try_begin),
- (ge, ":is_fly",1),
- (scene_prop_get_slot, ":fly_sub_speed", ":sprop_instance", scene_prop_slot_is_fly_sub_speed),
- (val_add, ":fly_sub_speed",1),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,":fly_sub_speed"),
-
- (scene_prop_get_slot, ":fly_cnt_time", ":sprop_instance", scene_prop_slot_is_fly_cnt_time),
- (val_add, ":fly_cnt_time",1),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_cnt_time,":fly_cnt_time"),
-
- (try_begin), #起飞状态中
- (ge,":fly_sub_speed",10),
- #简单的模拟空气时候飞行阻力减速
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,0),
- (try_begin),
- (neq,":animation_speed",0),
- (store_div,":speed_temp",":animation_speed",10),
- (ge,":speed_temp",0),
- (val_max,":speed_temp",1),
- (val_sub,":animation_speed",":speed_temp"),
- (val_max,":animation_speed",0),
- (else_try),
- (neq,":animation_speed",0),
- (store_div,":speed_temp",":animation_speed",10),
- (lt,":speed_temp",0),
- (val_min,":speed_temp",-1),
- (val_sub,":animation_speed",":speed_temp"),
- (val_max,":animation_speed",0),
- (try_end),
- (try_end),
-
- (position_move_y,pos31,":animation_speed"),
- (store_div,":t_seconds",":fly_cnt_time",100),#处于100得到运行了多少秒
- (assign,reg62,":t_seconds"),
- #(display_message,"@t_seconds{reg62}"),
- (assign,":move_z",0),
- #s(t) = 0.5 * g * t^2 g取 通过求2s和1s的之间的新加距离求1s到2s的平均速度来做Z轴移动,其实可以用v = gt的瞬时速度公式来求更方便!!!
- (store_mul,":t_store_pow",":t_seconds",":t_seconds"),
- (store_mul,":space_move_z",":t_store_pow",490),
- (assign,reg62,":space_move_z"),
- #(display_message,"@space_move_z{reg62}"),
- (store_add,":t_seconds_next",":t_seconds",1),
- (store_mul,":t_store_pow_next",":t_seconds_next",":t_seconds_next"),
- (store_mul,":space_move_z_next",":t_store_pow_next",490),
- (assign,reg62,":t_store_pow_next"),
- #(display_message,"@t_store_pow_next{reg62}"),
- (assign,reg62,":space_move_z_next"),
- #(display_message,"@space_move_z_next{reg62}"),
- (store_sub,":space_move_z_error",":space_move_z_next",":space_move_z"),
- (assign,reg62,":space_move_z_error"),
- #(display_message,"@space_move_z_error{reg62}"),
- (store_div,":move_z",":space_move_z_error",100),#因为是1/100秒运行一次所以处于100
- (val_mul,":move_z",-1),
- (assign,reg62,":move_z"),
- #(display_message,"@move_z{reg62}"),
- (assign,reg62,":fly_cnt_time"),
- #(display_message,"@fly_cnt_time{reg62}"),
- (position_move_z,pos31,":move_z"),
- (position_get_distance_to_ground_level,":ground_level",pos31),
- (try_begin),
- (le,":ground_level",25),
- #(display_message,"@car exit fly"),
- (position_move_y,pos31,100),
- (call_script,"script_set_vehicle_X_and_Y_axis_processing",pos31,":animation_speed",":rotate_z"),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly,0),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,0),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_cnt_time,0),
- (play_sound_at_position, "snd_boulder_falls", pos31),
- (else_try),
- #(display_message,"@car is fly"),
- (try_end),
- (prop_instance_animate_to_position,":sprop_instance",pos31,1),
- (assign,":animation_normal_cnt",0),
- (else_try),#进入起飞状态
- (neq,":animation_speed",0),
- (gt|this_or_next,":animation_speed",10),
- (lt,":animation_speed",-10),
- (le, ":is_fly",0),
- (try_begin),
- (gt,":animation_speed",0),
- (position_move_y,pos31,350),
- (else_try),
- (position_move_y,pos31,-350),
- (try_end),
-
- (position_get_distance_to_ground_level,":ground_level",pos31),
- (ge,":ground_level",150),
- (prop_instance_animate_to_position,":sprop_instance",pos31,1),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly,1),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,0),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_cnt_time,0),
- (assign,":animation_normal_cnt",0),
- #(display_message,"@car start fly"),
- (else_try),#正常状态
- (le, ":is_fly",0),
- (call_script,"script_set_vehicle_X_and_Y_axis_processing",pos30,":animation_speed",":rotate_z"),
- (prop_instance_animate_to_position,":sprop_instance",pos30,1),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly,0),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,0),
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_cnt_time,0),
-
- #播放音效开始!
- (try_begin),
- (eq,":animation_normal_cnt",0),
- (ge|this_or_next,":animation_speed",3),
- (le|this_or_next,":animation_speed",-3),
- (neq,":rotate_z",0),
- (try_begin),
- (neq,":rotate_z",0),
- (play_sound_at_position, "snd_tank_2", pos30),
- (else_try),
- (play_sound_at_position, "snd_tank_1", pos30),
- (try_end),
- (try_end),
- (val_add,":animation_normal_cnt",1),
- (try_begin),
- (ge,":animation_normal_cnt",80),
- (assign,":animation_normal_cnt",0),
- (try_end),
- #播放音效结束!
-
- #(display_message,"@car no fly"),
- #泥土飞扬的效果
- (try_begin),
- (ge|this_or_next,":animation_speed",3),
- (le|this_or_next,":animation_speed",-3),
- (neq,":rotate_z",0),
- (copy_position,pos31,pos30),
-
- (try_begin),
- (ge,":animation_speed",3),
- (position_move_y,pos31,-325),
- (else_try),
- (position_move_y,pos31,325),
- (try_end),
- (position_move_x,pos31,200),
- (particle_system_burst,"psys_game_hoof_dust_big",pos31,1),
- (particle_system_burst,"psys_game_hoof_dust_mud_big",pos31,1),
- (position_move_x,pos31,-400),
- (particle_system_burst,"psys_game_hoof_dust_big",pos31,1),
- (particle_system_burst,"psys_game_hoof_dust_mud_big",pos31,1),
- (try_end),
- (try_end),
-
- (scene_prop_set_slot,":sprop_instance", scene_prop_slot_animation_speed,":animation_speed"),
- (scene_prop_set_slot, ":sprop_instance", scene_prop_slot_is_animation_normal_cnt,":animation_normal_cnt"),
- (copy_position,pos31,pos30),
- #玩家视角处理,主要是后续坦克炮台和炮管的around_z around_x处理
- (agent_get_look_position,pos20,":use_agent"),
- (position_get_rotation_around_z,":around_z",pos20),
- (position_get_rotation_around_x,":around_x",pos20),
- (try_begin),
- (is_between,":around_x",180,360),
- (val_sub,":around_x",360),
- (try_end),
- (try_begin),
- (gt,":around_x",30),
- (val_sub,":around_x",30),
- (val_mul,":around_x",-1),
- (position_rotate_x,pos20,":around_x"),
- (else_try),
- (lt,":around_x",-10),
- (val_add,":around_x",-10),
- (val_mul,":around_x",-1),
- (position_rotate_x,pos20,":around_x"),
- (try_end),
- (position_get_rotation_around_x,":around_x",pos20),
-
- #炮塔运动处理
- (assign,":move_x",0),
- (assign,":move_y",0),
- (assign,":move_z",135),
- (position_move_x, pos31, ":move_x"),
- (position_move_y, pos31, ":move_y"),
- (position_move_z, pos31, ":move_z"),
- (call_script,"script_set_pos_around_z",pos31,":around_z"),
- (prop_instance_animate_to_position,":sprop_instance_turret",pos31,1),
- (copy_position,pos32,pos31),
-
- #炮管运动处理 炮管直接在炮塔上进行处理
- (assign,":move_x",2.5),
- (assign,":move_y",190),
- (assign,":move_z",0),
- (position_move_x, pos32, ":move_x"),
- (position_move_y, pos32, ":move_y"),
- (position_move_z, pos32, ":move_z"),
- (call_script,"script_set_pos_around_x",pos32,":around_x"),
- (prop_instance_animate_to_position,":sprop_instance_gun",pos32,1),
- #开炮设置开始
- (copy_position,pos33,pos32),
- (scene_prop_get_slot, ":opnen_fire_cnt_time", ":sprop_instance", scene_prop_slot_opnen_fire_cnt_time),
- (try_begin),
- (eq,":opnen_fire_cnt_time",0),
- (game_key_is_down|this_or_next,gk_attack),
- (game_key_clicked,gk_attack),
- (assign,":opnen_fire_cnt_time",250),
- (position_move_y, pos33, 380),
- (add_missile, ":use_agent", pos33, 50000, "itm_gun_tank", 0, "itm_tank_shell", 0),
- (particle_system_burst, "psys_pistol_smoke_big_a", pos33,25),
- (particle_system_burst,"psys_torch_fire_big_a",pos33,10),
- (play_sound_at_position,"snd_tank_fire_3",pos33,0),
- (else_try),
- (gt,":opnen_fire_cnt_time",0),
- (val_sub,":opnen_fire_cnt_time",1),
- (try_end),
- (scene_prop_set_slot, ":sprop_instance", scene_prop_slot_opnen_fire_cnt_time,":opnen_fire_cnt_time"),
- #开炮设置结束
-
-
-
- #玩家移动处理
- (agent_set_position,":use_agent",pos40),
- (agent_get_look_position,pos41,":use_agent"),
- (position_copy_rotation,pos40,pos41),
- #(agent_set_animation, ":use_agent", "anim_ready_bow_arts"),
- #摄像头处理
- (position_move_y,pos40,-1000),
- (position_move_z,pos40,700),
- (position_rotate_x,pos40,-10),
- (mission_cam_animate_to_position,pos40,1,0),
- ]),
-
- ]),
复制代码 3.其余部分省略
核心代码都在上面了,其余代码只是功能补充,完整代码放在我的MOD里面,想体验就来找我要新版本MOD吧
|