Flying Squirrel Entertainment

Mount & Blade Warband: Napoleonic Wars => Modifications => Topic started by: Vileius Scoundralis on February 16, 2018, 06:13:34 pm

Title: Editing Ze Treasure
Post by: Vileius Scoundralis on February 16, 2018, 06:13:34 pm
How would I go about editing Ze Treasure to give certain things based on the variable number (Which would be server-side)?
Title: Re: Editing Ze Treasure
Post by: Norwegian13 on February 16, 2018, 06:15:26 pm
Nothing really too complicated about it.   just need to change 2 lines of code if you are changing what what they give.

Spoiler
("ze_treasure",spr_use_time(4),"chest_b","bo_ze_treasure", [
    (ti_on_scene_prop_use,
    [
      (store_trigger_param_1, ":agent_id"),
      #(store_trigger_param_2, ":instance_id"),

      #(neg|scene_prop_slot_eq, ":instance_id", scene_prop_slot_just_fired, 1), # abuse just_fired for already used.
     
      (agent_is_active,":agent_id"),
      (agent_is_alive,":agent_id"),
     
      # remove his shit.
      #(try_for_range_backwards,":equipment_slot",0,4), # ,ek_item_0,ek_head),
      #  (agent_get_item_slot, ":item_id", ":agent_id", ":equipment_slot"),
       
      #  (gt,":item_id",-1), # even have a item there?
       
      #  (agent_unequip_item, ":agent_id", ":item_id", ":equipment_slot"),
      #(try_end),
      (try_begin),
        (agent_get_item_slot, ":item_id", ":agent_id", 4), #ek_head
        (gt,":item_id",-1), # even have a item there?
        (agent_unequip_item, ":agent_id", ":item_id", 4), #ek_head
      (try_end),
     
      # add ze goodies.
      (agent_equip_item,":agent_id","itm_pirate_hat"),
      #(agent_equip_item,":agent_id","itm_french_officer_pistol"),
      #(agent_equip_item,":agent_id","itm_pistol_ammo"),
      #(agent_equip_item,":agent_id","itm_spyglass"),
      #(agent_equip_item,":agent_id","itm_french_light_cav_off_sabre"),
     
      #(agent_set_wielded_item,":agent_id","itm_french_officer_pistol"),
     
      #(scene_prop_set_slot,":instance_id",scene_prop_slot_just_fired,1),
     
      (try_for_players, ":player_no", 1),
        (player_is_active, ":player_no"),
        (multiplayer_send_3_int_to_player, ":player_no", multiplayer_event_return_agent_set_item, ":agent_id", "itm_pirate_hat", 4),
      (try_end),
    ]),
  ]),
[close]
Title: Re: Editing Ze Treasure
Post by: Vileius Scoundralis on February 16, 2018, 06:19:07 pm
Nothing really too complicated about it.   just need to change 2 lines of code if you are changing what what they give.

Spoiler
("ze_treasure",spr_use_time(4),"chest_b","bo_ze_treasure", [
    (ti_on_scene_prop_use,
    [
      (store_trigger_param_1, ":agent_id"),
      #(store_trigger_param_2, ":instance_id"),

      #(neg|scene_prop_slot_eq, ":instance_id", scene_prop_slot_just_fired, 1), # abuse just_fired for already used.
     
      (agent_is_active,":agent_id"),
      (agent_is_alive,":agent_id"),
     
      # remove his shit.
      #(try_for_range_backwards,":equipment_slot",0,4), # ,ek_item_0,ek_head),
      #  (agent_get_item_slot, ":item_id", ":agent_id", ":equipment_slot"),
       
      #  (gt,":item_id",-1), # even have a item there?
       
      #  (agent_unequip_item, ":agent_id", ":item_id", ":equipment_slot"),
      #(try_end),
      (try_begin),
        (agent_get_item_slot, ":item_id", ":agent_id", 4), #ek_head
        (gt,":item_id",-1), # even have a item there?
        (agent_unequip_item, ":agent_id", ":item_id", 4), #ek_head
      (try_end),
     
      # add ze goodies.
      (agent_equip_item,":agent_id","itm_pirate_hat"),
      #(agent_equip_item,":agent_id","itm_french_officer_pistol"),
      #(agent_equip_item,":agent_id","itm_pistol_ammo"),
      #(agent_equip_item,":agent_id","itm_spyglass"),
      #(agent_equip_item,":agent_id","itm_french_light_cav_off_sabre"),
     
      #(agent_set_wielded_item,":agent_id","itm_french_officer_pistol"),
     
      #(scene_prop_set_slot,":instance_id",scene_prop_slot_just_fired,1),
     
      (try_for_players, ":player_no", 1),
        (player_is_active, ":player_no"),
        (multiplayer_send_3_int_to_player, ":player_no", multiplayer_event_return_agent_set_item, ":agent_id", "itm_pirate_hat", 4),
      (try_end),
    ]),
  ]),
[close]

Which part of that would be the variable, If you don't mind me asking?
Title: Re: Editing Ze Treasure
Post by: Thunderstormer on February 16, 2018, 06:25:45 pm
if you want to do stuff based on the variable one or two,(or both) you will have to get the variable of the prop in question(their are operations for that), check what the value is, and then code in what will happen if the variable = the value you want.  you can find examples of that in the code.  just look around the various files and see how it works.
Title: Re: Editing Ze Treasure
Post by: Vileius Scoundralis on February 16, 2018, 06:26:37 pm
if you want to do stuff based on the variable one or two,(or both) you will have to get the variable of the prop in question(their are operations for that), check what the value is, and then code in what will happen if the variable = the value you want.  you can find examples of that in the code.  just look around the various files and see how it works.

Thanks!