骑马与砍杀中文站论坛

 找回密码
 注册(Register!)

QQ登录

只需一步,快速开始

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

[功能与代码] 【战团】简单坦克大战实现

[复制链接]

16

主题

102

回帖

195

积分

见习骑士

Rank: 3

UID
3304622
第纳尔
690
精华
0
互助
26
荣誉
3
贡献
0
魅力
148
注册时间
2021-12-28
鲜花(31) 鸡蛋(0)
发表于 2024-9-7 16:57:58 | 显示全部楼层 |阅读模式
本帖最后由 杰喵喵 于 2024-9-8 14:30 编辑

学习场景道具使用,使用场景道具制作载具成功分享,简易坦克大战实现思路与配套代码。
一、感谢:
1.阿格兰,提供了最初的完整场景道具制作载具学习参考代码,十分完整强大,AE86永远的神!
2.九章,分享不少场景道具帖子,指导过我。
3.vegetto的理论帖子与换皮思想思路。
4.其他使用场景道具作为载具的MOD。

二、效果演示:


三、代码具备功能:
1.读取agent(步兵)速度,通过转换变成控制坦克底盘的控制,agent的look作为炮台控制;这样基本可以直接沿用战团agent自带AI和相关指挥指令。
2.简易的碰撞判断,判断到其他场景道具后,修改agent(步兵)的目的地,来实现控制避障功能。
3.troop装别马匹(坦克),进场后马匹(坦克)通过逃跑、隐形、去除,生成场景载具;实现马匹变场景道具软转换。
4.其他部分功能直接看MOD里面的完整代码吧。

