骑马与砍杀中文站论坛

 找回密码
 注册(Register!)

QQ登录

只需一步,快速开始

搜索
购买CDKEY 小黑盒加速器
查看: 3544|回复: 12

[功能与代码] 自己制作的载具坦克

[复制链接]

16

主题

107

回帖

197

积分

见习骑士

Rank: 3

UID
3304622
第纳尔
690
精华
0
互助
26
荣誉
3
贡献
0
魅力
158
注册时间
2021-12-28
鲜花(31) 鸡蛋(0)
发表于 2024-3-10 23:28:58 | 显示全部楼层 |阅读模式
自己制作的载具坦克效果展示:


一、制作过程的经验:
1.场景道具千万不要之间使用openBrf生成的碰撞体,复杂面数很高的模型很有可能碰到agent之间闪退,最好直接使用简单立体几何!!!

二、目前缺陷:
1.没有漂移。
2.没有制作瞄准界面,与优化瞄准方面的代码,目前瞄准全部凭手感。
3.未编写普通agent的AI后续尝试一下,兴许能实现一个简单的坦克大战。

三、代码
1.module_scripts
  1. #车辆载具代码-开始#
  2. ("cf_cast_ray_pos_is_terrain", [
  3.   
  4.     (store_script_param, ":ray_position_register", 1),
  5.     (store_script_param, ":ray_length_fixed_point", 2),
  6.    
  7.     (cast_ray, ":hit_position_register", pos51, ":ray_position_register",":ray_length_fixed_point"),
  8.     (assign,reg62,":hit_position_register"),
  9.     #(particle_system_burst,"psys_torch_fire_big",pos51,100),
  10.     #(display_message,"@D cast_ray test {reg62}"),
  11.     (assign,reg63,1),
  12.         
  13.     #碰撞地方为地板则允许前进
  14.     (try_begin),
  15.        (le,":hit_position_register",-1),
  16.        (position_get_distance_to_terrain,":distance_to_terrain",pos51),
  17.        (le,":distance_to_terrain",100),
  18.        (assign,reg63,0),
  19.    (try_end),


  20.   ]),
  21.   
  22.   ("clear_pos_around_x", [
  23.   
  24.    (store_script_param, ":position_register", 1),
  25.    
  26.    (position_get_rotation_around_x,":around_x",":position_register"),
  27.    (assign,reg62,":around_x"),
  28.    #(display_message,"@around_x {reg62}"),
  29.             
  30.    #保证绕X轴的数据是0
  31.    (try_begin),  
  32.         (is_between,":around_x",181,360),
  33.         (val_sub,":around_x",360),
  34.    (try_end),  
  35.    
  36.    (try_begin),  
  37.         (neq,":around_x",0),
  38.         (val_mul,":around_x",-1),
  39.         (position_rotate_x,":position_register",":around_x"),     
  40.    (try_end),
  41.    
  42.       
  43.    #(try_begin),  
  44.         #(gt,":around_x",0),
  45.         #(val_mul,":around_x",-1),
  46.         #(position_rotate_x,":position_register",":around_x"),     
  47.    #(else_try),
  48.         #(lt,":around_x",0),
  49.         #(val_mul,":around_x",-1),
  50.         #(position_rotate_x,":position_register",":around_x"),   
  51.    #(try_end),

  52.   ]),
  53.   
  54.   ("clear_pos_around_y", [
  55.   
  56.    (store_script_param, ":position_register", 1),
  57.    
  58.    (position_get_rotation_around_y,":around_y",":position_register"),
  59.      
  60.    #保证绕X轴的数据是0
  61.    (try_begin),  
  62.         (is_between,":around_y",181,360),
  63.         (val_sub,":around_y",360),
  64.    (try_end),  
  65.    
  66.    (try_begin),  
  67.         (neq,":around_y",0),
  68.         (val_mul,":around_y",-1),
  69.         (position_rotate_y,":position_register",":around_y"),     
  70.    (try_end),

  71.   ]),
  72.   
  73.   ("clear_pos_around_z", [
  74.   
  75.    (store_script_param, ":position_register", 1),
  76.    
  77.    (position_get_rotation_around_z,":around_z",":position_register"),
  78.      
  79.    #保证绕X轴的数据是0
  80.    (try_begin),  
  81.         (is_between,":around_z",181,360),
  82.         (val_sub,":around_z",360),
  83.    (try_end),  
  84.    
  85.    (try_begin),  
  86.         (neq,":around_z",0),
  87.         (val_mul,":around_z",-1),
  88.         (position_rotate_z,":position_register",":around_z"),     
  89.    (try_end),

  90.   ]),
  91.   
  92. ("set_pos_around_x", [
  93.   
  94.     (store_script_param, ":position_register", 1),
  95.     (store_script_param, ":target_around_x", 2),
  96.    
  97.     (call_script,"script_clear_pos_around_x",":position_register"),
  98.     (position_rotate_x,":position_register",":target_around_x"),

  99.   ]),
  100.   
  101.   ("set_pos_around_y", [
  102.   
  103.     (store_script_param, ":position_register", 1),
  104.     (store_script_param, ":target_around_y", 2),
  105.    
  106.     (call_script,"script_clear_pos_around_y",":position_register"),
  107.     (position_rotate_y,":position_register",":target_around_y"),

  108. ]),
  109.   
  110. ("set_pos_around_z", [
  111.   
  112.     (store_script_param, ":position_register", 1),
  113.     (store_script_param, ":target_around_z", 2),
  114.    
  115.     (call_script,"script_clear_pos_around_z",":position_register"),
  116.     (position_rotate_z,":position_register",":target_around_z"),

  117.   ]),
  118.   
  119.   
  120.    
  121. ("set_pos_around_z", [
  122.   
  123.     (store_script_param, ":position_register", 1),
  124.     (store_script_param, ":target_around_z", 2),
  125.    
  126.     (call_script,"script_clear_pos_around_z",":position_register"),
  127.     (position_rotate_z,":position_register",":target_around_z"),

  128.   ]),
  129.   
  130.   
  131. #车辆X轴与Y轴处理 使用61和62位置寄存器,参数1进入的位置寄存器,参数2车辆的速度
  132. ("set_vehicle_X_and_Y_axis_processing", [
  133.   
  134.     (store_script_param, ":pos", 1),
  135.     (store_script_param, ":animation_speed", 2),
  136.     (store_script_param, ":rotate_z", 3),
  137.    

  138.     #车头车位角度
  139.     (assign,":rotate_x",0),
  140.     (try_begin),
  141.         (neq|this_or_next,":animation_speed",0),
  142.         (neq,":rotate_z",0),
  143.         (copy_position,pos61,":pos"),
  144.         (copy_position,pos32,":pos"),
  145.         (position_move_y,pos61,350),                  #pos61 前移350厘米(y轴)
  146.         (position_move_y,pos62,-350),                 #pos62 后移350厘米(y轴)
  147.         (position_set_z_to_ground_level, pos61),  #取 pos61 地面海拔(z轴)
  148.         (position_set_z_to_ground_level, pos62),  #取 pos62 地面海拔(z轴)
  149.         (position_get_z,":z_front",pos61),             #获取 pos61 地面海拔(z轴),存 变量 z_front
  150.         (position_get_z,":z_behind",pos62),          #获取 pos62 地面海拔(z轴),存 变量 z_behind
  151.         (store_sub,":z_sub",":z_front", ":z_behind"),           #获取高度差(z_front 与 z_behind 相减)
  152.         (assign,reg62,":z_sub"),
  153.         (assign,reg63,":z_front"),
  154.         (assign,reg60,":z_behind"),
  155.         #(display_message,"@z_sub {reg62},z_front{reg63},z_behind{reg60}"),
  156.         #得到新的around_x角度   
  157.         (store_atan2,":atan2",":z_sub",700),
  158.         (assign,reg62,":atan2"),
  159.         #(display_message,"@atan2 {reg62}"),
  160.         (val_div,":atan2",100),
  161.         (assign,":rotate_x",":atan2"),
  162.         (assign,reg62,":rotate_x"),
  163.         #(display_message,"@rotate_x {reg62}"),
  164.         (call_script,"script_set_pos_around_x",":pos",":rotate_x"),
  165.     (try_end),
  166.    
  167.     #车身左右倾斜角度
  168.     (assign,":rotate_y",0),
  169.     (try_begin),
  170.         (neq|this_or_next,":animation_speed",0),
  171.         (neq,":rotate_z",0),
  172.         (copy_position,pos61,":pos"),
  173.         (copy_position,pos62,":pos"),
  174.         (position_move_x,pos61,250), #right              
  175.         (position_move_x,pos62,-250), #left               
  176.         (position_set_z_to_ground_level, pos61),  #取 pos61 地面海拔(z轴)
  177.         (position_set_z_to_ground_level, pos62),  #取 pos62 地面海拔(z轴)
  178.         (position_get_z,":z_right",pos61),            
  179.         (position_get_z,":z_left",pos62),         
  180.         (store_sub,":z_sub",":z_right", ":z_left"),         
  181.         (assign,reg62,":z_sub"),
  182.         (assign,reg63,":z_right"),
  183.         (assign,reg60,":z_left"),
  184.         #(display_message,"@z_sub {reg62},z_right{reg63},z_left{reg60}"),
  185.         #得到新的around_x角度   
  186.         (store_atan2,":atan2",":z_sub",500),
  187.         (assign,reg62,":atan2"),
  188.         #(display_message,"@atan2 z_right z_left{reg62}"),
  189.         (val_div,":atan2",100),
  190.         (assign,":rotate_y",":atan2"),
  191.         (val_mul,":rotate_y",-1),
  192.         (assign,reg62,":rotate_y"),
  193.         #(display_message,"@rotate_y {reg62}"),
  194.         (call_script,"script_set_pos_around_y",":pos",":rotate_y"),
  195.     (try_end),
  196.    
  197.     (position_set_z_to_ground_level, ":pos"),
  198.    
  199.   ]),
  200. #车辆载具代码-结束#
  201.   
