[WB]Helmet View.

正在查看此主题的用户

Rath0s

Baron
I need some help with helmet view in warband, I am using HookieBT`s code here.

When I press "V" the inside of the helmets appear as it should, but I can do it without a helmet too which should not happen, also I have 2 different helmet view textures, but there is only 1 of them that shows up, help please.

Here is my the code with my stuff.

Module Meshes:

插入代码块:
 ("nasal_view", 0, "nasal_view", 0, 0, 0, 0, 0, 0, 1, 1, 1),  
 ("valsgaarde_view", 0, "valsgaarde_view", 0, 0, 0, 0, 0, 0, 1, 1, 1),

Module Mission_Templates:
It is set for all the Multiplayer Missions. Deathmatch, Battle. etc......
插入代码块:
common_helmet_view = (0, 0, 0, [
   (key_clicked, key_v)
   ],
   [
      (get_player_agent_no, ":player_agent"),
      (agent_is_alive, ":player_agent"),
      
      (try_begin),
         (le, "$helmet_view", 0),   #incase this variable isn't set yet
         (assign, "$helmet_view", 1),
         (start_presentation, "prsnt_helmet_view"),
      (else_try),
         (assign, "$helmet_view", 0),
      (try_end),
   ])

Module_Presentations:

插入代码块:
("helmet_view", prsntf_read_only, 0, [      #must use prsntf_read_only or you cannot attack
   (ti_on_presentation_load,
      [
      (presentation_set_duration, 999999),
      
      #(troop_get_inventory_slot,":item_id","trp_player",":slot_no"),
      (troop_get_inventory_slot,":item_id","$g_player_troop", 4),   #$g_player_troop is because  custom commander is integrated, 4 = ek_head
      (try_begin),
         (eq, ":item_id", "itm_vikingr_helmet"),
         (create_mesh_overlay, reg1, "mesh_nasal_view"),
      (else_try),
         (create_mesh_overlay, reg1, "mesh_valsgaarde_view"),
      (try_end),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1),   
      ]),
   (ti_on_presentation_run,
             [
         (try_begin),
            (le, "$helmet_view", 0),
              (presentation_set_duration, 0),
           (try_end),
           ]),   
         ]),

Module_Scripts:

插入代码块:
            (else_try),
              (this_or_next|eq, ":item_no", "itm_vikingr_helmet"),
              (eq, ":item_no", "itm_VALSGARDE8"),
              (eq, ":extra_text_id", 0),
              (set_result_string, "@Press 'V' to enable Helmet View"),
              (set_trigger_result, 0x00ff7f), #Green text      
            (try_end),
          (try_end),

And how would I tie this feature to the 1st person key, so when you click "R" the helmet view activates.
 
插入代码块:
      (try_begin),
         (eq, ":item_id", "itm_vikingr_helmet"),
         (create_mesh_overlay, reg1, "mesh_nasal_view"),
      (else_try),
         (create_mesh_overlay, reg1, "mesh_valsgaarde_view"),
      (try_end),

That doesn't look right. Shouldn't it be something like this:

插入代码块:
      (try_begin),
         (eq, ":item_id", "itm_vikingr_helmet"),
         (create_mesh_overlay, reg1, "mesh_nasal_view"),
      (else_try),
         (eq, ":item_id", "itm_valsgaarde_helmet"),
         (create_mesh_overlay, reg1, "mesh_valsgaarde_view"),
      (else_try),
         #Don't create any overlay at all
      (try_end),
 
Thanks, did not see that, but still it activates the wrong texture even without a helmet. I am soon giving up.
 
Module_Presentations:

插入代码块:
("helmet_view", prsntf_read_only, 0, [      #must use prsntf_read_only or you cannot attack
   (ti_on_presentation_load,
      [
      (presentation_set_duration, 999999),
      
      #(troop_get_inventory_slot,":item_id","trp_player",":slot_no"),
      (troop_get_inventory_slot,":item_id","$g_player_troop", ek_head),   #$g_player_troop is because  custom commander is integrated, you can just use ek_head instead of 4
     (gt, ":item_id", 0),
      (try_begin),
         (eq, ":item_id", "itm_vikingr_helmet"),
         (create_mesh_overlay, reg1, "mesh_nasal_view"),
         (position_set_x, pos1, 0),
         (position_set_y, pos1, 0),
         (overlay_set_position, reg1, pos1),   
      (else_try),
         (eq, ":item_id", "itm_valsgaarde_helmet"),
         (create_mesh_overlay, reg1, "mesh_valsgaarde_view"),
         (position_set_x, pos1, 0),
         (position_set_y, pos1, 0),
         (overlay_set_position, reg1, pos1),   
      (else_try),
        (display_message, "@Wrong or no helmet equipped."),
      (try_end),
      ]),
   (ti_on_presentation_run,
             [
         (try_begin),
            (le, "$helmet_view", 0),
              (presentation_set_duration, 0),
           (try_end),
           ]),   
         ]),

I don't have much knowledge about module_presentations, but try this.
 
It gives me a syntax error on the bracket(s) marked in red almost at the bottom.
("helmet_view", prsntf_read_only, 0, [      #must use prsntf_read_only or you cannot attack
  (ti_on_presentation_load,
      [
      (presentation_set_duration, 999999),
   
      #(troop_get_inventory_slot,":item_id","trp_player",":slot_no"),
      (troop_get_inventory_slot,":item_id","$g_player_troop", ek_head),  #$g_player_troop is because  custom commander is integrated, you can just use ek_head instead of 4
    (gt, ":item_id", 0),
      (try_begin),
        (eq, ":item_id", "itm_vikingr_helmet"),
        (create_mesh_overlay, reg1, "mesh_nasal_view"),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1), 
      (else_try),
        (eq, ":item_id", "itm_valsgaarde_helmet"),
        (create_mesh_overlay, reg1, "mesh_valsgaarde_view"),
        (position_set_x, pos1, 0),
        (position_set_y, pos1, 0),
        (overlay_set_position, reg1, pos1), 
      (else_try),
        (display_message, "@Wrong or no helmet equipped."
      (try_end),
      ]),
  (ti_on_presentation_run,
            [
        (try_begin),
            (le, "$helmet_view", 0),
              (presentation_set_duration, 0),
          (try_end),
          ]), 
        ]),
 
Heuh, even when you have an helmet equipped? And the message that you have No or the wrong helmet equipped doesn't show either?
Than it might be the $g_player_troop that causes a problem, but I'm not sure.
 
Have you tried something like:

插入代码块:
(multiplayer_get_my_troop, ":troop"),
(troop_get_inventory_slot,":item_id",":troop", ek_head),

:?:

Also, does this display the correct output, i.e. the right item id:

插入代码块:
(assign, reg0, ":item_id"),
(display_message, "@Debug - ItemID is {reg0}"),
 
Hmm, strange, the script errors do not pop up now for some reason, but still it does not work.
 
后退
顶部 底部