四、坦克部分核心代码,剩下部分代码在后续的MS。
  1. tank_ai = [

  2.   #保护防止坦克驾驶员直接被打死
  3.   (ti_on_agent_hit, 0, 0, [],
  4.   [
  5.    (store_trigger_param_1, ":agent_no"),
  6.    (agent_is_human,":agent_no"),
  7.    
  8.    (try_begin),
  9.     (agent_slot_ge,":agent_no",slot_agent_driving_vehicle,1),
  10.     (set_trigger_result, 0),
  11.    (else_try),
  12.     (agent_slot_eq, ":agent_no", slot_agent_ready_driving, 1),
  13.     (set_trigger_result, 0),
  14.    (else_try),
  15.     (get_player_agent_no, ":player"),
  16.     (eq,":player",":agent_no"),
  17.     #(set_trigger_result, 0),
  18.    (try_end),
  19.    
  20.   ]),
  21.   
  22.   #坦克(马)-出场的处理隐身掉骑马的人(坦克驾驶人员),坦克(马)也隐身同时逃跑,同时设置产生坦克(场景道具)标志位
  23.   (ti_on_agent_spawn, 0, 0, [],
  24.   [
  25.     (set_fixed_point_multiplier, 100),
  26.    
  27.     (store_trigger_param_1, ":agent_no"),
  28.    
  29.     (try_begin),
  30.         (agent_is_alive,":agent_no"),
  31.         (neg|agent_is_human,":agent_no"),
  32.         (agent_get_item_id, ":item_id", ":agent_no"),
  33.         (str_store_item_name,s30,":item_id"),
  34.         #(display_message, "@ti_on_agent_spawn item_id {s30}"),
  35.         (eq,":item_id","itm_tank"),
  36.         (agent_set_visibility,":agent_no",0),
  37.         (agent_set_no_dynamics,":agent_no",1),#set no dynamics
  38.         (agent_get_rider,":rider",":agent_no"),
  39.         (agent_is_alive,":rider"),
  40.         (agent_is_human,":rider"),
  41.         (agent_set_visibility,":rider",0),
  42.         (str_store_agent_name,s30,":rider"),
  43.         (agent_get_position,pos2,":rider"),
  44.         (position_get_y,":pos_y",pos2),
  45.         (position_get_x,":pos_x",pos2),
  46.         (position_get_rotation_around_z,":around_z",pos2),
  47.         (agent_set_slot, ":rider", slot_agent_positon_y, ":pos_y"),
  48.         (agent_set_slot, ":rider", slot_agent_positon_x, ":pos_x"),
  49.         (agent_set_slot, ":rider", slot_agent_rotation_around_z,":around_z"),
  50.         (agent_set_slot, ":rider", slot_agent_ready_driving, 1),#同时设置产生坦克(场景道具)标志位
  51.         (agent_set_horse_speed_factor,":rider",0),
  52.         (agent_start_running_away,":agent_no"),
  53.         #(display_message, "@ti_on_agent_spawn rider name {s30}"),
  54.     (else_try),
  55.         (agent_is_alive,":agent_no"),
  56.         (agent_is_human,":agent_no"),
  57.         (agent_get_troop_id,":troop_id",":agent_no"),
  58.         (eq|this_or_next,":troop_id","trp_assault_infantry"),
  59.         (eq,":troop_id","trp_tank_force"),
  60.         (agent_get_position,pos2,":agent_no"),   
  61.         (store_random_in_range,":move_y",1,25),
  62.         (store_random_in_range,":move_x",-100,100),
  63.         (val_mul,":move_y",50),
  64.         (val_mul,":move_x",100),
  65.         (position_move_y, pos2, ":move_y"),
  66.         (position_move_x, pos2, ":move_x"),
  67.         (position_set_z_to_ground_level,pos2),
  68.         (agent_set_position,":agent_no",pos2),
  69.         (assign,":item_slot_num",4),
  70.         (try_for_range, ":item_slot", 0, ":item_slot_num"),
  71.            (agent_get_item_slot, ":wielded_item_id",":agent_no",":item_slot"),
  72.            (try_begin),
  73.               (eq,":item_slot",3),
  74.               (agent_equip_item,":agent_no","itm_grenade",":item_slot"),
  75.            (else_try),
  76.               (le, ":wielded_item_id",0),
  77.               (agent_equip_item,":agent_no","itm_tak47_shell",":item_slot"),
  78.            (try_end),
  79.         (try_end),
  80.         
  81.         (neg|agent_is_ally,":agent_no"),
  82.         (agent_equip_item,":agent_no","itm_arena_armor_blue",5),
  83.     ]),
  84.    
  85.   #马转换为坦克场景道具代码,使用产生坦克标志位,产生坦克(场景道具)将驾驶员与其绑定
  86.   (1, 0, 0,
  87.   [],
  88.   [
  89.     (set_fixed_point_multiplier, 100),
  90.     #转换为坦克场景道具
  91.     (try_for_agents,":agent_no"),
  92.         (agent_is_alive,":agent_no"),
  93.         (agent_is_human,":agent_no"),
  94.         (agent_get_horse,":horse",":agent_no"),
  95.         (le,":horse",0),
  96.         (agent_slot_eq, ":agent_no", slot_agent_ready_driving, 1),
  97.         (agent_set_slot, ":agent_no", slot_agent_ready_driving, 0),
  98.         (agent_get_slot,":pos_y", ":agent_no", slot_agent_positon_y),
  99.         (agent_get_slot,":pos_x", ":agent_no", slot_agent_positon_x),
  100.         (agent_get_slot, ":around_z", ":agent_no",slot_agent_rotation_around_z),
  101.         (init_position,pos3),
  102.         (position_set_y,pos3,":pos_y"),
  103.         (position_set_x,pos3,":pos_x"),
  104.         (position_set_z,pos3,0),
  105.         (position_set_z_to_ground_level,pos3),
  106.         (call_script,"script_set_pos_around_z",pos3,":around_z"),
  107.         (try_begin),
  108.             (get_player_agent_no, ":player"),
  109.             (neq,":player",":agent_no"),
  110.             (store_random_in_range,":move_y",25,50),
  111.             (store_random_in_range,":move_x",-100,100),
  112.             (val_mul,":move_y",50),
  113.             (val_mul,":move_x",100),
  114.             (position_move_y, pos3, ":move_y"),
  115.             (position_move_x, pos3, ":move_x"),
  116.             (position_set_z_to_ground_level,pos3),
  117.         (try_end),
  118.         (agent_set_position,":agent_no",pos3),
  119.         (call_script,"script_spawn_tank_for_agent",":agent_no"),
  120.         (agent_set_visibility,":agent_no",1),
  121.     (try_end),
  122.    
  123.     #清除马
  124.     (try_for_agents,":agent_no"),
  125.         (agent_is_alive,":agent_no"),
  126.         (neg|agent_is_human,":agent_no"),
  127.         (agent_get_item_id, ":item_id", ":agent_no"),
  128.         (eq,":item_id","itm_tank"),
  129.         (agent_get_rider,":rider",":agent_no"),
  130.         (le,":rider",0),
  131.         (agent_set_visibility,":agent_no",0),
  132.         (remove_agent,":agent_no"),
  133.     (try_end),
  134.    ]),

  135.   #简易的障碍物判断,修正驾驶员agent目的地来实现
  136.   (0.1, 0, 0,
  137.    [
  138.    (assign, ":scene_prop_no","spr_abrams_chassis"),
  139.    (scene_prop_get_num_instances, ":num_instances_of_scene_prop", ":scene_prop_no"),
  140.    (gt,":num_instances_of_scene_prop",0),
  141.    ],
  142.    [
  143.     (set_fixed_point_multiplier, 100),  
  144.     (try_for_agents, ":agent_no"),
  145.       (gt,":agent_no",-1),
  146.       (agent_is_non_player,":agent_no"),
  147.       (agent_is_alive, ":agent_no"),
  148.       (agent_is_human, ":agent_no"),
  149.       (agent_get_slot, ":sprop_instance", ":agent_no", slot_agent_driving_vehicle),
  150.       (gt,":sprop_instance",0),

  151.       (init_position,pos21),
  152.       (prop_instance_get_position, pos21, ":sprop_instance"),
  153.       (init_position,pos22),
  154.       (agent_get_speed,pos22,":agent_no"),
  155.       (position_get_y,":speed_y",pos22),
  156.       (position_get_x,":speed_x",pos22),

  157.       (assign,":no_can_animation_forward",0),
  158.       (assign,":no_can_animation_backward",0),
  159.       (assign,":no_can_animation_left",0),
  160.       (assign,":no_can_animation_right",0),
  161.    
  162.       #障碍判断开始
  163.       (try_begin),
  164.         (gt,":speed_y",0),
  165.         (init_position,pos22),
  166.         (copy_position,pos22,pos21),
  167.         (position_move_y,pos22,750),
  168.         (position_move_x,pos22,250),
  169.         (position_move_z,pos22,120),
  170.         (position_rotate_z,pos22,90),
  171.         #(particle_system_burst,"psys_torch_fire_big",pos50,5),
  172.         (call_script,"script_cf_cast_ray_pos_is_terrain",pos22,300),
  173.         (assign,":no_can_animation_forward",reg63),
  174.       (else_try),
  175.         (lt,":speed_y",0),
  176.         (init_position,pos22),
  177.         (copy_position,pos22,pos21),
  178.         (position_move_y,pos22,-750),
  179.         (position_move_x,pos22,250),
  180.         (position_move_z,pos22,120),
  181.         (position_rotate_z,pos22,90),
  182.         #(particle_system_burst,"psys_torch_fire_big",pos50,5),
  183.         (call_script,"script_cf_cast_ray_pos_is_terrain",pos22,300),
  184.         (assign,":no_can_animation_backward",reg63),
  185.       (try_end),
  186.    
  187.    
  188.       #障碍判断右部分
  189.       (try_begin),
  190.         (gt,":speed_x",0),
  191.         (init_position,pos22),
  192.         (copy_position,pos22,pos21),
  193.         (position_move_y,pos22,-500),
  194.         (position_move_x,pos22,250),
  195.         (position_move_z,pos22,90),
  196.         #(particle_system_burst,"psys_torch_fire_big",pos50,5),
  197.         (call_script,"script_cf_cast_ray_pos_is_terrain",pos22,700),
  198.         (assign,":no_can_animation_right",reg63),
  199.       (else_try),
  200.       #障碍判断左部分
  201.         (lt,":speed_x",0),
  202.         (init_position,pos22),
  203.         (copy_position,pos22,pos21),
  204.         (position_move_y,pos22,-500),
  205.         (position_move_x,pos22,-250),
  206.         (position_move_z,pos22,90),
  207.         #(particle_system_burst,"psys_torch_fire_big",pos50,5),
  208.         (call_script,"script_cf_cast_ray_pos_is_terrain",pos22,700),
  209.         (assign,":no_can_animation_left",reg63),
  210.       (try_end),

  211.       (try_begin),
  212.         (ge|this_or_next,":no_can_animation_forward",1),
  213.         (ge|this_or_next,":no_can_animation_backward",1),
  214.         (ge|this_or_next,":no_can_animation_left",1),
  215.         (ge,":no_can_animation_right",1),
  216.         
  217.         (try_begin),#前后有障碍物
  218.           (ge|this_or_next,":no_can_animation_forward",1),
  219.           (ge,":no_can_animation_backward",1),

  220.           (try_begin),
  221.             (ge,":no_can_animation_forward",1),
  222.             (position_move_y,pos21,-500),
  223.           (else_try),
  224.              (ge,":no_can_animation_backward",1),
  225.             (position_move_y,pos21,500),
  226.           (else_try),
  227.           (try_end),

  228.           #前后有碍物,且左右也有
  229.           (try_begin),
  230.             (ge,":no_can_animation_right",1),
  231.             (position_move_x,pos21,-1000),
  232.           (else_try),
  233.             (ge,":no_can_animation_left",1),
  234.             (position_move_x,pos21,1000),
  235.           (else_try),
  236.             (position_move_x,pos21,-1000),
  237.           (try_end),
  238.         (else_try),#前后无障碍物,只考虑左右
  239.           (try_begin),
  240.             (ge,":no_can_animation_right",1),
  241.             (position_move_x,pos21,-1000),
  242.           (else_try),
  243.             (ge,":no_can_animation_left",1),
  244.             (position_move_x,pos21,1000),
  245.           (try_end),
  246.         (try_end),

  247.         (agent_set_scripted_destination_no_attack, ":agent_no", pos21,1),
  248.       (else_try),
  249.         (agent_clear_scripted_mode, ":agent_no"),
  250.       (try_end),

  251.     (try_end),

  252.    ]
  253.   ),

  254.   #非玩家的agent地盘控制及开炮
  255.   (0, 0, 0,
  256.    [
  257.    (assign, ":scene_prop_no","spr_abrams_chassis"),
  258.    (scene_prop_get_num_instances, ":num_instances_of_scene_prop", ":scene_prop_no"),
  259.    (gt,":num_instances_of_scene_prop",0),
  260.    ],
  261.    [
  262.     (set_fixed_point_multiplier, 100),

  263.     (try_for_agents, ":agent_no"),
  264.       (gt,":agent_no",-1),
  265.       (agent_is_non_player,":agent_no"),
  266.       (agent_is_alive, ":agent_no"),
  267.       (agent_is_human, ":agent_no"),
  268.       (agent_get_slot, ":sprop_instance", ":agent_no", slot_agent_driving_vehicle),
  269.       (gt,":sprop_instance",0),
  270.       (init_position,pos20),
  271.       (init_position,pos21),
  272.       (init_position,pos23),
  273.       (prop_instance_get_position, pos21, ":sprop_instance"),
  274.       (agent_get_position,pos23,":agent_no"),
  275.       #根据agent(步行)的移动速度和方向来控制车辆底盘这段代码,根据agent(步行)的方向与速度来处理,
  276.       #比如agent(步行)左右移动地盘需要与agent(步行)看的方向形成90度夹角来模拟坦克地盘前进,炮塔依然瞄准
  277.       (init_position,pos22),
  278.       (agent_get_speed,pos22,":agent_no"),
  279.       (init_position,pos24),
  280.       (position_transform_position_to_local, pos24, pos23, pos21),
  281.       (position_get_y,":speed_y",pos22),
  282.       (position_get_x,":speed_x",pos22),
  283.       (position_get_rotation_around_z,":local_around_z",pos24),

  284.       (assign,":y_move",0),
  285.       (try_begin),
  286.         (gt,":speed_y",0),
  287.         (store_mul,":y_move",12,1),
  288.       (else_try),
  289.         (lt,":speed_y",0),
  290.         (store_mul,":y_move",12,-1),
  291.       (try_end),

  292.       (try_begin),  
  293.         (is_between,":local_around_z",181,360),
  294.         (val_sub,":local_around_z",360),
  295.       (try_end),

  296.       (try_begin),  
  297.         (neq,":speed_x",0),
  298.         (try_begin),
  299.             (gt,":speed_x",0),
  300.             (gt,":local_around_z",-90),
  301.             (assign,":around_z_move",-1),
  302.         (else_try),
  303.             (lt,":speed_x",0),
  304.             (lt,":local_around_z",90),
  305.             (assign,":around_z_move",1),
  306.         (try_end),
  307.         
  308.         (try_begin),
  309.             (eq,":y_move",0),
  310.             (assign,":y_move",12),
  311.         (try_end),
  312.       (else_try),
  313.         (try_begin),
  314.           (lt,":local_around_z",0),
  315.           (assign,":around_z_move",1),
  316.         (else_try),
  317.           (gt,":local_around_z",0),
  318.           (assign,":around_z_move",-1),
  319.         (try_end),
  320.       (try_end),

  321.       (scene_prop_set_slot,":sprop_instance", scene_prop_slot_animation_speed,":y_move"),
  322.       (position_move_y,pos21,":y_move"),
  323.       (position_rotate_z,pos21,":around_z_move"),
  324.       (call_script,"script_set_vehicle_X_and_Y_axis_processing",pos21),
  325.       (prop_instance_set_position,":sprop_instance",pos21),
  326.       (init_position,pos22),
  327.       (copy_position,pos22,pos21),
  328.       (position_move_z,pos22,35),
  329.       (position_copy_rotation,pos22,pos23),
  330.       (agent_set_position,":agent_no",pos22),
  331.       ##尘土烟雾
  332.       (try_begin),
  333.           (neq,":y_move",0),
  334.           (init_position,pos24),
  335.           (copy_position,pos24,pos21),
  336.           (try_begin),
  337.               (gt,":y_move",0),
  338.               (position_move_y,pos24,-325),
  339.           (else_try),
  340.               (position_move_y,pos24,325),
  341.           (try_end),

  342.           (position_move_x,pos24,200),
  343.           (particle_system_burst,"psys_game_hoof_dust_big",pos24,1),
  344.           (particle_system_burst,"psys_game_hoof_dust_mud_big",pos24,1),
  345.           (position_move_x,pos24,-400),
  346.           (particle_system_burst,"psys_game_hoof_dust_big",pos24,1),
  347.           (particle_system_burst,"psys_game_hoof_dust_mud_big",pos24,1),
  348.       (try_end),
  349.       ####################################
  350.       (scene_prop_get_slot, ":sprop_instance_turret", ":sprop_instance", scene_prop_slot_turret),
  351.       (gt, ":sprop_instance_turret",0),

  352.       (init_position,pos22),
  353.       (agent_get_look_position,pos22,":agent_no"),
  354.       (position_get_rotation_around_z,":around_z",pos22),
  355.       (position_get_rotation_around_x,":around_x",pos22),

  356.       (assign,":move_x",0),
  357.       (assign,":move_y",0),
  358.       (assign,":move_z",135),
  359.       (position_move_x, pos21, ":move_x"),
  360.       (position_move_y, pos21, ":move_y"),
  361.       (position_move_z, pos21, ":move_z"),
  362.       (call_script,"script_set_pos_around_z",pos21,":around_z"),
  363.       (prop_instance_get_position,pos22,":sprop_instance_turret"),
  364.       #设定pos的新值为目标pos的值,但是around_z是缓慢靠近
  365.       (call_script,"script_pos_around_z_to_other_pos_around_z",pos22,pos21),
  366.       (prop_instance_set_position,":sprop_instance_turret",pos22),

  367.       (scene_prop_get_slot, ":sprop_instance_gun", ":sprop_instance", scene_prop_slot_gun),
  368.       (gt, ":sprop_instance_gun",0),
  369.       
  370.       #新的炮管运动处理 炮管直接在炮塔上进行处理
  371.       (assign,":move_x",2.5),
  372.       (assign,":move_y",190),
  373.       (assign,":move_z",0),
  374.       (position_move_x, pos22, ":move_x"),
  375.       (position_move_y, pos22, ":move_y"),
  376.       (position_move_z, pos22, ":move_z"),
  377.       (try_begin),  
  378.         (is_between,":around_x",180,360),
  379.         (val_sub,":around_x",360),
  380.       (try_end),
  381.       (val_min,":around_x",30),
  382.       (val_max,":around_x",-5),
  383.       (call_script,"script_set_pos_around_x",pos22,":around_x"),
  384.       (prop_instance_get_position, pos23, ":sprop_instance_gun"),
  385.       #设定pos的新值为目标pos的值,但是around_x是缓慢靠近
  386.       (call_script,"script_pos_around_x_to_other_pos_around_x",pos23,pos22),
  387.       (prop_instance_set_position,":sprop_instance_gun",pos23),
  388.       
  389.       (assign,":open_fire",0),
  390.       (agent_ai_get_look_target,":ai_look_target",":agent_no"),
  391.       (try_begin),
  392.         (gt,":ai_look_target",-1),
  393.         (init_position,pos24),
  394.         (agent_get_bone_position, pos24, ":ai_look_target", hb_head,1),
  395.         #对准敌人,先计算发炮点
  396.         (copy_position,pos34,pos23),
  397.         (assign,":move_y",410),
  398.         (position_move_y, pos23, ":move_y"),
  399.         #判断是否开炮
  400.         (assign,":line_of_sight",0),
  401.         (try_begin),
  402.           (agent_slot_ge,":ai_look_target",slot_agent_driving_vehicle,1),
  403.           (cast_ray,":destination", pos52,pos23,30000),
  404.           (gt,":destination",-1),
  405.           (agent_get_slot, ":target_sprop_instance", ":ai_look_target", slot_agent_driving_vehicle),
  406.           (prop_instance_get_scene_prop_kind,":target_scene_prop_kind",":target_sprop_instance"),
  407.           (prop_instance_get_scene_prop_kind,":destination_scene_prop_kind",":destination"),
  408.           (eq,":destination_scene_prop_kind",":target_scene_prop_kind"),
  409.           (scene_prop_get_team,":team",":destination"),
  410.           (scene_prop_get_team,":team_1",":target_sprop_instance"),
  411.           (eq,":team",":team_1"),
  412.           (assign,":line_of_sight",1),
  413.         (else_try),
  414.           (position_has_line_of_sight_to_position,pos23,pos24),
  415.           (assign,":line_of_sight",1),
  416.         (try_end),
  417.         
  418.         (eq,":line_of_sight",1),
  419.         (get_distance_between_positions_in_meters,":meters",pos23,pos24),
  420.         (gt,":meters",2),
  421.         (assign,":open_fire",1),
  422.       (try_end),

  423.       #开炮设置开始
  424.       (scene_prop_get_slot, ":opnen_fire_cnt_time", ":sprop_instance", scene_prop_slot_opnen_fire_cnt_time),
  425.       (scene_prop_get_slot, ":opnen_fire_cnt_time_sec", ":sprop_instance", scene_prop_slot_opnen_fire_cnt_time_sec),
  426.       (try_begin),
  427.           (gt,":open_fire",0),
  428.           (le,":opnen_fire_cnt_time",0),
  429.           (assign,":opnen_fire_cnt_time",100),
  430.           (particle_system_burst, "psys_pistol_smoke_big_a", pos23,25),
  431.           (particle_system_burst,"psys_torch_fire_big_a",pos23,10),
  432.           (play_sound_at_position,"snd_tank_fire_3",pos23,0),
  433.           (add_missile, ":agent_no", pos23, 40000, "itm_gun_tank", 0, "itm_tank_shell", 0),
  434.       (else_try),
  435.           (gt,":opnen_fire_cnt_time",0),
  436.           (val_sub,":opnen_fire_cnt_time",1),
  437.       (try_end),
  438.       
  439.       #副武器同轴机枪
  440.       (try_begin),
  441.         (gt,":open_fire",0),
  442.         (le,":opnen_fire_cnt_time_sec",0),
  443.         (assign,":opnen_fire_cnt_time_sec",5),
  444.         (position_move_z, pos34, 25),
  445.         (position_move_y, pos34, 70),
  446.         (position_move_x, pos34, 25),
  447.         (play_sound_at_position,"snd_ak47_shoot",pos34),
  448.         (particle_system_burst, "psys_buqianghuoyan", pos34, 10),
  449.         (position_move_y, pos34, 180),
  450.         (add_missile, ":agent_no", pos34, 20000, "itm_gun_ak47", 0, "itm_tak47_shell", 0),
  451.      (else_try),
  452.         (gt,":opnen_fire_cnt_time_sec",0),
  453.         (val_sub,":opnen_fire_cnt_time_sec",1),
  454.      (try_end),
  455.      (scene_prop_set_slot, ":sprop_instance", scene_prop_slot_opnen_fire_cnt_time,":opnen_fire_cnt_time"),
  456.      (scene_prop_set_slot, ":sprop_instance", scene_prop_slot_opnen_fire_cnt_time_sec,":opnen_fire_cnt_time_sec"),
  457.       #开炮设置结束
  458.     (try_end),
  459.    ]
  460.   ),
  461.   
  462.   #坦克生命值检查与冒烟
  463.   (1, 0, 0,
  464.    [
  465.    (assign, ":scene_prop_no","spr_abrams_chassis"),
  466.    (scene_prop_get_num_instances, ":num_instances_of_scene_prop", ":scene_prop_no"),
  467.    (gt,":num_instances_of_scene_prop",0),
  468.    ],
  469.    [
  470.     (set_fixed_point_multiplier, 100),

  471.     (try_for_agents, ":agent_no"),
  472.       (call_script,"script_tank_hp_check",":agent_no"),
  473.     (try_end),
  474.    ]),
  475.   

  476.   #坦克碰撞伤害处理
  477.   (0.25, 0, 0,
  478.   [
  479.    (assign, ":scene_prop_no","spr_abrams_chassis"),
  480.    (scene_prop_get_num_instances, ":num_instances_of_scene_prop", ":scene_prop_no"),
  481.    (gt,":num_instances_of_scene_prop",0),
  482.   ],
  483.   [
  484.   
  485.     (try_for_agents, ":agent_no"),
  486.       (gt,":agent_no",-1),
  487.       (agent_is_alive, ":agent_no"),
  488.       (agent_is_human, ":agent_no"),
  489.       (agent_get_slot, ":sprop_instance", ":agent_no", slot_agent_driving_vehicle),
  490.       (gt,":sprop_instance",0),

  491.       (init_position,pos21),
  492.       (prop_instance_get_position, pos21, ":sprop_instance"),
  493.       (scene_prop_get_slot, ":animation_speed", ":sprop_instance", scene_prop_slot_animation_speed),
  494.       (neq,":animation_speed",0),


  495.       #150*150+350*350 = 14500000 根号14500000 = 380 380+50 = 430
  496.       (try_for_agents,":other_agents_no",pos21,430),
  497.             (gt,":other_agents_no",-1),
  498.             (neq,":agent_no",":other_agents_no"),
  499.             (agent_is_alive,":other_agents_no"),
  500.             (agent_is_human,":other_agents_no"),
  501.             (agent_get_slot, ":other_sprop_instance", ":other_agents_no", slot_agent_driving_vehicle),
  502.             (le,":other_sprop_instance",0),
  503.             (init_position,pos22),
  504.             (agent_get_position,pos22,":other_agents_no"),
  505.             (init_position,pos23),
  506.             (position_transform_position_to_local,pos23,pos22,pos21),
  507.             (position_get_y,":relative_y",pos23),
  508.             (position_get_x,":relative_x",pos23),
  509.             (is_between,":relative_y",-430,430),
  510.             (is_between,":relative_x",-150,150),
  511.             
  512.             (assign,":relative_x_temp",":relative_x"),
  513.             (val_abs,":relative_x_temp"),
  514.             (store_sub,":relative_x_temp",300,":relative_x_temp"),
  515.             (val_abs,":relative_x_temp"),
  516.             (gt,":relative_x_temp",0),
  517.             
  518.             (try_begin),
  519.                  (gt,":relative_x",0),
  520.                  (val_mul,":relative_x_temp",1),
  521.             (else_try),   
  522.                  (val_mul,":relative_x_temp",-1),
  523.             (try_end),
  524.             
  525.             (init_position,pos23),
  526.             (copy_position,pos23,pos22),
  527.             (position_move_y,pos23,":relative_y"),
  528.             (position_move_x,pos23,":relative_x_temp"),
  529.             (position_copy_rotation,pos23,pos22),
  530.             (agent_set_position,":other_agents_no",pos23),
  531.          
  532.             (assign,reg61,":relative_y"),
  533.             (assign,reg62,":relative_x_temp"),
  534.             (assign,reg63,":relative_x"),
  535.             #(display_message,"@relative_y{reg61},relative_x_temp{reg62},relative_x{reg63}"),
  536.             (agent_get_team,":agent_team",":agent_no"),
  537.             (agent_get_team,":other_agent_team",":other_agents_no"),
  538.             (teams_are_enemies,":agent_team",":other_agent_team"),
  539.             (agent_deliver_damage_to_agent, ":agent_no", ":other_agents_no",300,"itm_sword_of_war"),
  540.       (try_end),
  541.     (try_end),

  542.     ]
  543.    ),
  544. ]
