搜索结果: *

  1. Modding Q&A [For Quick Questions and Answers]

    Dj_FRedy 说:
    I tried to adapt the script to multiplayer mode, now it works in agent_bots this way:
    插入代码块:
    multiplayer_agent_hp_bar = (
    	0, 0, 0,
    		[],
    		[
    			(multiplayer_is_server),
    			(start_presentation, "prsnt_multiplayer_agent_hp_bar"),
    		])
    插入代码块:
    multiplayer_agent_hp_bar,
    插入代码块:
    	("multiplayer_agent_hp_bar", prsntf_read_only, 0,
    		[
    			(ti_on_presentation_load,
    				[
    					(set_fixed_point_multiplier, 1000),
    
    					(get_max_players, ":num_players"),
    					(try_for_range, ":player_no", 0, ":num_players"),
    						(player_is_active, ":player_no"),
    						(neg|player_is_busy_with_menus, ":player_no"),
    
    						(player_get_team_no, ":player_team", ":player_no"),
    						(lt, ":player_team", multi_team_spectator),
    
    						(player_get_troop_id, ":player_troop", ":player_no"),
    						(ge, ":player_troop", 0),
    
    						(player_get_agent_id, ":player_agent", ":player_no"),
    						(ge, ":player_agent", 0),
    
    						(try_for_agents, ":agent_no"),
    							(agent_is_human, ":agent_no"),
    							(neq, ":agent_no", ":player_agent"),
    
    							(try_begin),
    								(agent_is_alive, ":agent_no"),
    								(agent_get_team, ":agent_team", ":agent_no"),
    
    								#hp bg
    								(create_mesh_overlay, ":agent_hp_bg_overlay", "mesh_white_plane"),
    								(overlay_set_alpha, ":agent_hp_bg_overlay", 0x44),
    								(overlay_set_color, ":agent_hp_bg_overlay", 0x000000),
    
    								#hp
    								(create_mesh_overlay, ":agent_hp_overlay", "mesh_white_plane"),
    								(overlay_set_alpha, ":agent_hp_overlay", 0x44),
    								(try_begin),
    									(eq, ":agent_team", ":player_team"),
    									(overlay_set_color, ":agent_hp_overlay", 0x00FF00), #green
    								(else_try),
    									(overlay_set_color, ":agent_hp_overlay", 0xFF0000), #red
    								(try_end),
    
    								#size & position
    								(agent_get_position, pos1, ":agent_no"),
    								(agent_get_horse, ":horse_agent", ":agent_no"),
    								(try_begin),
    									(ge, ":horse_agent", 0),
    									(position_move_z, pos1, 280, 1),
    								(else_try),
    									(position_move_z, pos1, 180, 1),
    								(try_end),
    								(position_get_screen_projection, pos2, pos1),
    								(position_get_x, ":head_x_pos", pos2),
    								(position_get_y, ":head_y_pos", pos2),
    
    								#base size
    								(copy_position, pos6, pos1),
    								(copy_position, pos7, pos1),
    								(position_move_z, pos7, 100, 1),
    								(position_get_screen_projection, pos6, pos6),
    								(position_get_screen_projection, pos7, pos7),
    								(position_get_y, ":screen_y_pos_1", pos6),
    								(position_get_y, ":screen_y_pos_2", pos7),
    								(store_sub, ":base_x", ":screen_y_pos_2", ":screen_y_pos_1"),
    								(val_clamp, ":base_x", 20, 161),
    								(store_div, ":base_y", ":base_x", 20),
    								(try_begin),
    									(is_between, ":head_x_pos", -100, 1100),
    									(is_between, ":head_y_pos", -100, 850),
    									(agent_get_position, pos3, ":agent_no"),
    									(agent_get_position, pos4, ":player_agent"),
    									(get_distance_between_positions_in_meters, ":distance", pos3, pos4),
    									#---------------------------------------------------------
    									(le, ":distance", 80), #distance limit for showing HP bars
    									#---------------------------------------------------------
    
    									#agent no
    									(agent_get_horse, ":horse_agent", ":agent_no"),
    									(try_begin),
    										(ge, ":horse_agent", 0),
    										(position_move_z, pos3, 280, 1),
    									(else_try),
    										(position_move_z, pos3, 180, 1),
    									(try_end),
    									#player agent
    									(agent_get_horse, ":player_horse", ":player_agent"),
    									(try_begin),
    										(ge, ":player_horse", 0),
    										(position_move_z, pos4, 280, 1),
    									(else_try),
    										(position_move_z, pos4, 180, 1),
    									(try_end),
    									(position_move_z, pos3, 50, 1),
    									(position_move_z, pos4, 50, 1),
    									(position_has_line_of_sight_to_position, pos3, pos4),
    
    									#hp bg
    									(assign, ":x_offset", ":base_x"),
    									(val_div, ":x_offset", 2),
    									(val_add, ":x_offset", 1),
    									(store_sub, ":hp_bg_x", ":head_x_pos", ":x_offset"),
    									(store_sub, ":hp_bg_y", ":head_y_pos", 1),
    									(position_set_x, pos1, ":hp_bg_x"),
    									(position_set_y, pos1, ":hp_bg_y"),
    									(overlay_set_position, ":agent_hp_bg_overlay", pos1),
    									(store_add, ":bg_width", ":base_x", 2),
    									(val_mul, ":bg_width", 50),
    									(store_add, ":bg_height", ":base_y", 2),
    									(val_mul, ":bg_height", 50),
    									(position_set_x, pos1, ":bg_width"),
    									(position_set_y, pos1, ":bg_height"),
    									(overlay_set_size, ":agent_hp_bg_overlay", pos1),
    									(overlay_set_alpha, ":agent_hp_bg_overlay", 0x66),
    
    									#hp
    									(store_add, ":hp_x", ":hp_bg_x", 1),
    									(store_add, ":hp_y", ":hp_bg_y", 1),
    									(position_set_x, pos1, ":hp_x"),
    									(position_set_y, pos1, ":hp_y"),
    									(overlay_set_position, ":agent_hp_overlay", pos1),
    									(store_agent_hit_points, ":agent_hp", ":agent_no"),
    									(store_mul, ":hp_width", ":agent_hp", 50),
    									(val_mul, ":hp_width", ":base_x"),
    									(val_div, ":hp_width", 100),
    									(val_min, ":hp_width", ":bg_width"),
    									(store_mul, ":hp_height", ":base_y", 50),
    									(position_set_x, pos1, ":hp_width"),
    									(position_set_y, pos1, ":hp_height"),
    									(overlay_set_size, ":agent_hp_overlay", pos1),
    
    									#text (disabled) showing hit points relative
    									# (assign, reg7, ":agent_hp"),
    									# (create_text_overlay, ":agent_hp_overlay", "@_{reg7}_", tf_center_justify|tf_with_outline),
    									# (overlay_set_alpha, ":agent_hp_overlay", 0x44),
    									# (try_begin),
    										# (eq, ":agent_team", ":player_team"),
    										# (overlay_set_color, ":agent_hp_overlay", 0x00FF00), #green
    									# (else_try),
    										# (overlay_set_color, ":agent_hp_overlay", 0xFF0000), #red
    									# (try_end),
    									# (position_set_x, pos1, ":hp_bg_x"),
    									# (position_set_y, pos1, ":hp_bg_y"),
    									# (overlay_set_position, ":agent_hp_overlay", pos1),
    									# (position_set_x, pos1, 400),
    									# (position_set_y, pos1, 400),
    									# (overlay_set_size, ":agent_hp_overlay", pos1),
    
    								(else_try),
    									(overlay_set_alpha, ":agent_hp_bg_overlay", 0),
    									(overlay_set_alpha, ":agent_hp_overlay", 0),
    								(try_end),
    							(try_end),
    						(try_end),
    					(try_end),
    				]
    			),
    		]
    	),
    I have removed the slots in case you want to delete them from 'module_constants'.
    It's great. There are no words to show my appreciation!Thank you so much!
  2. Modding Q&A [For Quick Questions and Answers]

    [Bcw]Btm_Earendil 说:
    get_player_agent_no for example is an operation only getting used at singleplayer, it should be agent_get_player_id (I think, not sure at the moment). Check header_operations for this.
    It not worked. I don't know how to fix it.
    Module script:
    插入代码块:
    #$script HP bar
     ("set_hp_bar",
       [
        (set_fixed_point_multiplier, 1000),
    	
        (multiplayer_get_my_player, ":my_player"),
        (multiplayer_get_my_team,":my_team"),     
        (try_for_agents,":agent_id"),
          (agent_is_human, ":agent_id"),
          (agent_is_alive, ":agent_id"),
          (agent_get_player_id, ":player_id", ":agent_id"), 
          (neq, ":player_id", ":my_player"),      
          (agent_get_slot, ":agent_hp_overlay", ":agent_id", slot_agent_hp_bar_overlay_id),
          (agent_get_slot, ":agent_hp_bg_overlay", ":agent_id", slot_agent_hp_bar_bg_overlay_id),      
          (try_begin),      
            (try_begin),
              (le, ":agent_hp_overlay", 0),
              (le, ":agent_hp_bg_overlay", 0),        
              (set_fixed_point_multiplier, 1000),
              (try_begin),           
                # hp bg
                (create_mesh_overlay, reg1, "mesh_white_plane"),
                (overlay_set_alpha, reg1, 0x44),
                (agent_set_slot, ":agent_id", slot_agent_hp_bar_bg_overlay_id, reg1),
                (assign, ":agent_hp_bg_overlay", reg1),
                # hp
                (create_mesh_overlay, reg1, "mesh_white_plane"),
                (overlay_set_alpha, reg1, 0x44),
                (agent_set_slot, ":agent_id", slot_agent_hp_bar_overlay_id, reg1),
                (assign, ":agent_hp_overlay", reg1),
              (try_end),
            (try_end),
            
            # color		       
            (agent_get_team, ":agent_team", ":agent_id"),
            (agent_get_troop_id, ":troop_id", ":agent_id"),
            (try_begin),         
                (this_or_next|eq,":troop_id","trp_luubi"),
                (eq,":troop_id","trp_taothao"),                                
                (assign, ":dest_color", 0xFFE500),
                (else_try),
                (eq, ":agent_team", ":my_team"),
                (assign, ":dest_color", 0x00FF00),
                (else_try),
                (assign, ":dest_color", 0xFF0000),#$0xFF0000 do 
            (try_end),
            
            (try_begin),
              (gt, ":agent_hp_overlay", 0),
              (gt, ":agent_hp_bg_overlay", 0),
              (overlay_set_color, ":agent_hp_overlay", ":dest_color"),
              (overlay_set_color, ":agent_hp_bg_overlay", 0x000000),
            (try_end),
    		
            (gt, ":agent_hp_overlay", 0),
            
            (agent_get_position, pos1, ":agent_id"),
            (agent_get_horse, ":horse_agent", ":agent_id"),
            (try_begin),
              (ge, ":horse_agent", 0),
              (position_move_z, pos1, 280, 1),
            (else_try),
              (position_move_z, pos1, 180, 1),
            (try_end),
            (position_get_screen_projection, pos3, pos1),
            (position_get_x, ":head_x_pos", pos3),
            (position_get_y, ":head_y_pos", pos3),
            # base size
            (copy_position, pos6, pos1),
            (copy_position, pos7, pos1),
            (position_move_z, pos7, 100, 1),
            (position_get_screen_projection, pos6, pos6),
            (position_get_screen_projection, pos7, pos7),
            (position_get_y, ":screen_y_pos_1", pos6),
            (position_get_y, ":screen_y_pos_2", pos7),
            (store_sub, ":base_x", ":screen_y_pos_2", ":screen_y_pos_1"),
            (val_mul, ":base_x", 3),
            (val_div, ":base_x", 4),
            (val_clamp, ":base_x", 20, 161),
            (store_div, ":base_y", ":base_x", 15),#$hpbar 20
            (try_begin),
              (is_between, ":head_x_pos", -100, 1100),
              (is_between, ":head_y_pos", -100, 850),
              (agent_get_position, pos2, ":agent_id"),
              (agent_get_position, pos4, ":my_player"),
              (get_distance_between_positions_in_meters, ":distance", pos2, pos4),
              (le, ":distance", 80),#$"$g_hp_bar_dis_limit"
              # agent no
              (agent_get_horse, ":horse_agent", ":agent_id"),
              (try_begin),
                (ge, ":horse_agent", 0),
                (position_move_z, pos2, 280, 1),
              (else_try),
                (position_move_z, pos2, 180, 1),
              (try_end),
              # player agent
              (agent_get_horse, ":my_horse", ":my_player"),
              (try_begin),
                (ge, ":my_horse", 0),
                (position_move_z, pos4, 280, 1),
              (else_try),
                (position_move_z, pos4, 180, 1),
              (try_end),
              (position_move_z, pos2, 50, 1),
              (position_move_z, pos4, 50, 1),
              (position_has_line_of_sight_to_position, pos2, pos4),
    
              (try_begin),
                (gt, ":agent_hp_overlay", 0),
                (gt, ":agent_hp_bg_overlay", 0),
                ## hp bg
                (assign, ":x_offset", ":base_x"),
                (val_div, ":x_offset", 2),
                (val_add, ":x_offset", 1),
                (store_sub, ":hp_bg_x", ":head_x_pos", ":x_offset"),
                (store_sub, ":hp_bg_y", ":head_y_pos", 1),
                (position_set_x, pos1, ":hp_bg_x"),
                (position_set_y, pos1, ":hp_bg_y"),
                (overlay_set_position, ":agent_hp_bg_overlay", pos1),
                (store_add, ":bg_width", ":base_x", 2),
                (val_mul, ":bg_width", 50),
                (store_add, ":bg_height", ":base_y", 2),
                (val_mul, ":bg_height", 50),
                (position_set_x, pos1, ":bg_width"),
                (position_set_y, pos1, ":bg_height"),
                (overlay_set_size, ":agent_hp_bg_overlay", pos1),
                (overlay_set_alpha, ":agent_hp_bg_overlay", 0x44),
                ## hp
                (store_add, ":hp_x", ":hp_bg_x", 1),
                (store_add, ":hp_y", ":hp_bg_y", 1),
                (position_set_x, pos1, ":hp_x"),
                (position_set_y, pos1, ":hp_y"),
                (overlay_set_position, ":agent_hp_overlay", pos1),
                (store_agent_hit_points, ":agent_hp",":agent_id"),
                (store_mul, ":hp_width", ":agent_hp", 50),
                (val_mul, ":hp_width", ":base_x"),
                (val_div, ":hp_width", 100),
                (val_min, ":hp_width", ":bg_width"),
                (store_mul, ":hp_height", ":base_y", 50),
                (position_set_x, pos1, ":hp_width"),
                (position_set_y, pos1, ":hp_height"),
                (overlay_set_size, ":agent_hp_overlay", pos1),
                (overlay_set_alpha, ":agent_hp_overlay", 0x44),
              (try_end),            
     
            (else_try),
              (overlay_set_alpha, ":agent_hp_overlay", 0),
              (overlay_set_alpha, ":agent_hp_bg_overlay", 0),
            (try_end),
          (else_try),
            (try_begin),
              (gt, ":agent_hp_overlay", 0),
              (gt, ":agent_hp_bg_overlay", 0),
              (overlay_set_alpha, ":agent_hp_overlay", 0),
              (overlay_set_alpha, ":agent_hp_bg_overlay", 0),
            (try_end),
            (agent_set_slot, ":agent_id", slot_agent_hp_bar_overlay_id, 0),
            (agent_set_slot, ":agent_id", slot_agent_hp_bar_bg_overlay_id, 0),
          (try_end),         
        (try_end),
      ]),
    My 'rgl' log:
    插入代码块:
     SCRIPT ERROR ON OPCODE 922: Invalid Overlay ID: 1; LINE NO: 128: 
     At script: set_hp_bar. At script: set_hp_bar. SCRIPT ERROR ON OPCODE 922: Invalid Overlay ID: 0; LINE NO: 129: 
     At script: set_hp_bar. At script: set_hp_bar. At script: set_hp_bar. At script: set_hp_bar. At script: set_hp_bar. At Mission Template mst_multiplayer_ccoop trigger no: 3 consequences. At Mission Template mst_multiplayer_ccoop trigger no: 3 consequences.
  3. Modding Q&A [For Quick Questions and Answers]

    Dj_FRedy 说:
    Your 'rgl_log' shows something of why it crashes?
    My 'rgl_log' shows :
    插入代码块:
     SCRIPT WARNING ON OPCODE 1770: Invalid Agent ID: -1; LINE NO: 32: 
     At script: update_agent_hp_bar. At script: update_agent_hp_bar. SCRIPT WARNING ON OPCODE 1702: Invalid Agent ID: -1; LINE NO: 75: 
     At script: update_agent_hp_bar. At script: update_agent_hp_bar. SCRIPT WARNING ON OPCODE 2076: Invalid Agent ID: -1; LINE NO: 76:
    Please help me. Thank you!
  4. Modding Q&A [For Quick Questions and Answers]

    I'm trying to code a dynamically generated health bar above a agent. Rubik's custom commander had this but i don't know put it in multiplayer.
    It worked but i press tab  or prsnt_multiplayer_escape_menu, choice faction... then game crash .I hope you can help me. Thank you!
    Module mission_templates.py
    插入代码块:
    common_battle_order_panel_tick = (
      0, 0, 0, [],
      [
        (try_begin),
          (neg|is_presentation_active, "prsnt_mini_map"),
          (start_presentation, "prsnt_mini_map"),
        (try_end),
        (try_begin),
          (is_presentation_active, "prsnt_mini_map"),
          (neg|is_presentation_active, "prsnt_multiplayer_escape_menu"),
          (neg|is_presentation_active, "prsnt_multiplayer_team_select"),
          (neg|is_presentation_active, "prsnt_multiplayer_stats_chart_deathmatch"),
          (neg|is_presentation_active, "prsnt_multiplayer_stats_chart"),
          (call_script, "script_update_agent_hp_bar"),
        (try_end),
        ])

    Module script.py
    插入代码块:
    ("update_agent_hp_bar",
       [
        (set_fixed_point_multiplier, 1000),
      
        (get_player_agent_no, ":player_agent"),
        (try_for_agents,":agent_no"),
          (agent_is_human, ":agent_no"),
          (neq, ":agent_no", ":player_agent"),
          (agent_get_slot, ":agent_hp_overlay", ":agent_no", slot_agent_hp_bar_overlay_id),
          (agent_get_slot, ":agent_hp_bg_overlay", ":agent_no", slot_agent_hp_bar_bg_overlay_id),
          #(agent_get_slot, ":agent_name_overlay", ":agent_no", slot_agent_name_overlay_id),
          (try_begin),
            (agent_is_alive, ":agent_no"),
            # (agent_get_slot, ":agent_hp_overlay", ":agent_no", slot_agent_hp_bar_overlay_id),
            # (agent_get_slot, ":agent_hp_bg_overlay", ":agent_no", slot_agent_hp_bar_bg_overlay_id),
            # (agent_get_slot, ":agent_name_overlay", ":agent_no", slot_agent_name_overlay_id),
            
            (assign, ":create_hp_bar", 0),
            #(assign, ":create_name", 0),
            (try_begin), # create or not
              (agent_is_ally, ":agent_no"),
              (assign, ":create_hp_bar", 1),
              #(assign, ":create_name", "$g_name_of_ally"),
            (else_try),
              (assign, ":create_hp_bar", 1),
              #(assign, ":create_name", "$g_name_of_enemy"),
            (try_end),
            
            (try_begin),
              (le, ":agent_hp_overlay", 0),
              (le, ":agent_hp_bg_overlay", 0),
              #(le, ":agent_name_overlay", 0),
              (set_fixed_point_multiplier, 1000),
              (try_begin),
                (eq, ":create_hp_bar", 1),
                # hp bg
                (create_mesh_overlay, reg1, "mesh_white_plane"),
                (overlay_set_alpha, reg1, 0x44),
                (agent_set_slot, ":agent_no", slot_agent_hp_bar_bg_overlay_id, reg1),
                (assign, ":agent_hp_bg_overlay", reg1),
                # hp
                (create_mesh_overlay, reg1, "mesh_white_plane"),
                (overlay_set_alpha, reg1, 0x44),
                (agent_set_slot, ":agent_no", slot_agent_hp_bar_overlay_id, reg1),
                (assign, ":agent_hp_overlay", reg1),
              (try_end),
              # (try_begin),
                # (eq, ":create_name", 1),
                ## name
                # (agent_get_troop_id, ":troop_id", ":agent_no"),
                # (str_store_troop_name, s1, ":troop_id"),
                # (create_text_overlay, reg1, "@{s1}", tf_center_justify),
                # (overlay_set_alpha, reg1, 0xCC),
                # (agent_set_slot, ":agent_no", slot_agent_name_overlay_id, reg1),
                # (assign, ":agent_name_overlay", reg1),
              # (try_end),
            (try_end),
            
            # color
            (agent_get_team, ":player_team", ":player_agent"),
            (agent_get_team, ":agent_team", ":agent_no"),
            (agent_get_troop_id, ":troop_id", ":agent_no"),
            (try_begin),
              (eq, ":agent_team", ":player_team"),
              (assign, ":dest_color", 0x00FF00),
            (else_try),
              (agent_is_ally, ":agent_no"),
              (assign, ":dest_color", 0x0000FF),
            (else_try),
              (troop_is_hero, ":troop_id"),
              (assign, ":dest_color", 0xFFFF00),
            (else_try),
              (assign, ":dest_color", 0xFF0000),
            (try_end),
            (try_begin),
              (gt, ":agent_hp_overlay", 0),
              (gt, ":agent_hp_bg_overlay", 0),
              (overlay_set_color, ":agent_hp_overlay", ":dest_color"),
              (overlay_set_color, ":agent_hp_bg_overlay", 0x000000),
            (try_end),
            # (try_begin),
              # (gt, ":agent_name_overlay", 0),
              # (overlay_set_color, ":agent_name_overlay", ":dest_color"),
            # (try_end),
            
            # size & position
            # (this_or_next|gt, ":agent_name_overlay", 0),
            (gt, ":agent_hp_overlay", 0),
            
            # (agent_get_position, pos1, ":agent_no"),
            # (agent_get_horse, ":horse_agent", ":agent_no"),
            # (try_begin),
              # (ge, ":horse_agent", 0),
              # (position_move_z, pos1, 280, 1),
            # (else_try),
              # (position_move_z, pos1, 180, 1),
            # (try_end),
            (agent_get_bone_position, pos1, ":agent_no", 9, 1),
            (position_move_z, pos1, 30, 1),
            
            (position_get_screen_projection, pos2, pos1),
            (position_get_x, ":head_x_pos", pos2),
            (position_get_y, ":head_y_pos", pos2),
            # base size
            (copy_position, pos6, pos1),
            (copy_position, pos7, pos1),
            (position_move_z, pos7, 100, 1),
            (position_get_screen_projection, pos6, pos6),
            (position_get_screen_projection, pos7, pos7),
            (position_get_y, ":screen_y_pos_1", pos6),
            (position_get_y, ":screen_y_pos_2", pos7),
            (store_sub, ":base_x", ":screen_y_pos_2", ":screen_y_pos_1"),
            (val_mul, ":base_x", 3),
            (val_div, ":base_x", 4),
            (val_clamp, ":base_x", 20, 161),
            (store_div, ":base_y", ":base_x", 20),
            (try_begin),
              (is_between, ":head_x_pos", -100, 1100),
              (is_between, ":head_y_pos", -100, 850),
              #(agent_get_position, pos3, ":agent_no"),
              #(agent_get_position, pos4, ":player_agent"),
              (try_begin),
                (agent_is_alive, ":player_agent"),
                (agent_get_bone_position, pos3, ":player_agent", 9, 1),
              (else_try),
                (agent_get_position, pos3, ":player_agent"),
              (try_end),
              (position_move_z, pos3, 30, 1),
              (position_has_line_of_sight_to_position, pos1, pos3),
              (get_distance_between_positions_in_meters, ":distance", pos1, pos3),
              (try_begin),
                (troop_is_hero, ":troop_id"),
                (val_div, ":distance", 2),
              (try_end),
              (le, ":distance", 80),
              # agent no
              # (agent_get_horse, ":horse_agent", ":agent_no"),
              # (try_begin),
                # (ge, ":horse_agent", 0),
                # (position_move_z, pos3, 280, 1),
              # (else_try),
                # (position_move_z, pos3, 180, 1),
              # (try_end),
              # player agent
              # (agent_get_horse, ":player_horse", ":player_agent"),
              # (try_begin),
                # (ge, ":player_horse", 0),
                # (position_move_z, pos4, 280, 1),
              # (else_try),
                # (position_move_z, pos4, 180, 1),
              # (try_end),
    
              (try_begin),
                (gt, ":agent_hp_overlay", 0),
                (gt, ":agent_hp_bg_overlay", 0),
                ## hp bg & hp
                # position
                (assign, ":x_offset", ":base_x"),
                (val_div, ":x_offset", 2),
                (store_sub, ":hp_x", ":head_x_pos", ":x_offset"),
                (position_set_x, pos1, ":hp_x"),
                (position_set_y, pos1, ":head_y_pos"),
                (overlay_set_position, ":agent_hp_bg_overlay", pos1),
                (overlay_set_position, ":agent_hp_overlay", pos1),
                # alpha
                (overlay_set_alpha, ":agent_hp_bg_overlay", 0x66),
                (overlay_set_alpha, ":agent_hp_overlay", 0x44),
                # hp bg size
                (store_mul, ":bg_width", ":base_x", 50),
                (store_mul, ":bg_height", ":base_y", 50),
                (position_set_x, pos1, ":bg_width"),
                (position_set_y, pos1, ":bg_height"),
                (overlay_set_size, ":agent_hp_bg_overlay", pos1),
                # hp size
                (store_agent_hit_points, ":agent_hp",":agent_no"),
                (store_mul, ":hp_width", ":agent_hp", 50),
                (val_mul, ":hp_width", ":base_x"),
                (val_div, ":hp_width", 100),
                (val_min, ":hp_width", ":bg_width"),
                (position_set_x, pos1, ":hp_width"),
                (position_set_y, pos1, ":bg_height"),
                (overlay_set_size, ":agent_hp_overlay", pos1),
              (try_end),
                
              # name
              # (try_begin),
                # (gt, ":agent_name_overlay", 0),
                # (assign, ":name_x", ":head_x_pos"),
                # (store_add, ":name_y", ":head_y_pos", 5),
                # (position_set_x, pos1, ":name_x"),
                # (position_set_y, pos1, ":name_y"),
                # (overlay_set_position, ":agent_name_overlay", pos1),
                # (store_mul, ":name_size", ":base_x", 9),
                # (position_set_x, pos1, ":name_size"),
                # (position_set_y, pos1, ":name_size"),
                # (overlay_set_size, ":agent_name_overlay", pos1),
                # (overlay_set_alpha, ":agent_name_overlay", 0xCC),
              # (try_end),
            (else_try),
              (overlay_set_alpha, ":agent_hp_overlay", 0),
              (overlay_set_alpha, ":agent_hp_bg_overlay", 0),
              # (overlay_set_alpha, ":agent_name_overlay", 0),
            (try_end),
          (else_try),
            (try_begin),
              (gt, ":agent_hp_overlay", 0),
              (gt, ":agent_hp_bg_overlay", 0),
              (overlay_set_alpha, ":agent_hp_overlay", 0),
              (overlay_set_alpha, ":agent_hp_bg_overlay", 0),
            (try_end),
            # (try_begin),
              # (gt, ":agent_name_overlay", 0),
              # (overlay_set_alpha, ":agent_name_overlay", 0),
            # (try_end),
            (agent_set_slot, ":agent_no", slot_agent_hp_bar_overlay_id, 0),
            (agent_set_slot, ":agent_no", slot_agent_hp_bar_bg_overlay_id, 0),
            #(agent_set_slot, ":agent_no", slot_agent_name_overlay_id, 0),
          (try_end),
        (try_end),
      ]),
后退
顶部 底部