复制代码
2.module_scene_props
  1.   
  2. #坦克代码测试
  3. ("abrams_turret",sokf_moveable,"abramsTurret","bo_abramsTurret",
  4. []),
  5. #X -0.2695 Y 2.7818 Z 1.3670
  6. ("abrams_gun",sokf_moveable,"abramsGun","0",
  7. []),
  8. ("abrams_chassis",sokf_moveable|sokf_destructible|spr_use_time(1),"abramsChassis","bo_abramsChassis",
  9. [
  10.   (ti_on_init_scene_prop,
  11.   [
  12.   ]),
  13.   
  14.   (ti_on_scene_prop_start_use,
  15.   [
  16.     (store_trigger_param_2,":sprop_instance"),
  17.     (prop_instance_deform_in_range,":sprop_instance",10,20,1000),

  18.    ]),
  19.   
  20. # ti_on_scene_prop_use     = -44.0 #can only be used in module_scene_props triggers
  21. # Trigger Param 1: user agent id
  22. # Trigger Param 2: prop instance number
  23.    (ti_on_scene_prop_use,
  24.     [
  25.         (store_trigger_param_1,":use_agent"),
  26.         (store_trigger_param_2, ":sprop_instance"),
  27.    
  28.         (gt,":use_agent",0),
  29.         (agent_is_alive,":use_agent"),
  30.         (prop_instance_get_position,pos30,":sprop_instance"),
  31.         (scene_prop_set_slot,":sprop_instance",scene_prop_slot_use_agent,":use_agent"),
  32.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_animation_speed,0),
  33.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly,0),
  34.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,0),
  35.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_cnt_time,0),
  36.         (scene_prop_set_slot, ":sprop_instance",scene_prop_slot_opnen_fire_cnt_time,0),
  37.         (agent_set_speed_modifier,":use_agent",0),
  38.         (agent_set_visibility,":use_agent",0),
  39.         (agent_set_no_dynamics,":use_agent",1),#set no dynamics
  40.         (agent_set_slot, ":use_agent", slot_agent_driving_vehicle, ":sprop_instance"),
  41.         #(agent_set_wielded_item,":use_agent",-1),
  42.         #(mission_cam_set_mode,1,0,0),
  43.         (agent_set_position,":use_agent",pos30),
  44.         (prop_instance_animate_to_position,":sprop_instance",pos30,10),
  45.         (play_sound_at_position, "snd_tank_init", pos30),
  46.    
  47.    ]),
  48.   
  49. #ti_on_scene_prop_animation_finished
  50. (ti_on_scene_prop_animation_finished,
  51.   [
  52.     (set_fixed_point_multiplier, 100),
  53.    
  54.     (store_trigger_param_1, ":sprop_instance"),
  55.     (init_position,pos30),
  56.     (prop_instance_get_position, pos30, ":sprop_instance"),
  57.     (copy_position,pos40,pos30),#旧的位置
  58.     (copy_position,pos41,pos30),#旧的位置
  59.     (scene_prop_get_slot, ":use_agent", ":sprop_instance", scene_prop_slot_use_agent),
  60.     (scene_prop_get_slot, ":sprop_instance_turret", ":sprop_instance", scene_prop_slot_turret),
  61.     (scene_prop_get_slot, ":sprop_instance_gun", ":sprop_instance", scene_prop_slot_gun),
  62.    
  63.     (try_begin),
  64.         (gt,":use_agent",0),
  65.         (key_is_down,key_g),
  66.         (agent_set_speed_modifier,":use_agent",100),
  67.         (agent_set_visibility,":use_agent",1),
  68.         (agent_set_no_dynamics,":use_agent",0),#set no dynamics
  69.         (position_move_z,pos30,300),
  70.         (position_set_z_to_ground_level,pos30),
  71.         (agent_set_position,":use_agent",pos30),
  72.         (agent_set_slot, ":use_agent", slot_agent_driving_vehicle,-1),
  73.         (assign,":use_agent",-1),
  74.         (scene_prop_set_slot,":sprop_instance",scene_prop_slot_use_agent,":use_agent"),
  75.     (try_end),
  76.    
  77.     (gt,":use_agent",0),
  78.     (agent_set_wielded_item, ":use_agent", -1),
  79.     (agent_is_alive,":use_agent"),
  80.     (agent_is_human,":use_agent"),
  81.    
  82.     (assign,":no_can_animation_forward",0),
  83.     (assign,":no_can_animation_backward",0),
  84.     (assign,":no_can_animation_left",0),
  85.     (assign,":no_can_animation_right",0),
  86.    
  87.     #障碍判断开始
  88.     (try_begin),
  89.         (copy_position,pos50,pos41),
  90.         (position_move_y,pos50,550),
  91.         (position_move_x,pos50,250),
  92.         (position_move_z,pos50,120),
  93.         (position_rotate_z,pos50,90),
  94.         #(particle_system_burst,"psys_torch_fire_big",pos50,5),
  95.         (call_script,"script_cf_cast_ray_pos_is_terrain",pos50,300),
  96.         (assign,":no_can_animation_forward",reg63),
  97.     (try_end),
  98.    
  99.     (try_begin),
  100.         (copy_position,pos50,pos41),
  101.         (position_move_y,pos50,-550),
  102.         (position_move_x,pos50,250),
  103.         (position_move_z,pos50,120),
  104.         (position_rotate_z,pos50,90),
  105.         #(particle_system_burst,"psys_torch_fire_big",pos50,5),
  106.         (call_script,"script_cf_cast_ray_pos_is_terrain",pos50,300),
  107.         (assign,":no_can_animation_backward",reg63),
  108.     (try_end),
  109.    
  110.    
  111.      #障碍判断右部分
  112.     (try_begin),
  113.         (copy_position,pos50,pos41),
  114.         (position_move_y,pos50,-500),
  115.         (position_move_x,pos50,250),
  116.         (position_move_z,pos50,90),
  117.         #(particle_system_burst,"psys_torch_fire_big",pos50,5),
  118.         (call_script,"script_cf_cast_ray_pos_is_terrain",pos50,700),
  119.         (assign,":no_can_animation_right",reg63),
  120.     (try_end),
  121.    
  122.     #障碍判断左部分
  123.     (try_begin),
  124.         (copy_position,pos50,pos41),
  125.         (position_move_y,pos50,-500),
  126.         (position_move_x,pos50,-250),
  127.         (position_move_z,pos50,90),
  128.         #(particle_system_burst,"psys_torch_fire_big",pos50,5),
  129.         (call_script,"script_cf_cast_ray_pos_is_terrain",pos50,700),
  130.         (assign,":no_can_animation_left",reg63),
  131.     (try_end),
  132.    
  133.     (scene_prop_get_slot, ":animation_speed", ":sprop_instance", scene_prop_slot_animation_speed),
  134.     (scene_prop_get_slot, ":is_fly", ":sprop_instance", scene_prop_slot_is_fly),
  135.    
  136.     (try_begin),
  137.         (le, ":is_fly",0),
  138.         #地盘运动处理速度
  139.         (try_begin),
  140.             (game_key_is_down,gk_move_forward),
  141.             (assign,":forward_speed",2),
  142.             (try_begin),
  143.                 (lt,":animation_speed",0),
  144.                 (store_div,":forward_speed",":animation_speed",5),
  145.                 (val_mul,":forward_speed",-1),
  146.             (try_end),
  147.             (val_max,":forward_speed",2),
  148.             (val_add,":animation_speed",":forward_speed"),
  149.             (val_min,":animation_speed",18),
  150.         (else_try),
  151.             (eq,":no_can_animation_backward",0),
  152.             (game_key_is_down,gk_move_backward),
  153.             (assign,":backward_speed",1),
  154.             (try_begin),
  155.                 (gt,":animation_speed",0),
  156.                 (store_div,":backward_speed",":animation_speed",5),
  157.                 (val_mul,":forward_speed",1),
  158.             (try_end),
  159.             (val_max,":backward_speed",1),
  160.             (val_sub,":animation_speed",":backward_speed"),
  161.             (val_max,":animation_speed",-18),
  162.         (try_end),

  163.         (try_begin),
  164.             (eq,":no_can_animation_forward",1),
  165.             (gt,":animation_speed",0),
  166.             (assign,":animation_speed",0),
  167.         (else_try),
  168.             (eq,":no_can_animation_backward",1),
  169.             (lt,":animation_speed",0),
  170.             (assign,":animation_speed",0),
  171.         (try_end),
  172.       
  173.         (assign,":animation_speed_abs",":animation_speed"),
  174.         (val_abs,":animation_speed_abs"),
  175.         (assign,":rotate_z",0),
  176.         (try_begin),
  177.             (game_key_is_down,gk_move_right),
  178.             (store_div,":rotate_z",":animation_speed_abs",10),
  179.             (val_max,":rotate_z",1),
  180.             (val_mul,":rotate_z",-1),
  181.         (else_try),
  182.             (game_key_is_down,gk_move_left),
  183.             (store_div,":rotate_z",":animation_speed_abs",10),
  184.             (val_max,":rotate_z",1),
  185.             (val_mul,":rotate_z",1),
  186.         (try_end),
  187.         
  188.         
  189.         (try_begin),
  190.             (eq,":no_can_animation_left",1),
  191.             (gt,":rotate_z",0),
  192.             (assign,":rotate_z",0),
  193.         (else_try),
  194.             (eq,":no_can_animation_right",1),
  195.             (lt,":rotate_z",0),
  196.             (assign,":rotate_z",0),
  197.         (try_end),
  198.         
  199.         #刹车
  200.         (try_begin),
  201.             (game_key_is_down|this_or_next,gk_jump),
  202.             (game_key_clicked,gk_jump),
  203.             #刹车音效
  204.             (try_begin),
  205.                 (ge|this_or_next,":animation_speed",3),
  206.                 (le,":animation_speed",-3),
  207.                 (play_sound_at_position, "snd_car_brake", pos30),
  208.             (try_end),
  209.             
  210.             (assign,":animation_speed",0),
  211.             (assign,":rotate_z",0),
  212.         (try_end),
  213.         
  214.         (position_move_y,pos30,":animation_speed"),
  215.         (position_rotate_z,pos30,":rotate_z"),
  216.         
  217.         
  218.     (try_end),
  219.    
  220.    #正常运行记录,仅仅是为了播放音效!
  221.    (scene_prop_get_slot, ":animation_normal_cnt", ":sprop_instance", scene_prop_slot_is_animation_normal_cnt),

  222.     #进入飞车判断
  223.     (copy_position,pos31,pos30),
  224.     (try_begin),
  225.         (ge, ":is_fly",1),
  226.         (scene_prop_get_slot, ":fly_sub_speed", ":sprop_instance", scene_prop_slot_is_fly_sub_speed),
  227.         (val_add, ":fly_sub_speed",1),
  228.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,":fly_sub_speed"),
  229.         
  230.         (scene_prop_get_slot, ":fly_cnt_time", ":sprop_instance", scene_prop_slot_is_fly_cnt_time),
  231.         (val_add, ":fly_cnt_time",1),
  232.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_cnt_time,":fly_cnt_time"),
  233.         
  234.         (try_begin), #起飞状态中
  235.             (ge,":fly_sub_speed",10),
  236.             #简单的模拟空气时候飞行阻力减速
  237.             (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,0),
  238.             (try_begin),
  239.                 (neq,":animation_speed",0),
  240.                 (store_div,":speed_temp",":animation_speed",10),
  241.                 (ge,":speed_temp",0),
  242.                 (val_max,":speed_temp",1),
  243.                 (val_sub,":animation_speed",":speed_temp"),
  244.                 (val_max,":animation_speed",0),
  245.             (else_try),
  246.                 (neq,":animation_speed",0),
  247.                 (store_div,":speed_temp",":animation_speed",10),
  248.                 (lt,":speed_temp",0),
  249.                 (val_min,":speed_temp",-1),
  250.                 (val_sub,":animation_speed",":speed_temp"),
  251.                 (val_max,":animation_speed",0),
  252.             (try_end),
  253.         (try_end),
  254.         
  255.         (position_move_y,pos31,":animation_speed"),
  256.         (store_div,":t_seconds",":fly_cnt_time",100),#处于100得到运行了多少秒
  257.         (assign,reg62,":t_seconds"),
  258.         #(display_message,"@t_seconds{reg62}"),
  259.         (assign,":move_z",0),
  260.         #s(t) = 0.5 * g * t^2 g取 通过求2s和1s的之间的新加距离求1s到2s的平均速度来做Z轴移动,其实可以用v = gt的瞬时速度公式来求更方便!!!
  261.         (store_mul,":t_store_pow",":t_seconds",":t_seconds"),
  262.         (store_mul,":space_move_z",":t_store_pow",490),
  263.         (assign,reg62,":space_move_z"),
  264.         #(display_message,"@space_move_z{reg62}"),
  265.         (store_add,":t_seconds_next",":t_seconds",1),
  266.         (store_mul,":t_store_pow_next",":t_seconds_next",":t_seconds_next"),
  267.         (store_mul,":space_move_z_next",":t_store_pow_next",490),
  268.         (assign,reg62,":t_store_pow_next"),
  269.         #(display_message,"@t_store_pow_next{reg62}"),
  270.         (assign,reg62,":space_move_z_next"),
  271.         #(display_message,"@space_move_z_next{reg62}"),   
  272.         (store_sub,":space_move_z_error",":space_move_z_next",":space_move_z"),
  273.         (assign,reg62,":space_move_z_error"),
  274.         #(display_message,"@space_move_z_error{reg62}"),
  275.         (store_div,":move_z",":space_move_z_error",100),#因为是1/100秒运行一次所以处于100
  276.         (val_mul,":move_z",-1),
  277.         (assign,reg62,":move_z"),
  278.         #(display_message,"@move_z{reg62}"),
  279.         (assign,reg62,":fly_cnt_time"),
  280.         #(display_message,"@fly_cnt_time{reg62}"),
  281.         (position_move_z,pos31,":move_z"),
  282.         (position_get_distance_to_ground_level,":ground_level",pos31),
  283.         (try_begin),
  284.             (le,":ground_level",25),
  285.             #(display_message,"@car exit fly"),
  286.             (position_move_y,pos31,100),
  287.             (call_script,"script_set_vehicle_X_and_Y_axis_processing",pos31,":animation_speed",":rotate_z"),
  288.             (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly,0),
  289.             (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,0),
  290.             (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_cnt_time,0),
  291.             (play_sound_at_position, "snd_boulder_falls", pos31),
  292.         (else_try),
  293.             #(display_message,"@car is fly"),
  294.         (try_end),
  295.         (prop_instance_animate_to_position,":sprop_instance",pos31,1),
  296.         (assign,":animation_normal_cnt",0),
  297.     (else_try),#进入起飞状态
  298.         (neq,":animation_speed",0),
  299.         (gt|this_or_next,":animation_speed",10),
  300.         (lt,":animation_speed",-10),
  301.         (le, ":is_fly",0),
  302.         (try_begin),
  303.             (gt,":animation_speed",0),
  304.             (position_move_y,pos31,350),
  305.         (else_try),
  306.             (position_move_y,pos31,-350),
  307.         (try_end),
  308.    
  309.         (position_get_distance_to_ground_level,":ground_level",pos31),
  310.         (ge,":ground_level",150),
  311.         (prop_instance_animate_to_position,":sprop_instance",pos31,1),
  312.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly,1),
  313.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,0),
  314.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_cnt_time,0),
  315.         (assign,":animation_normal_cnt",0),
  316.         #(display_message,"@car start fly"),
  317.     (else_try),#正常状态
  318.         (le, ":is_fly",0),
  319.         (call_script,"script_set_vehicle_X_and_Y_axis_processing",pos30,":animation_speed",":rotate_z"),
  320.         (prop_instance_animate_to_position,":sprop_instance",pos30,1),
  321.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly,0),
  322.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_sub_speed,0),
  323.         (scene_prop_set_slot,":sprop_instance", scene_prop_slot_is_fly_cnt_time,0),
  324.         
  325.         #播放音效开始!
  326.         (try_begin),
  327.             (eq,":animation_normal_cnt",0),
  328.             (ge|this_or_next,":animation_speed",3),
  329.             (le|this_or_next,":animation_speed",-3),
  330.             (neq,":rotate_z",0),
  331.             (try_begin),
  332.                 (neq,":rotate_z",0),
  333.                 (play_sound_at_position, "snd_tank_2", pos30),
  334.             (else_try),
  335.                 (play_sound_at_position, "snd_tank_1", pos30),
  336.             (try_end),
  337.         (try_end),
  338.         (val_add,":animation_normal_cnt",1),
  339.         (try_begin),
  340.             (ge,":animation_normal_cnt",80),
  341.             (assign,":animation_normal_cnt",0),
  342.         (try_end),
  343.         #播放音效结束!
  344.         
  345.         #(display_message,"@car no fly"),
  346.         #泥土飞扬的效果
  347.         (try_begin),
  348.             (ge|this_or_next,":animation_speed",3),
  349.             (le|this_or_next,":animation_speed",-3),
  350.             (neq,":rotate_z",0),
  351.             (copy_position,pos31,pos30),
  352.             
  353.             (try_begin),
  354.                 (ge,":animation_speed",3),
  355.                 (position_move_y,pos31,-325),
  356.             (else_try),
  357.                 (position_move_y,pos31,325),
  358.             (try_end),

  359.             (position_move_x,pos31,200),
  360.             (particle_system_burst,"psys_game_hoof_dust_big",pos31,1),
  361.             (particle_system_burst,"psys_game_hoof_dust_mud_big",pos31,1),
  362.             (position_move_x,pos31,-400),
  363.             (particle_system_burst,"psys_game_hoof_dust_big",pos31,1),
  364.             (particle_system_burst,"psys_game_hoof_dust_mud_big",pos31,1),
  365.         (try_end),
  366.     (try_end),
  367.    
  368.     (scene_prop_set_slot,":sprop_instance", scene_prop_slot_animation_speed,":animation_speed"),
  369.     (scene_prop_set_slot, ":sprop_instance", scene_prop_slot_is_animation_normal_cnt,":animation_normal_cnt"),
  370.     (copy_position,pos31,pos30),

  371.     #玩家视角处理,主要是后续坦克炮台和炮管的around_z  around_x处理
  372.     (agent_get_look_position,pos20,":use_agent"),
  373.     (position_get_rotation_around_z,":around_z",pos20),
  374.     (position_get_rotation_around_x,":around_x",pos20),
  375.     (try_begin),  
  376.         (is_between,":around_x",180,360),
  377.         (val_sub,":around_x",360),
  378.     (try_end),  
  379.     (try_begin),  
  380.         (gt,":around_x",30),
  381.         (val_sub,":around_x",30),
  382.         (val_mul,":around_x",-1),
  383.         (position_rotate_x,pos20,":around_x"),     
  384.     (else_try),
  385.         (lt,":around_x",-10),
  386.         (val_add,":around_x",-10),
  387.         (val_mul,":around_x",-1),
  388.         (position_rotate_x,pos20,":around_x"),
  389.     (try_end),
  390.     (position_get_rotation_around_x,":around_x",pos20),
  391.    
  392.     #炮塔运动处理
  393.     (assign,":move_x",0),
  394.     (assign,":move_y",0),
  395.     (assign,":move_z",135),
  396.     (position_move_x, pos31, ":move_x"),
  397.     (position_move_y, pos31, ":move_y"),
  398.     (position_move_z, pos31, ":move_z"),
  399.     (call_script,"script_set_pos_around_z",pos31,":around_z"),
  400.     (prop_instance_animate_to_position,":sprop_instance_turret",pos31,1),
  401.     (copy_position,pos32,pos31),
  402.    
  403.     #炮管运动处理 炮管直接在炮塔上进行处理
  404.     (assign,":move_x",2.5),
  405.     (assign,":move_y",190),
  406.     (assign,":move_z",0),
  407.     (position_move_x, pos32, ":move_x"),
  408.     (position_move_y, pos32, ":move_y"),
  409.     (position_move_z, pos32, ":move_z"),
  410.     (call_script,"script_set_pos_around_x",pos32,":around_x"),
  411.     (prop_instance_animate_to_position,":sprop_instance_gun",pos32,1),
  412.     #开炮设置开始
  413.     (copy_position,pos33,pos32),
  414.     (scene_prop_get_slot, ":opnen_fire_cnt_time", ":sprop_instance", scene_prop_slot_opnen_fire_cnt_time),
  415.     (try_begin),
  416.         (eq,":opnen_fire_cnt_time",0),
  417.         (game_key_is_down|this_or_next,gk_attack),
  418.         (game_key_clicked,gk_attack),
  419.         (assign,":opnen_fire_cnt_time",250),
  420.         (position_move_y, pos33, 380),
  421.         (add_missile, ":use_agent", pos33, 50000, "itm_gun_tank", 0, "itm_tank_shell", 0),
  422.         (particle_system_burst, "psys_pistol_smoke_big_a", pos33,25),
  423.         (particle_system_burst,"psys_torch_fire_big_a",pos33,10),
  424.         (play_sound_at_position,"snd_tank_fire_3",pos33,0),
  425.     (else_try),
  426.         (gt,":opnen_fire_cnt_time",0),
  427.         (val_sub,":opnen_fire_cnt_time",1),
  428.     (try_end),
  429.     (scene_prop_set_slot, ":sprop_instance", scene_prop_slot_opnen_fire_cnt_time,":opnen_fire_cnt_time"),
  430.     #开炮设置结束
  431.    
  432.    
  433.    
  434.     #玩家移动处理
  435.     (agent_set_position,":use_agent",pos40),
  436.     (agent_get_look_position,pos41,":use_agent"),
  437.     (position_copy_rotation,pos40,pos41),
  438.     #(agent_set_animation, ":use_agent", "anim_ready_bow_arts"),
  439.     #摄像头处理
  440.     (position_move_y,pos40,-1000),
  441.     (position_move_z,pos40,700),
  442.     (position_rotate_x,pos40,-10),

  443.     (mission_cam_animate_to_position,pos40,1,0),
  444.   ]),

  445. ]),