复制代码
五、完整MS和MOD体验
MOD里面自带最新MS代码

动员兵坦克大战 - 骑砍中文站下载中心 - 骑马与砍杀中文站论坛 (mountblade.com.cn)










Ms.rar

1.17 MB, 下载次数: 2

评分

参与人数 1第纳尔 +50 互助 +2 收起 理由
vegetto + 50 + 2 文章不错,继续努力!

查看全部评分

22

主题

443

回帖

150

积分

见习骑士

Rank: 3

UID
3318406
第纳尔
1124
精华
0
互助
2
荣誉
0
贡献
0
魅力
2
注册时间
2022-1-26
鲜花(8) 鸡蛋(0)
发表于 2024-9-8 12:48:30 来自手机 | 显示全部楼层
是不是战车功能也是这个原理?来自: Android客户端

16

主题

102

回帖

195

积分

见习骑士

Rank: 3

UID
3304622
第纳尔
690
精华
0
互助
26
荣誉
3
贡献
0
魅力
148
注册时间
2021-12-28
鲜花(31) 鸡蛋(0)
 楼主| 发表于 2024-9-8 14:27:56 | 显示全部楼层
舞阳城下 发表于 2024-9-8 12:48
是不是战车功能也是这个原理?

可以这样理解

29

主题

