本帖最后由 vegetto 于 2024-9-3 14:23 编辑
然后注意,该理论功能的精华部分不只是开头对骨骼坐标获取及飞行取消重力两个op的解释,看到第一个理论贴的武器插人环节,告诉你如何将一个人的骨骼与另一个人的骨骼贴紧伴随移动。 -------------------------------------------------------------------------------------------------主文--------------------------------------------------------------------------------------------------------------------------
示例之左右为男,效果是将一个人的左上腿骨骼和另一个人右上腿骨骼的设置位置绑定于第三人的左手和右手武器点上,看起来像一个人拎着两个人的裤裆一样,一起移动战斗。 代码从mod中肢解匆忙,如有错误也就这样吧。 视频效果
------------------------------代码参考如下:下面slot挑着解释,如有prop场景物trp等等兵种设置,请根据自身mod情况在相应文件添加,然后注意我是在非战斗场景测试,然后手动刷部队的---------------------------------------------------------------
MT trigger条件 (0.000000, 0.000000, 0.000000, ###目的是生成一个叫ddd的场景物,用于MT2中定位玩家初设在场景的位置,然后根据场景大小范围,手动限制测试双方兵种刷的位置范围及各种其他操作。然后顺带初始化一下左右为男各个兵种id和进程slot清0(懒得用before/after mission,主要我mod这段是分开的,阉割后就不合并了),然后mod里是可以有界面指定左右为男的兵种选择,这里阉割一下,直接指定兵种id。
(get_player_agent_no, ":var_0"), (agent_get_position, pos1, ":var_0"), (scene_prop_get_num_instances, ":var_1", "spr_ddd"), #刷一个场景物ddd标记玩家的初设位置顺带初设化一些slot参数,场景物ddd的位置用于后面的刷人安排范围 (try_begin), (eq, ":var_1", 0), (set_spawn_position, pos1), (spawn_scene_prop, "spr_ddd"), (troop_set_slot, "trp_player", 307, 0), #slot307是判断游戏模式,主要我mod存在类似的不同玩法选择,初始化0,后面按j变成4才是启动本功能 (troop_set_slot, "trp_player", 314, 0), #slot314是进战场延时一段时间,因为采用手动刷大量agent还加复杂初始化代码的操作,如果不延时容易出bug。 (troop_set_slot, "trp_player", 318, 3), #mod里存在一个模式选择,这里阉割了,slot318为3表示是第3种骨骼拼接的组合方法,对于我方。 (troop_set_slot, "trp_player", 319, "trp_a"), #slot319、320、326、327分别是记录左右为男的,我方托人的兵种,我方被托的兵种,敌方托人的兵种,敌方被托的兵种,其中被托的两个兵种一致,托人的可以与被托的兵种不一样 (troop_set_slot, "trp_player", 320, "trp_b"), (troop_set_slot, "trp_player", 321, 3), #mod里存在一个模式选择,这里阉割了,slot318为3表示是第3种骨骼拼接的组合方法,对于敌方。 (troop_set_slot, "trp_player", 322, 0), #用于后面我方刷兵时记录托人的人初始序号从哪里开始编,存入该agent的slot300里记录编号,方便后面托与被托之人一一对应。 (troop_set_slot, "trp_player", 323, 50000), #用于后面我方刷兵时记录被托的人初始序号从哪里开始编,存入该agent的slot300里记录编号,方便后面托与被托之人一一对应。 (troop_set_slot, "trp_player", 324, 100000), #用于后面敌方刷兵时记录托人的人初始序号从哪里开始编,存入该agent的slot300里记录编号,方便后面托与被托之人一一对应。 (troop_set_slot, "trp_player", 325, 150000), #用于后面敌方刷兵时记录被托的人初始序号从哪里开始编,存入该agent的slot300里记录编号,方便后面托与被托之人一一对应。 (troop_set_slot, "trp_player", 326, "trp_c"), (troop_set_slot, "trp_player", 327, "trp_d"), (try_end),
|
---------------------------------------------------------------------------------- MT trigger条件 (0.000000, 0.000000, 0.000000, ###目的是刷出测试双方兵种,各30个托人的人和60个被托的人,利用slot300编排序号,根据序号对应关系,后面mt3和4绑定关系操作时进行1:2人员绑定分组。
(try_begin), (troop_slot_eq, "trp_player", 307, 0), (key_clicked, key_j), (troop_set_slot, "trp_player", 307, 4), #slot307为4启动该左右为男测试玩法 (try_end), (try_begin), (troop_slot_eq, "trp_player", 307, 4), (troop_get_slot, ":var_8", "trp_player", 314), (try_begin), (store_add, ":var_9", ":var_8", 1), (troop_set_slot, "trp_player", 314, ":var_9"), (try_end), (try_begin), (troop_slot_eq, "trp_player", 314, 50), (set_show_messages, 1), (try_end), (store_mod, ":var_9", ":var_8", 20), (scene_prop_get_instance, ":var_20", "spr_ddd", 0), (try_begin), (troop_slot_eq, "trp_player", 318, 3), #slot318和321分别是用于判断左右为男模式中的各种变式玩法,其他的骨骼拼接,这里省略了这个环节,只展示一个拼法,但是此处还是提出来,可以加else来调整不同骨骼拼接方法下刷的人数 (assign, ":var_21", 30), #30是每次刷出的托人的agent数量,而60是每次刷出的被托的人的agent数量 (assign, ":var_22", 60), (try_end), (try_begin), (troop_slot_eq, "trp_player", 321, 3), #同理哦 (assign, ":var_23", 30), (assign, ":var_24", 60), (try_end), (try_begin), (store_normalized_team_count, ":var_25", 0), (neg|ge, ":var_25", 6), #用于判断场景内一方阵营下人数剩余多少,决定是否自动刷兵,敌我双方独立判断,按上面30:60的比例刷出左右为男需要的兵种agent,这是我方的 (eq, ":var_9", 0), (try_for_range, ":var_12", 0, ":var_21"), (prop_instance_get_position, pos1, ":var_20"), (position_move_z, pos1, 5000), (store_random_in_range, ":var_17", -90, 90), (position_rotate_z, pos1, ":var_17"), (store_random_in_range, ":var_18", 1000, 3500), (position_move_y, pos1, ":var_18"), (position_set_z_to_ground_level, pos1), (troop_get_slot, ":var_19", "trp_player", 319), (set_show_messages, 0), (troop_set_slot, "trp_player", 314, 3), (set_spawn_position, pos1), (spawn_agent, ":var_19"), #注意agent刷的兵种情况是开头初始化时slot319等等存的 (agent_set_team, reg0, 0), (agent_add_relation_with_agent, reg0, ":var_1", 1), (troop_get_slot, ":var_26", "trp_player", 322), (agent_set_slot, reg0, 300, ":var_26"), #agent300号slot记录刷出的兵种序号,方便后面通过这个序号进行左右为男的三人一组的分配对应。 (store_add, ":var_27", ":var_26", 1), (troop_set_slot, "trp_player", 322, ":var_27"), (try_end), (try_for_range, ":var_12", 0, ":var_22"), (prop_instance_get_position, pos1, ":var_20"), (position_move_z, pos1, 5000), (store_random_in_range, ":var_17", -90, 90), (position_rotate_z, pos1, ":var_17"), (store_random_in_range, ":var_18", 1000, 3500), (position_move_y, pos1, ":var_18"), (position_set_z_to_ground_level, pos1), (troop_get_slot, ":var_19", "trp_player", 320), (set_show_messages, 0), (troop_set_slot, "trp_player", 314, 3), (set_spawn_position, pos1), (spawn_agent, ":var_19"), (agent_set_team, reg0, 0), (agent_add_relation_with_agent, reg0, ":var_1", 1), (troop_get_slot, ":var_26", "trp_player", 323), (agent_set_slot, reg0, 300, ":var_26"), (store_add, ":var_27", ":var_26", 1), (troop_set_slot, "trp_player", 323, ":var_27"), (try_end), (try_end), (try_begin), (store_normalized_team_count, ":var_25", 1), #同理哦,这是敌方的兵种在人少时刷出判断 (neg|ge, ":var_25", 6), (eq, ":var_9", 0), (try_for_range, ":var_12", 0, ":var_23"), (prop_instance_get_position, pos1, ":var_20"), (position_move_z, pos1, 5000), (store_random_in_range, ":var_18", 6000, 9000), (position_move_y, pos1, ":var_18"), (copy_position, pos2, pos1), (store_random_in_range, ":var_17", -180, 180), (position_rotate_z, pos2, ":var_17"), (store_random_in_range, ":var_18", 0, 2500), (position_move_y, pos2, ":var_18"), (position_set_z_to_ground_level, pos2), (troop_get_slot, ":var_19", "trp_player", 326), (set_show_messages, 0), (troop_set_slot, "trp_player", 314, 3), (set_spawn_position, pos2), (spawn_agent, ":var_19"), (agent_set_team, reg0, 1), (agent_add_relation_with_agent, reg0, ":var_1", -1), (troop_get_slot, ":var_26", "trp_player", 324), (agent_set_slot, reg0, 300, ":var_26"), (store_add, ":var_27", ":var_26", 1), (troop_set_slot, "trp_player", 324, ":var_27"), (try_end), (try_for_range, ":var_12", 0, ":var_24"), (prop_instance_get_position, pos1, ":var_20"), (position_move_z, pos1, 5000), (store_random_in_range, ":var_18", 6000, 9000), (position_move_y, pos1, ":var_18"), (copy_position, pos2, pos1), (store_random_in_range, ":var_17", -180, 180), (position_rotate_z, pos2, ":var_17"), (store_random_in_range, ":var_18", 0, 2500), (position_move_y, pos2, ":var_18"), (position_set_z_to_ground_level, pos2), (troop_get_slot, ":var_19", "trp_player", 327), (set_show_messages, 0), (troop_set_slot, "trp_player", 314, 3), (set_spawn_position, pos2), (spawn_agent, ":var_19"), (agent_set_team, reg0, 1), (agent_add_relation_with_agent, reg0, ":var_1", -1), (troop_get_slot, ":var_26", "trp_player", 325), (agent_set_slot, reg0, 300, ":var_26"), (store_add, ":var_27", ":var_26", 1), (troop_set_slot, "trp_player", 325, ":var_27"), (try_end), (try_end), (try_end),
|
---------------------------------------------------------------------------------- MT trigger条件 (ti_on_agent_killed_or_wounded, 0.000000, 0.000000, ###核心1,目的是判断男上加男模式组成的三人组中,不同人死亡后该怎么脱离。
(store_trigger_param_1, ":var_0"), (agent_get_troop_id, ":var_1", ":var_0"), (agent_get_team, ":var_2", ":var_0"), (agent_get_slot, ":var_5", ":var_0", 300), #slot300是给agent刷出来时编的序号 (try_begin), (troop_slot_eq, "trp_player", 318, 3), (try_begin), (is_between, ":var_5", 0, 50000), (try_for_agents, ":var_6"), (agent_is_human, ":var_6"), (agent_is_alive, ":var_6"), (agent_get_slot, ":var_7", ":var_6", 300), (is_between, ":var_7", 50000, 100000), (val_sub, ":var_7", 50000), (store_mul, ":var_9", ":var_5", 2), (store_add, ":var_10", ":var_9", 1), (try_begin), (eq, ":var_7", ":var_9"), (agent_set_no_dynamics, ":var_6", 0), #如果参与左右为男的负责托人的agent死亡,slot300设-1免于其他循环agent继续操作,no_dynamics设置,让被托的两个人掉下来 (agent_set_slot, ":var_6", 300, -1), (try_end), (try_begin), (eq, ":var_7", ":var_10"), (agent_set_no_dynamics, ":var_6", 0), (agent_set_slot, ":var_6", 300, -1), (try_end), (try_end), (try_end), (else_try), (troop_slot_eq, "trp_player", 321, 3), (try_begin), (is_between, ":var_5", 100000, 150000), (val_sub, ":var_5", 100000), (try_for_agents, ":var_6"), (agent_is_human, ":var_6"), (agent_is_alive, ":var_6"), (agent_get_slot, ":var_7", ":var_6", 300), (is_between, ":var_7", 150000, 200000), (val_sub, ":var_7", 150000), (store_mul, ":var_9", ":var_5", 2), (store_add, ":var_10", ":var_9", 1), (try_begin), (eq, ":var_7", ":var_9"), (agent_set_no_dynamics, ":var_6", 0), (agent_set_slot, ":var_6", 300, -1), (try_end), (try_begin), (eq, ":var_7", ":var_10"), (agent_set_no_dynamics, ":var_6", 0), (agent_set_slot, ":var_6", 300, -1), (try_end), (try_end), (try_end), (try_end),
|
---------------------------------------------------------------------------------- MT trigger条件 (0.000000, 0.000000, 0.000000, ###核心2,将一个人的左上腿骨骼和另一个人右上腿骨骼的设置位置绑定于第三人的左手和右手武器点上,看起来像一个人拎着两个人的裤裆一样,一起移动战斗。
(try_begin), (try_begin), (troop_slot_eq, "trp_player", 318, 3), #提醒下,slot318是前面用过,是判断我方人员的左右为男各种不同骨骼拼接方法的模式,这里阉割为一种,var21-24是判断托人的agent和被托的两个agent分别用于绑定的骨骼序号,用于后面骨骼坐标的获取 (assign, ":var_21", 19), #确认右手骨骼序号,这里可以根据需要修改 (assign, ":var_22", 14), #左手 (assign, ":var_23", 1), #右上腿 (assign, ":var_24", 4), #左上腿 (try_end), (try_for_agents, ":var_14"), (agent_is_human, ":var_14"), (agent_is_alive, ":var_14"), (agent_get_slot, ":var_15", ":var_14", 300), (is_between, ":var_15", 0, 50000), (agent_get_position, pos12, ":var_14"), (2076, 11, ":var_14", ":var_21", 1), #获取骨骼位置坐标,核心op之一,获取的是托人agent的左右手武器点骨骼坐标 (position_copy_rotation, pos11, pos12), (2076, 13, ":var_14", ":var_22", 1), (position_copy_rotation, pos13, pos12), (try_for_agents, ":var_16"), (agent_is_human, ":var_16"), (agent_is_alive, ":var_16"), (agent_get_slot, ":var_17", ":var_16", 300), (is_between, ":var_17", 50000, 100000), #托人agent的右手和被托其中之一agent的右上腿进行坐标的绑定设置位置 (store_sub, ":var_25", ":var_17", 50000), #其中注意看怎么对应的,因为前面代码刷兵时敌我都是分两段刷兵,用agentslot300记录序号,所以这里我方是每个agent的slot300号记录的0-50000序号值与50000-100000进行一一依次对应 (store_mul, ":var_26", ":var_15", 2), (store_add, ":var_27", ":var_26", 1), (try_begin), (eq, ":var_25", ":var_26"), #这里是判断左右为男组合中的右手拼接部分,即右手托另一个人的右大腿 (try_begin), (agent_slot_eq, ":var_16", 307, 0), #slot307用于判断一次设置no_dynamics,取消agent的重力物理效果,可以腾空设置位置,记住,这是核心op之一。 (agent_set_no_dynamics, ":var_16", 1), (agent_set_slot, ":var_16", 307, 1), (try_end), (agent_get_position, pos8, ":var_16"), (2076, 7, ":var_16", ":var_23", 1), #下面的坐标计算很关键,注意看理论总贴中长枪插人和须佐能忽关于骨骼坐标向量的概念,使用相对坐标来将不同agent骨骼位置对到一起 (position_get_x, ":var_28", pos7), (position_get_y, ":var_29", pos7), (position_get_z, ":var_30", pos7), (position_get_x, ":var_31", pos8), (position_get_y, ":var_32", pos8), (position_get_z, ":var_33", pos8), (position_get_x, ":var_34", pos11), (position_get_y, ":var_35", pos11), (position_get_z, ":var_36", pos11), (store_sub, ":var_37", ":var_28", ":var_31"), (store_sub, ":var_38", ":var_29", ":var_32"), (store_sub, ":var_39", ":var_30", ":var_33"), (store_sub, ":var_40", ":var_34", ":var_37"), (store_sub, ":var_41", ":var_35", ":var_38"), (store_sub, ":var_42", ":var_36", ":var_39"), (position_set_x, pos9, ":var_40"), (position_set_y, pos9, ":var_41"), (position_set_z, pos9, ":var_42"), (agent_get_look_position, pos10, ":var_16"), #控制被托agent随着托人agent的视角设置位置,顺应agent的视角方向 (position_copy_rotation, pos9, pos10), (agent_set_position, ":var_16", pos9), (try_end), (try_begin), (eq, ":var_25", ":var_27"), #这里是判断左右为男组合中的左手拼接部分,即左手托另一个人的左大腿 (try_begin), (agent_slot_eq, ":var_16", 307, 0), (agent_set_no_dynamics, ":var_16", 1), (agent_set_slot, ":var_16", 307, 1), (try_end), (agent_get_position, pos8, ":var_16"), (2076, 7, ":var_16", ":var_24", 1), (position_get_x, ":var_28", pos7), (position_get_y, ":var_29", pos7), (position_get_z, ":var_30", pos7), (position_get_x, ":var_31", pos8), (position_get_y, ":var_32", pos8), (position_get_z, ":var_33", pos8), (position_get_x, ":var_34", pos13), (position_get_y, ":var_35", pos13), (position_get_z, ":var_36", pos13), (store_sub, ":var_37", ":var_28", ":var_31"), (store_sub, ":var_38", ":var_29", ":var_32"), (store_sub, ":var_39", ":var_30", ":var_33"), (store_sub, ":var_40", ":var_34", ":var_37"), (store_sub, ":var_41", ":var_35", ":var_38"), (store_sub, ":var_42", ":var_36", ":var_39"), (position_set_x, pos9, ":var_40"), (position_set_y, pos9, ":var_41"), (position_set_z, pos9, ":var_42"), (agent_get_look_position, pos10, ":var_16"), (position_copy_rotation, pos9, pos10), (agent_set_position, ":var_16", pos9), (try_end), (try_end), (try_end), (try_end), #####上面是执行我方兵种的左右为男骨骼拼接绑定位移,下面是执行敌方兵种的左右为男骨骼拼接绑定位移。 (try_begin), (try_begin), (troop_slot_eq, "trp_player", 321, 3), #提醒下,slot321是前面用过,是判断敌方人员左右为男各种不同骨骼拼接方法的模式,这里阉割为一种,var21-24是判断托人的agent和被托的两个agent分别用于绑定的骨骼序号,用于后面骨骼坐标的获取,下面参考我方注释同理 (assign, ":var_21", 19), (assign, ":var_22", 14), (assign, ":var_23", 1), (assign, ":var_24", 4), (try_end), (try_for_agents, ":var_14"), (agent_is_human, ":var_14"), (agent_is_alive, ":var_14"), (agent_get_slot, ":var_15", ":var_14", 300), (is_between, ":var_15", 100000, 150000), (agent_get_position, pos12, ":var_14"), (2076, 11, ":var_14", ":var_21", 1), (position_copy_rotation, pos11, pos12), (2076, 13, ":var_14", ":var_22", 1), (position_copy_rotation, pos13, pos12), (try_for_agents, ":var_16"), (agent_is_human, ":var_16"), (agent_is_alive, ":var_16"), (agent_get_slot, ":var_17", ":var_16", 300), (is_between, ":var_17", 150000, 200000), (store_sub, ":var_44", ":var_15", 100000), (store_sub, ":var_25", ":var_17", 150000), (store_mul, ":var_26", ":var_44", 2), (store_add, ":var_27", ":var_26", 1), (try_begin), (eq, ":var_25", ":var_26"), (try_begin), (agent_slot_eq, ":var_16", 307, 0), (agent_set_no_dynamics, ":var_16", 1), (agent_set_slot, ":var_16", 307, 1), (try_end), (agent_get_position, pos8, ":var_16"), (2076, 7, ":var_16", ":var_23", 1), (position_get_x, ":var_28", pos7), (position_get_y, ":var_29", pos7), (position_get_z, ":var_30", pos7), (position_get_x, ":var_31", pos8), (position_get_y, ":var_32", pos8), (position_get_z, ":var_33", pos8), (position_get_x, ":var_34", pos11), (position_get_y, ":var_35", pos11), (position_get_z, ":var_36", pos11), (store_sub, ":var_37", ":var_28", ":var_31"), (store_sub, ":var_38", ":var_29", ":var_32"), (store_sub, ":var_39", ":var_30", ":var_33"), (store_sub, ":var_40", ":var_34", ":var_37"), (store_sub, ":var_41", ":var_35", ":var_38"), (store_sub, ":var_42", ":var_36", ":var_39"), (position_set_x, pos9, ":var_40"), (position_set_y, pos9, ":var_41"), (position_set_z, pos9, ":var_42"), (agent_get_look_position, pos10, ":var_16"), (position_copy_rotation, pos9, pos10), (agent_set_position, ":var_16", pos9), (try_end), (try_begin), (eq, ":var_25", ":var_27"), (try_begin), (agent_slot_eq, ":var_16", 307, 0), (agent_set_no_dynamics, ":var_16", 1), (agent_set_slot, ":var_16", 307, 1), (try_end), (agent_get_position, pos8, ":var_16"), (2076, 7, ":var_16", ":var_24", 1), (position_get_x, ":var_28", pos7), (position_get_y, ":var_29", pos7), (position_get_z, ":var_30", pos7), (position_get_x, ":var_31", pos8), (position_get_y, ":var_32", pos8), (position_get_z, ":var_33", pos8), (position_get_x, ":var_34", pos13), (position_get_y, ":var_35", pos13), (position_get_z, ":var_36", pos13), (store_sub, ":var_37", ":var_28", ":var_31"), (store_sub, ":var_38", ":var_29", ":var_32"), (store_sub, ":var_39", ":var_30", ":var_33"), (store_sub, ":var_40", ":var_34", ":var_37"), (store_sub, ":var_41", ":var_35", ":var_38"), (store_sub, ":var_42", ":var_36", ":var_39"), (position_set_x, pos9, ":var_40"), (position_set_y, pos9, ":var_41"), (position_set_z, pos9, ":var_42"), (agent_get_look_position, pos10, ":var_16"), (position_copy_rotation, pos9, pos10), (agent_set_position, ":var_16", pos9), (try_end), (try_end), (try_end), (try_end),
|
|