复制代码
3.其余部分省略
核心代码都在上面了,其余代码只是功能补充,完整代码放在我的MOD里面,想体验就来找我要新版本MOD吧



评分

参与人数 1第纳尔 +20 互助 +1 魅力 +20 收起 理由
Aomine Daiki + 20 + 1 + 20 文章不错,继续努力!

查看全部评分

51

主题

287

回帖

101

积分

见习骑士

Rank: 3

UID
2880114
第纳尔
1576
精华
0
互助
0
荣誉
0
贡献
0
魅力
3
注册时间
2017-9-30
QQ
鲜花(12) 鸡蛋(0)
发表于 2024-3-11 12:02:43 | 显示全部楼层
感觉不错啊

17

主题

627

回帖

343

积分

见习骑士

Rank: 3

UID
3102512
第纳尔
2375
精华
0
互助
30
荣誉
0
贡献
0
魅力
74
注册时间
2019-9-6

骑砍中文站APP会员勋章战团正版勋章霸主正版勋章

鲜花(54) 鸡蛋(0)
发表于 2024-3-11 12:36:11 来自手机 | 显示全部楼层
好好好,给我搓一个独轮车来自: Android客户端

33

主题

180

回帖

64

积分

扈从

Rank: 2Rank: 2

UID
3256923
第纳尔
746
精华
0
互助
0
荣誉
0
贡献
0
魅力
0
注册时间
2021-7-30
鲜花(5) 鸡蛋(0)
发表于 2024-3-11 13:37:13 来自手机 | 显示全部楼层
呦西           来自: Android客户端

