骑砍战团MOD开发(28)-骑砍联盟之RTS大规模军团竞技
2023-12-30 15:32:06
骑砍1战团mod开发-欢迎来到骑砍联盟(RTS大规模军团竞技)_哔哩哔哩_bilibili
一.小地图presentation
("RTS_battle_display", 0, 0, [
(ti_on_presentation_load, [
(set_fixed_point_multiplier, 1000),
(get_scene_boundaries, pos2, pos3),
(position_transform_position_to_local, pos4, pos2, pos3),
(set_fixed_point_multiplier, 1000),
(position_get_x, ":map_width", pos4),
(position_get_y, ":map_height", pos4),
(set_fixed_point_multiplier, 1000),
(store_div, ":map_ratio", ":map_height", 100),
(store_div, ":map_ratio", ":map_width", ":map_ratio"),
(try_begin),
(gt, ":map_ratio", 100),
(assign, "$g_battle_map_width", 300),
(store_div, "$g_battle_map_scale", ":map_width", "$g_battle_map_width"),
(store_div, "$g_battle_map_height", ":map_height", "$g_battle_map_scale"),
(else_try),
(assign, "$g_battle_map_height", 300),
(store_div, "$g_battle_map_scale", ":map_height", "$g_battle_map_height"),
(store_div, "$g_battle_map_width", ":map_width", "$g_battle_map_scale"),
(try_end),
(create_image_button_overlay, "$g_RTS_battle_map_plane", "mesh_white_plane", "mesh_white_plane"),
(overlay_set_color, "$g_RTS_battle_map_plane", 0),
(store_add, ":map_bordered_width", "$g_battle_map_width", 20),
(store_add, ":map_bordered_height", "$g_battle_map_height", 20),
(store_mul, ":map_scale_x", ":map_bordered_width", 50),
(store_mul, ":map_scale_y", ":map_bordered_height", 50),
(position_set_x, pos1, ":map_scale_x"),
(position_set_y, pos1, ":map_scale_y"),
(overlay_set_size, "$g_RTS_battle_map_plane", pos1),
(store_sub, ":map_pos_x", 990, ":map_bordered_width"),
(store_sub, ":map_pos_y", 740, ":map_bordered_height"),
(position_set_x, pos1, ":map_pos_x"),
(position_set_y, pos1, ":map_pos_y"),
(overlay_set_position, "$g_RTS_battle_map_plane", pos1),
(overlay_set_alpha, "$g_RTS_battle_map_plane", 0x44),
(create_image_button_overlay, "$g_RTS_battle_camera_plane", "mesh_white_plane", "mesh_white_plane"),
(position_set_x, pos1, 800),
(position_set_y, pos1, 800),
(overlay_set_color, "$g_RTS_battle_camera_plane", 0x337540),
(overlay_set_size,"$g_RTS_battle_camera_plane", pos1),
(call_script, "script_RTS_update_map_display"),
(create_image_button_overlay, "$g_RTS_battle_mouse_flag", "mesh_entry_arrow", "mesh_entry_arrow"),
(position_set_x, pos1, 100),
(position_set_y, pos1, 100),
(overlay_set_size, "$g_RTS_battle_mouse_flag", pos1),
(position_set_x, pos1, -10),
(position_set_y, pos1, -10),
(overlay_set_position, "$g_RTS_battle_mouse_flag", pos1),
(presentation_set_duration, 999999),
]),
(ti_on_presentation_run, [
(set_fixed_point_multiplier, 1000),
(call_script, "script_RTS_update_map_display"),
]),
(ti_on_presentation_mouse_press, [
(store_trigger_param_1, ":object"),
(store_trigger_param_2, ":mouse_state"),
(get_scene_boundaries, pos2, pos3),
(try_begin),
(eq, ":object", "$g_RTS_battle_map_plane"),
(eq, ":mouse_state", 0),
(mouse_get_position, pos1),
(call_script, "script_convert_map_pos_to_3d_pos"),
(position_get_x, ":3d_cam_x", pos0),
(position_get_y, ":3d_cam_y", pos0),
(init_position, pos2),
(mission_cam_get_position, pos2),
(position_set_x, pos2, ":3d_cam_x"),
(position_set_y, pos2, ":3d_cam_y"),
(mission_cam_set_position, pos2),
(try_end),
]),
]),
二.RTS视角切换
(0.0, 0, 0.1, [(key_is_down,key_numpad_4),(eq, "$g_battle_RTS_on", 0)],[
#50 9 23 37
(init_position, pos1),
(init_position, pos2),
(init_position, pos3),
(get_player_agent_no, ":player_agent"),
(agent_get_horse, ":player_horse", ":player_agent"),
(agent_set_no_dynamics, ":player_agent", 1),
(try_begin),
(neq, ":player_horse", -1),
(agent_set_no_dynamics, ":player_horse", 1),
(try_end),
#only contain rotate z angle
(mission_cam_set_mode, 1, 1, 0),
(mission_cam_get_position, pos1),
(position_set_z_to_ground_level, pos1),
(position_get_rotation_around_z, ":cam_rotation_around_z", pos1),
(position_copy_origin, pos2, pos1),
(position_rotate_z, pos2, ":cam_rotation_around_z"),
##relocate cam position
(position_move_y, pos2, -800),
(position_move_z, pos2, 1000),
(position_rotate_x, pos2, -30),
(mission_cam_set_position, pos2),
(start_presentation, "prsnt_RTS_battle_display"),
(assign, "$g_battle_RTS_on", 1),
(play_sound, "snd_lol_ns"),
]),
(0.0, 0, 0.2, [(key_is_down, key_right_mouse_button),(eq, "$g_battle_RTS_on", 1)],[
(mouse_get_position, pos3),
(position_get_y, ":mouse_y", pos3),
(val_sub, ":mouse_y", 10),
(position_set_y, pos3, ":mouse_y"),
#(overlay_set_alpha, "$g_RTS_battle_mouse_flag", 0),
(overlay_set_position, "$g_RTS_battle_mouse_flag", pos3),
#(overlay_animate_to_alpha, "$g_RTS_battle_mouse_flag", 200, 1),
(call_script, "script_RTS_mouse_pos_to_3D_pos"),
(try_for_agents, ":agent_no"),
(try_begin),
(agent_is_alive, ":agent_no"),
(agent_is_ally, ":agent_no"),
(agent_is_human, ":agent_no"),
(agent_set_scripted_destination, ":agent_no", pos2),
(try_end),
(try_end),
(play_sound, "snd_lol_qjcj"),
]),
(0.0, 0, 0.2, [(key_is_down, key_space),(eq, "$g_battle_RTS_on", 1)],[
(call_script, "script_RTS_mouse_pos_to_3D_pos"),
(set_spawn_position, pos2),
(spawn_agent, "trp_kingdom_1_lord"),
(agent_set_team, reg0, 1),
]),
(0.0, 0, 0.1, [(key_is_down,key_numpad_5),(eq, "$g_battle_RTS_on", 1)],[
(mission_cam_set_mode, 0, 1, 0),
(get_player_agent_no, ":player_agent"),
(agent_get_horse, ":player_horse", ":player_agent"),
(agent_set_no_dynamics, ":player_agent", 0),
(try_begin),
(neq, ":player_horse", -1),
(agent_set_no_dynamics, ":player_horse", 0),
(try_end),
(presentation_set_duration, 0),
(assign, "$g_battle_RTS_on", 0),
(play_sound, "snd_lol_reconn"),
]),
(0.0, 0, 0.1, [(game_key_is_down, gk_move_left),(eq, "$g_battle_RTS_on", 1)],[
(init_position, pos2),
(mission_cam_get_position, pos2),
(position_rotate_x, pos2, 30),
(position_move_x, pos2, -500),
(position_rotate_x, pos2, -30),
(mission_cam_animate_to_position, pos2, 300, 0),
]),
(0.0, 0, 0.1, [(game_key_is_down, gk_move_right),(eq, "$g_battle_RTS_on", 1)],[
(init_position, pos2),
(mission_cam_get_position, pos2),
(position_rotate_x, pos2, 30),
(position_move_x, pos2, 500),
(position_rotate_x, pos2, -30),
(mission_cam_animate_to_position, pos2, 300, 0),
]),
(0.0, 0, 0.1, [(game_key_is_down,gk_move_forward),(eq, "$g_battle_RTS_on", 1)],[
(init_position, pos2),
(mission_cam_get_position, pos2),
(position_rotate_x, pos2, 30),
(position_move_y, pos2, 500),
(position_rotate_x, pos2, -30),
(mission_cam_animate_to_position, pos2, 300, 0),
]),
(0.0, 0, 0.1, [(game_key_is_down,gk_move_backward),(eq, "$g_battle_RTS_on", 1)],[
(init_position, pos2),
(mission_cam_get_position, pos2),
(position_rotate_x, pos2, 30),
(position_move_y, pos2, -500),
(position_rotate_x, pos2, -30),
(mission_cam_animate_to_position, pos2, 300, 0),
]),
三.新增函数
# RTS_update_map_display
# Input: none
# Output: none
("RTS_update_map_display", [
(get_scene_boundaries, pos2, pos3),
(try_for_agents,":cur_agent"),
(agent_is_human, ":cur_agent"),
(agent_get_division, ":agent_division", ":cur_agent"),
(agent_get_party_id, ":agent_party", ":cur_agent"),
(agent_get_slot, ":agent_overlay", ":cur_agent", slot_agent_map_overlay_id),
(try_begin),
(eq, ":agent_party", "p_main_party"),
(try_begin),
(agent_is_alive, ":cur_agent"),
(call_script, "script_update_agent_position_on_map", ":cur_agent"),
(else_try),
(overlay_set_alpha, ":agent_overlay", 0),
(try_end),
(else_try),
(agent_is_ally, ":cur_agent"),
(try_begin),
(agent_is_alive, ":cur_agent"),
(call_script, "script_update_agent_position_on_map", ":cur_agent"),
(else_try),
(overlay_set_alpha, ":agent_overlay", 0),
(try_end),
(else_try),
(try_begin),
(agent_is_alive, ":cur_agent"),
(call_script, "script_update_agent_position_on_map", ":cur_agent"),
(else_try),
(overlay_set_alpha, ":agent_overlay", 0),
(try_end),
(try_end),
(try_end),
##update RTS camera center display
(init_position, pos1),
(mission_cam_get_position, pos1),
(position_set_z_to_ground_level, pos1),
(position_move_y, pos1, 600),
(call_script, "script_convert_3d_pos_to_map_pos"),
(overlay_set_position, "$g_RTS_battle_camera_plane", pos0),
]),
# RTS_mouse_pos_to_3D_pos
# Input: none
# Output: pos2
("RTS_mouse_pos_to_3D_pos", [
(mouse_get_position, pos3),
(position_get_x, ":mouse_x", pos3),
(position_get_y, ":mouse_y", pos3),
(val_div, ":mouse_x", 10),
(val_div, ":mouse_y", 10),
(store_sub, ":mouse_x_offset", ":mouse_x", 50),
(store_sub, ":mouse_y_offset", ":mouse_y", 0),
(store_mul, ":pos_x_offset", ":mouse_x_offset", 7),
(store_mul, ":pos_y_offset", ":mouse_y_offset", 80),
(call_script, "script_math_get_square_root", ":mouse_y"),
(val_mul, ":pos_x_offset", reg1),
(val_mul, ":pos_y_offset", ":mouse_y"),
(val_div, ":pos_y_offset", 75),
(init_position, pos1),
(init_position, pos2),
(mission_cam_get_position, pos1),
(position_set_z_to_ground_level, pos1),
(position_get_rotation_around_z, ":cam_rotation_around_z", pos1),
(position_copy_origin, pos2, pos1),
(position_rotate_z, pos2, ":cam_rotation_around_z"),
(position_move_y, pos2, 450),
(position_move_y, pos2, ":pos_y_offset"),
(position_move_x, pos2, ":pos_x_offset"),
]),
# math_get_square_root
# Input: int
# Output: reg1
("math_get_square_root", [
(store_script_param, ":val", 1),
(assign, ":flag", 0),
(try_for_range, ":index", 0, 10),
(store_mul, ":square_rst", ":index", ":index"),
(try_begin),
(gt, ":square_rst", ":val"),
(eq, ":flag", 0),
(store_sub, ":sqare_root_rst", ":index", 1),
(assign, reg1, ":sqare_root_rst"),
(assign, ":flag", 1),
(try_end),
(try_end),
]),
# script_convert_map_pos_to_3d_pos
# Input: pos1 = map_pos, pos2 = map_size_pos
# Output: pos0 = 3d_pos
("convert_map_pos_to_3d_pos",[
(set_fixed_point_multiplier, 1000),
(position_get_x, ":agent_x_pos", pos1),
(position_get_y, ":agent_y_pos", pos1),
(store_sub, ":map_x", 980, "$g_battle_map_width"),
(store_sub, ":map_y", 730, "$g_battle_map_height"),
(val_sub, ":agent_x_pos", ":map_x"),
(val_sub, ":agent_y_pos", ":map_y"),
(val_mul, ":agent_x_pos", "$g_battle_map_scale"),
(val_mul, ":agent_y_pos", "$g_battle_map_scale"),
(position_set_x, pos1, ":agent_x_pos"),
(position_set_y, pos1, ":agent_y_pos"),
(position_transform_position_to_parent, pos0, pos2, pos1),
]),
文章来源:https://blog.csdn.net/qq_35829452/article/details/135305251
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!