718

回帖

559

积分

骑士

Rank: 4Rank: 4

UID
3322408
第纳尔
1738
精华
0
互助
67
荣誉
0
贡献
0
魅力
4
注册时间
2022-2-3
鲜花(55) 鸡蛋(0)
发表于 2024-9-9 07:20:48 来自手机 | 显示全部楼层
欧内的手,好汉。来自: Android客户端

26

主题

800

回帖

398

积分

见习骑士

民间工匠

Rank: 3

UID
1115705
第纳尔
4062
精华
0
互助
26
荣誉
2
贡献
0
魅力
30
注册时间
2012-12-13
鲜花(235) 鸡蛋(10)
发表于 2024-9-10 00:41:28 | 显示全部楼层
哎呀不错啊,比我厉害多了,江山代有才人出啊

16

主题

102

回帖

195

积分

见习骑士

Rank: 3

UID
3304622
第纳尔
690
精华
0
互助
26
荣誉
3
贡献
0
魅力
148
注册时间
2021-12-28
鲜花(31) 鸡蛋(0)
 楼主| 发表于 2024-9-10 20:03:01 | 显示全部楼层
a1550887802 发表于 2024-9-10 00:41
哎呀不错啊,比我厉害多了,江山代有才人出啊

前辈厉害,前辈指点好
您需要登录后才可以回帖 登录 | 注册(Register!)

本版积分规则

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

GMT+8, 2024-9-20 01:00 , Processed in 0.132760 second(s), 27 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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