22

主题

446

回帖

150

积分

见习骑士

Rank: 3

UID
3318406
第纳尔
1124
精华
0
互助
2
荣誉
0
贡献
0
魅力
2
注册时间
2022-1-26
鲜花(8) 鸡蛋(0)
发表于 2024-3-12 14:30:12 来自手机 | 显示全部楼层
大佬,能制作一辆战车吗来自: Android客户端

28

主题

4158

回帖

3131

积分

子爵[版主]

世纪风云制作组[程序]

圣殿骑士团[KT]
战团ID:Epig

中级术士

Rank: 7Rank: 7Rank: 7

UID
1706215
第纳尔
34958
精华
3
互助
157
荣誉
79
贡献
2005
魅力
207
注册时间
2013-12-8

骑砍中文站APP会员勋章原版正版勋章战团正版勋章火与剑正版勋章拿破仑正版勋章维京征服正版勋章汉匈决战正版勋章骑士美德之英勇勋章[杰出会员活跃勋章]骑士美德之仁慈勋章[杰出会员互助勋章]骑士美德之谦恭勋章[杰出会员财富勋章]骑士美德之公正勋章[杰出会员高级财富勋章]骑士美德之正义勋章[杰出会员荣誉勋章]骑士精神之文韬勋章杰出版主勋章骑士美德之奉献勋章骑士美德之高贵勋章骑砍中文站微博会员勋章骑砍中文站微信会员勋章骑友真人秀勋章汉匈决战荣誉用户勋章元老骑士勋章霸主正版勋章

