open/close helmet

Users who are viewing this thread

Leikeze

Sergeant at Arms
I'm trying to add the open close helmet feature to my narnia mod.
This is what I do






to module_mission_templates I add

open_close_helmet = (
    0, 0, 0, [(key_clicked, key_h),(neg|main_hero_fallen)],
        [
(get_player_agent_no, ":player_agent"),
(agent_is_active, ":player_agent"),
(agent_get_item_slot, ":helmet_1", ":player_agent", ek_head),
(item_get_slot, ":helmet_2", ":helmet_1", slot_open_close_helmet),
                (gt, ":helmet_2", 0),
                (agent_unequip_item, ":player_agent", ":helmet_1"),
                (agent_equip_item, ":player_agent", ":helmet_2"),
        ])


to module_constants I add

slot_open_close_helmet = 0# any free item slot


to module_scripts I add

  # script_initialize_open_close_helmets
  ("initialize_open_close_helmets",
  [
  (item_set_slot, "itm_peter_helmet_open", slot_open_close_helmet, "itm_peter_helmet_closed"),
  (try_for_range, ":itm_1", 0, "itm_items_end"),
        (item_get_slot, ":itm_2", ":itm_1", slot_open_close_helmet),
(gt, ":itm_2", 0),
(item_set_slot, ":itm_2", slot_open_close_helmet, ":itm_1"),#so that you dont have to do both (item_set_slot, "itm_1", "itm_2") and (item_set_slot, ":itm_2", ":itm_1")
  (try_end),
  ]),


to module_scripts(script game start) I add

(call_script, "script_initialize_open_close_helmets"),


It does not work though, I push "H" and it does nothing. Anybody know what I'm doing wrong?

 
Code:
open_close_helmet = (
    0, 0, 0, [(key_clicked, key_h),(neg|main_hero_fallen)],
        [
      (get_player_agent_no, ":player_agent"),
      (agent_is_active, ":player_agent"),
      (agent_get_item_slot, ":helmet_1", ":player_agent", ek_head),
      (item_get_slot, ":helmet_2", ":helmet_1", slot_open_close_helmet),
                (gt, ":helmet_2", 0),
                (agent_unequip_item, ":player_agent", ":helmet_1"),
                (agent_equip_item, ":player_agent", ":helmet_2"),
        ])

Ok, so you added code above to beggining of module_mission_templates but did you actually used it in any mission template? Code above is just declaration, you must still insert it
Code:
open_close_helmet,
in desired mission template to make it work.

 
Is there just one mission template I can add it to, to make it work every time he enters the map?
or will I have to go through adding it to each template?
 
Which templates are the ones in which he is in a scene and not a world map? is there a list somewhere. I'm kind of a newbie to python and the module system. :lol:
 
I added it to the battle mission template but when I get in the game I buy the helmet then press "h" and it does nothing if I  take of the helmet and press "h" it gives a script error.
 
EmielRegis said:
Add trigger to deathmach and test it by hosting any scene. Its easiest way in my opinion.

The helmet I'm using to test you cannot buy in multiplayer and it would take me a while to add just for that.
By the way how can I make open and closed without having to make two helmets. Then they have to buy two helmets just to open and close it.
 
The helmet I'm using to test you cannot buy in multiplayer and it would take me a while to add just for that.

Actually its very easy. Just add this to deathmatch template (or any other, it doesnt matter which, just make sure you have head slot empty) and you get helmet on spawn ready to test.
Code:
(ti_on_agent_spawn, 0, 0, [],  
       [
         (store_trigger_param_1, ":agent_no"),
         (agent_equip_item, ":agent_no", "insert helmet ID here"),
         ]),

By the way how can I make open and closed without having to make two helmets. Then they have to buy two helmets just to open and close it.

No, it isnt working like that. One version of helmet is enough, when you pressing key, second form is just spawned from thin air on agent, you dont need to buy it. :grin:
 
If it is defined in module_constants directly or could be in a range started in module_constants.

For instance, in module_constants you'll see
slot_item_is_checked              = 0

so the item slot 0 is used.
 
Back
Top Bottom