鲜花(2039) 鸡蛋(904)
发表于 2024-3-12 15:55:02 | 显示全部楼层
这个太完善了,我喜欢
童鞋们,欢迎来到骑马与砍杀学院,我是你们的科任老师,猪猪老师,由我来为童鞋们介绍以下课程:
1、人间五十年life50 2.0测试版
2、永恒世界4.5.5公测版
3、永恒世界网页端 UCP2.0
4、大逃杀1.0公测版
5、永恒世界4.5特别版
6、常见PY报错解决方案

29

主题

738

回帖

565

积分

骑士

Rank: 4Rank: 4

UID
3322408
第纳尔
1748
精华
0
互助
67
荣誉
0
贡献
0
魅力
6
注册时间
2022-2-3
鲜花(57) 鸡蛋(0)
发表于 2024-3-14 15:37:41 来自手机 | 显示全部楼层
好好好。来自: Android客户端

1

主题

19

回帖

16

积分

随仆

Rank: 1

UID
3636031
第纳尔
55
精华
0
互助
0
荣誉
1
贡献
0
魅力
1
注册时间
2024-3-18
鲜花(5) 鸡蛋(0)
发表于 2024-3-20 21:54:04 | 显示全部楼层
相关的 NPC AI 调整怎么搞?

16

主题

107

回帖

197

积分

见习骑士

Rank: 3

UID
3304622
第纳尔
690
精华
0
互助
26
荣誉
3
贡献
0
魅力
158
注册时间
2021-12-28
鲜花(31) 鸡蛋(0)
 楼主| 发表于 2024-3-21 08:39:46 | 显示全部楼层
Kino-eye 发表于 2024-3-20 21:54
相关的 NPC AI 调整怎么搞?

未作,待开发

31

主题

209

回帖

187

积分

见习骑士

Rank: 3

UID
2462463
第纳尔
1582
精华
0
互助
23
荣誉
0
贡献
0
魅力
83
注册时间
2015-3-3
鲜花(57) 鸡蛋(0)
发表于 2024-3-24 18:41:24 | 显示全部楼层
恶猪 发表于 2024-3-12 15:55
这个太完善了,我喜欢

【AE86 漂移+飞车+碰撞示范】 https://www.bilibili.com/video/B ... 609ef4b5f392ad11472看看我的呢

鲜花鸡蛋

杰喵喵  在2024-3-26 15:31  送朵鲜花  并说:我非常同意你的观点,送朵鲜花鼓励一下

28

主题

4158

回帖

3131

积分

子爵[版主]

世纪风云制作组[程序]

圣殿骑士团[KT]
战团ID:Epig

中级术士

Rank: 7Rank: 7Rank: 7

UID
1706215
第纳尔
34958
精华
3
互助
157
荣誉
79
贡献
2005
魅力
207
注册时间
2013-12-8

骑砍中文站APP会员勋章原版正版勋章战团正版勋章火与剑正版勋章拿破仑正版勋章维京征服正版勋章汉匈决战正版勋章骑士美德之英勇勋章[杰出会员活跃勋章]骑士美德之仁慈勋章[杰出会员互助勋章]骑士美德之谦恭勋章[杰出会员财富勋章]骑士美德之公正勋章[杰出会员高级财富勋章]骑士美德之正义勋章[杰出会员荣誉勋章]骑士精神之文韬勋章杰出版主勋章骑士美德之奉献勋章骑士美德之高贵勋章骑砍中文站微博会员勋章骑砍中文站微信会员勋章骑友真人秀勋章汉匈决战荣誉用户勋章元老骑士勋章霸主正版勋章

鲜花(2039) 鸡蛋(904)
发表于 2024-3-25 16:32:09 | 显示全部楼层
战争傀儡阿格兰 发表于 2024-3-24 18:41
【AE86 漂移+飞车+碰撞示范】 https://www.bilibili.com/video/BV19b4y1c7BM/?share_source=copy_web&vd_ ...

可以,你的也很牛逼
童鞋们,欢迎来到骑马与砍杀学院,我是你们的科任老师,猪猪老师,由我来为童鞋们介绍以下课程:
1、人间五十年life50 2.0测试版
2、永恒世界4.5.5公测版
3、永恒世界网页端 UCP2.0
4、大逃杀1.0公测版
5、永恒世界4.5特别版
6、常见PY报错解决方案

16

主题

107

回帖

197

积分

见习骑士

Rank: 3

UID
3304622
第纳尔
690
精华
0
互助
26
荣誉
3
贡献
0
魅力
158
注册时间
2021-12-28
鲜花(31) 鸡蛋(0)
 楼主| 发表于 2024-3-26 15:31:49 | 显示全部楼层
战争傀儡阿格兰 发表于 2024-3-24 18:41
【AE86 漂移+飞车+碰撞示范】 https://www.bilibili.com/video/BV19b4y1c7BM/?share_source=copy_web&vd_ ...

还灭有能研究出漂移

1

主题

4

回帖

7

积分

平民

Rank: 1

UID
3709517
第纳尔
0
精华
0
互助
1
荣誉
0
贡献
0
魅力
0
注册时间
2024-10-26
鲜花(0) 鸡蛋(0)
发表于 2024-10-30 00:49:54 来自手机 | 显示全部楼层
牛,现在mod想象力真丰富,学习了
您需要登录后才可以回帖 登录 | 注册(Register!)

本版积分规则

Archiver|手机版|小黑屋|骑马与砍杀中文站

GMT+8, 2024-11-21 18:09 , Processed in 0.148588 second(s), 38 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表