OSP Code Combat [WB] Weapon breaking trigger

Users who are viewing this thread

Baron Conrad

Sergeant Knight
Hello folks, just thought I'd share a trigger that made for in-battle weapon breaking.


Whenever you hit an enemy there is a chance that your weapon will be destroyed/lost (Simulates weapon wear and weapons being stuck in enemy or lances shattering completely.)

Different break rates.
All weapons are a little more likely to be lost on horseback.
Polearms are lost MUCH more when on horseback.
Polearms on foot are lost a little more than other weapons.
Two handed weapons are lost a little more than one handed weapons.

When you lose your weapon it is gone forever, remember that you can get spare weapons from your box when they break.





Code:

common_weapon_break =  (
        0.4, 0, 0,
      [
   
    #(player_get_agent_id, ":player_agent", ":player_no"),
    (get_player_agent_no, ":player_agent"),
(agent_get_attack_action, ":playeraction", ":player_agent"), #returned values: free = 0, readying_attack = 1, releasing_attack = 2, completing_attack_after_hit = 3, attack_parried = 4, reloading = 5, after_release = 6, cancelling_attack = 7
        (try_begin),
            (eq,":playeraction",3),
(agent_get_wielded_item,":breakweapon",":player_agent",0),
(gt,":breakweapon",2),
        (item_get_type, ":weapontype", ":breakweapon"),
    (agent_get_horse,":playermounted",":player_agent"),
    (store_random_in_range,":weaponbreakchance",1,100),
(try_begin),
  (ge,":playermounted",0),
#   (display_message, "@Mounted."),
              (val_mul,":weaponbreakchance",104),
  (val_div,":weaponbreakchance",100),
  (eq,itp_type_polearm,":weapontype"),
  (val_mul,":weaponbreakchance",110),
  (val_div,":weaponbreakchance",100),
            (try_end),
(try_begin),  
      (eq,itp_type_polearm,":weapontype"),
#      (display_message, "@Polearm"),
  (val_mul,":weaponbreakchance",102),
  (val_div,":weaponbreakchance",100),
(try_end),
(try_begin),  
      (eq,itp_type_two_handed_wpn,":weapontype"),
#      (display_message, "@2 hander"),
  (val_mul,":weaponbreakchance",101),
  (val_div,":weaponbreakchance",100),
  (try_end),
  (try_begin),  
      (eq,itp_type_one_handed_wpn,":weapontype"),
#      (display_message, "@1 hander"),
  (val_mul,":weaponbreakchance",1),
  (try_end),
  (try_begin),
  (assign, reg8, ":weaponbreakchance"),
#   (display_message, "@{reg8}"),
  (ge,":weaponbreakchance",9:cool:,
  (agent_unequip_item,":player_agent",":breakweapon"),
  (play_sound,"snd_shield_broken",),
  (troop_remove_item, "trp_player", ":breakweapon"),
  (display_message, "@Hah! Your weapon broke."),
  (lt,":playermounted",0),
      (agent_set_animation, ":player_agent", "anim_strike_chest_front"),
            (try_end),

    (try_end),      
], [])

Numbers can be changed based on your preference, remember not to use decimals! That is why I multiply by 101 ect and then divide by 100.


common_weapon_break will need to be added to each mission template you want it in, WARNING:It does not work as-is on multiplayer, if you want to figure that out yourself go ahead.


Any questions, please ask.



 
It probably makes more sense to have polearms break more often when blocking.
Also, it's probably better practice to simply assign an upper limit per weapon type (rather than the repeated val_mul/div), and then store the random number afterwards.
 
1. Sorry, the game doesn't tell you when you block a blow.

2. I did it this way because it allows the horse multiplier and weapon multipliers to all count. Rather than having 6 different try_begins one for each combination of horse and weapon or not.


 
Awesome job, I hope you don't mind me posting my own personal modification, this makes the weapons breakable for the AI too, however only if they have 2 or more melee weapons (same goes for player btw, but that can easily be removed I think). That way it doesn't end up with a bunch of AI fistfighting.

I bet that there is a more effective way to do than the way I did, but I'm new to the mission_template world.

common_weapon_break =  (
        0.4, 0, 0,
      [], [
 
  #(player_get_agent_id, ":player_agent", ":player_no"),
      # (get_player_agent_no, ":player_agent"),
  (try_for_agents, ":player_agent"),
      (agent_get_attack_action, ":playeraction", ":player_agent"), #returned values: free = 0, readying_attack = 1, releasing_attack = 2, completing_attack_after_hit = 3, attack_parried = 4, reloading = 5, after_release = 6, cancelling_attack = 7
        (try_begin),
            (eq,":playeraction",3),
          (agent_get_wielded_item,":breakweapon",":player_agent",0), 
          (gt,":breakweapon",2),
            (item_get_type, ":weapontype", ":breakweapon"),
          (agent_get_horse,":playermounted",":player_agent"),
          (store_random_in_range,":weaponbreakchance",1,100),
          (try_begin),
            (ge,":playermounted",0),
      #      (display_message, "@Mounted."),
              (val_mul,":weaponbreakchance",104), 
            (val_div,":weaponbreakchance",100),
            (eq,itp_type_polearm,":weapontype"),
            (val_mul,":weaponbreakchance",110),
            (val_div,":weaponbreakchance",100),
            (try_end),
        (try_begin),           
            (eq,itp_type_polearm,":weapontype"),
      #      (display_message, "@Polearm"),
            (val_mul,":weaponbreakchance",102),
            (val_div,":weaponbreakchance",100),
          (try_end),
          (try_begin),           
            (eq,itp_type_two_handed_wpn,":weapontype"),
      #      (display_message, "@2 hander"),
            (val_mul,":weaponbreakchance",101),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),           
            (eq,itp_type_one_handed_wpn,":weapontype"),
      #      (display_message, "@1 hander"),
            (val_mul,":weaponbreakchance",1),
        (try_end),
        (try_begin), 
            (assign, reg8, ":weaponbreakchance"),
      #      (display_message, "@{reg8}"),
(ge,":weaponbreakchance",9:cool:,
(assign, ":num_agent_items", 0),
  (try_for_range, ":item", "itm_no_item", "itm_items_end"),
    (item_get_type, ":weapontype2", ":item"),
(this_or_next|eq,itp_type_one_handed_wpn,":weapontype2"),
(this_or_next|eq,itp_type_two_handed_wpn,":weapontype2"),
(eq,itp_type_polearm,":weapontype2"),
  (try_begin),
(agent_has_item_equipped,":player_agent",":item"),
(val_add, ":num_agent_items", 1),
  (try_end),
  (try_end),
(ge, ":num_agent_items", 2),
            (agent_unequip_item,":player_agent",":breakweapon"),
(agent_get_troop_id,":troop", ":player_agent"),
          #  (troop_remove_item, "trp_player", ":breakweapon"),
(try_begin),
(get_player_agent_no,":player"),
(eq, ":player_agent", ":player"),
(play_sound,"snd_shield_broken",),
(troop_remove_item, ":troop", ":breakweapon"),
            (display_message, "@Hah! Your weapon broke."),
(try_end),
            (lt,":playermounted",0),
            (agent_set_animation, ":player_agent", "anim_strike_chest_front"),
            (try_end),
     
      (try_end),
  (try_end),])

common_weapon_break =  (
        0.4, 0, 0,
      [], [
 
  #(player_get_agent_id, ":player_agent", ":player_no"),
#MY MODIFICATION BEGIN---------------------------------------------------------------------------
      # (get_player_agent_no, ":player_agent"),
  (try_for_agents, ":player_agent"),
#MY MODIFICATION END-----------------------------------------------------------------------------
      (agent_get_attack_action, ":playeraction", ":player_agent"), #returned values: free = 0, readying_attack = 1, releasing_attack = 2, completing_attack_after_hit = 3, attack_parried = 4, reloading = 5, after_release = 6, cancelling_attack = 7
        (try_begin),
            (eq,":playeraction",3),
          (agent_get_wielded_item,":breakweapon",":player_agent",0), 
          (gt,":breakweapon",2),
            (item_get_type, ":weapontype", ":breakweapon"),
          (agent_get_horse,":playermounted",":player_agent"),
          (store_random_in_range,":weaponbreakchance",1,100),
          (try_begin),
            (ge,":playermounted",0),
      #      (display_message, "@Mounted."),
              (val_mul,":weaponbreakchance",104), 
            (val_div,":weaponbreakchance",100),
            (eq,itp_type_polearm,":weapontype"),
            (val_mul,":weaponbreakchance",110),
            (val_div,":weaponbreakchance",100),
            (try_end),
        (try_begin),           
            (eq,itp_type_polearm,":weapontype"),
      #      (display_message, "@Polearm"),
            (val_mul,":weaponbreakchance",102),
            (val_div,":weaponbreakchance",100),
          (try_end),
          (try_begin),           
            (eq,itp_type_two_handed_wpn,":weapontype"),
      #      (display_message, "@2 hander"),
            (val_mul,":weaponbreakchance",101),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),           
            (eq,itp_type_one_handed_wpn,":weapontype"),
      #      (display_message, "@1 hander"),
            (val_mul,":weaponbreakchance",1),
        (try_end),
        (try_begin), 
            (assign, reg8, ":weaponbreakchance"),
      #      (display_message, "@{reg8}"),
            (ge,":weaponbreakchance",9:cool:,
#MY MODIFICATION BEGIN----------------------------------------------------------------------------
(assign, ":num_agent_items", 0),
  (try_for_range, ":item", "itm_no_item", "itm_items_end"),
    (item_get_type, ":weapontype2", ":item"),
(this_or_next|eq,itp_type_one_handed_wpn,":weapontype2"),
(this_or_next|eq,itp_type_two_handed_wpn,":weapontype2"),
(eq,itp_type_polearm,":weapontype2"),
  (try_begin),
(agent_has_item_equipped,":player_agent",":item"),
(val_add, ":num_agent_items", 1),
  (try_end),
  (try_end),
(ge, ":num_agent_items", 2),
#MY MODIFICATION END------------------------------------------------------------------------------
            (agent_unequip_item,":player_agent",":breakweapon"),
#MY MODIFICATION BEGIN----------------------------------------------------------------------------
(agent_get_troop_id,":troop", ":player_agent"),
          #  (troop_remove_item, "trp_player", ":breakweapon"),
(try_begin),
(get_player_agent_no,":player"),
(eq, ":player_agent", ":player"),
(play_sound,"snd_shield_broken",),
(troop_remove_item, ":troop", ":breakweapon"),
            (display_message, "@Hah! Your weapon broke."),
(try_end),
#MY MODIFICATION END------------------------------------------------------------------------------
            (lt,":playermounted",0),
            (agent_set_animation, ":player_agent", "anim_strike_chest_front"),
            (try_end),
     
      (try_end),
  (try_end),])

I don't trigger the sound every time a weapon is broke because the sound is just as loud no matter how far away the weapon that break is, and that is quite annoying. So you can only hear it when it happens to the player.

I have tested it, and it works.
 
If you're going to try for all agents, then you'd probably want to make sure the agent isn't dead (agent_is_alive), or a horse (agent_is_human) or something. And you can use agent_play_sound for the bots if you really wanted to.

As to improvements, instead of going through all the items, for every agent, you want to go through the agent's troop's inventory. Use agent_get_troop_id, troop_get_inventory_capacity, try_for_range, troop_get_inventory_slot, item_get_type, agent_has_item_equipped, etc. And inside the loop itself you want to break out as soon as you've got 2 suitable items (set the upper limit in the try_for_range to 0). Finally, instead of comparing the itps to your item type, you'll want to use (is_between, ":weapontype2", itp_one_handed_wpn, itp_type_polearm).

Also, this won't work on 1.011 since agent_get_attack_action is a Warband addition.

Also, this won't work in multiplayer at all since multiplayer doesn't actually use troop inventories, etc, so you'd have to remove it in a different way.
 
Somebody said:
If you're going to try for all agents, then you'd probably want to make sure the agent isn't dead (agent_is_alive), or a horse (agent_is_human) or something. And you can use agent_play_sound for the bots if you really wanted to.

Don't you automatically get rid of horses and dead agents at this part?

(try_for_agents, ":player_agent"),
      (agent_get_attack_action, ":playeraction", ":player_agent"), #returned values: free = 0, readying_attack = 1, releasing_attack = 2, completing_attack_after_hit = 3, attack_parried = 4, reloading = 5, after_release = 6, cancelling_attack = 7
        (try_begin),
            (eq,":playeraction",3),

Somebody said:
As to improvements, instead of going through all the items, for every agent, you want to go through the agent's troop's inventory. Use agent_get_troop_id, troop_get_inventory_capacity, try_for_range, troop_get_inventory_slot, item_get_type, agent_has_item_equipped, etc. And inside the loop itself you want to break out as soon as you've got 2 suitable items (set the upper limit in the try_for_range to 0). Finally, instead of comparing the itps to your item type, you'll want to use (is_between, ":weapontype2", itp_one_handed_wpn, itp_type_polearm).

Thanks alot. But it should be  (is_between, ":weapontype2", itp_one_handed_wpn, itp_type_arrows), or it wont count polearms. Anyways, the other stuff is a tad to advanced for me. Other than adding naval battles this is pretty much the first time I play around in the mission_templates.
 
Yes, but it's a waste of cpu cycles using that operation, when checking whether or not the agent can actually have an attack action is faster. And I was typing from memory, hence the list of operations without parameters.
 
@Kolba and iggorbb

I assume so, I haven't tried it though.

@Cruger feel free to change it and post your changes, it's all for the good of the modding community.


Doesn't work in multiplayer though it could probably be changed to work with multiplayer.
 
Module Mission Templates,

You can add it before

multiplayer_server_check_belfry_movement

And then add

common_weapon_break,

to all mission templates you want it in.

In my own module I just put it after every

common_battle_tab_press,

I think that add's it to pretty much all the fights in Singleplayer apart from custom battles.




 
This is a great idea--always seemed odd that a Shield could break, but weapons were invulnerable. Yet, a Tempered sword shattering with equal likelihood as a cracked one doesn't seem to have the same feel as the degrees of shield quality, etc. This brings me to my question...

Is there something to get what "imodbits_" the wielded weapon has? That way, if the weapon was "Balanced" or "Tempered" it could get damaged to normal...from normal to "Chipped" and from Chipped to "Cracked" and from "Cracked" to broken and taken away. The probability for the weapon to break could similarly change with the modifier--Balanced/Tempered/Masterwork items would be less likely to break than normal ones, and Cracked ones would be very likely to break.

Just a thought...I'll be looking around more still, but figured I'd put it out there to see if others knew if it were possible.

EDIT: I think messing with "troop_get_inventory_slot_modifier" something like this might be accomplished. I might start playing around with that...
 
Caba`drin said:
This is a great idea--always seemed odd that a Shield could break, but weapons were invulnerable. Yet, a Tempered sword shattering with equal likelihood as a cracked one doesn't seem to have the same feel as the degrees of shield quality, etc. This brings me to my question...

Is there something to get what "imodbits_" the wielded weapon has? That way, if the weapon was "Balanced" or "Tempered" it could get damaged to normal...from normal to "Chipped" and from Chipped to "Cracked" and from "Cracked" to broken and taken away. The probability for the weapon to break could similarly change with the modifier--Balanced/Tempered/Masterwork items would be less likely to break than normal ones, and Cracked ones would be very likely to break.

Just a thought...I'll be looking around more still, but figured I'd put it out there to see if others knew if it were possible.

I was wondering something similar, but instead of lowering them a level, they are just more resistant to breaking and more able to break another weapon. Is it also possible to handle weapons just as shields? As in, if it breaks in battle you have to find another weapon but you have enough time to repair the weapon between battles. Is this possible?
 
I don't have WB installed on the computer I've access to for the rest of the week, but tried to think through this the best I could.

This is based on the following bit of code to capture the modifier for the currently equipped weapon, which I believe will do the trick, but please let me know if I totally missed something...

           
            (try_for_range, ":i_slot", 0, 10),
                (troop_get_inventory_slot, ":item_id", "trp_player", ":i_slot"), 
                (eq, ":item_id", ":breakweapon"),
                (troop_get_inventory_slot_modifier, ":imod", "trp_player", ":i_slot"),
            (try_end)

The following code is marked with 'imod...' comments to denote my additions to Baron Conrad's original code.

common_weapon_break =  (
        0.4, 0, 0,
      [

      #(player_get_agent_id, ":player_agent", ":player_no"),
      (get_player_agent_no, ":player_agent"),
      (agent_get_attack_action, ":playeraction", ":player_agent"), #returned values: free = 0, readying_attack = 1, releasing_attack = 2, completing_attack_after_hit = 3, attack_parried = 4, reloading = 5, after_release = 6, cancelling_attack = 7
        (try_begin),
            (eq,":playeraction",3),
          (agent_get_wielded_item,":breakweapon",":player_agent",0),
          (gt,":breakweapon",2),
            (item_get_type, ":weapontype", ":breakweapon"),
#--imod, get weapon imod
            (try_for_range, ":i_slot", 0, 10),
                (troop_get_inventory_slot, ":item_id", "trp_player", ":i_slot"),  #Find Item Slot with same item ID as Equipped Weapon
                (eq, ":item_id", ":breakweapon"),
                (troop_get_inventory_slot_modifier, ":imod", "trp_player", ":i_slot"),
            (try_end)
#--End Get imod
          (agent_get_horse,":playermounted",":player_agent"),
          (store_random_in_range,":weaponbreakchance",1,100),
          (try_begin),
            (ge,":playermounted",0),
      #      (display_message, "@Mounted."),
              (val_mul,":weaponbreakchance",104),
            (val_div,":weaponbreakchance",100),
            (eq,itp_type_polearm,":weapontype"),
            (val_mul,":weaponbreakchance",110),
            (val_div,":weaponbreakchance",100),
            (try_end),
        (try_begin),
            (eq,itp_type_polearm,":weapontype"),
      #      (display_message, "@Polearm"),
            (val_mul,":weaponbreakchance",102),
            (val_div,":weaponbreakchance",100),
          (try_end),
          (try_begin),
            (eq,itp_type_two_handed_wpn,":weapontype"),
      #      (display_message, "@2 hander"),
            (val_mul,":weaponbreakchance",101),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq,itp_type_one_handed_wpn,":weapontype"),
      #      (display_message, "@1 hander"),
            (val_mul,":weaponbreakchance",1),
        (try_end),
#--imod Quality Modifier
    #Better than Average
        (try_begin),
            (eq, imodbit_masterwork, ":imod"),
            (val_mul,":weaponbreakchance",50),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_tempered, ":imod"),
            (val_mul,":weaponbreakchance",75),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_balanced, ":imod"),
            (val_mul,":weaponbreakchance",85),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_heavy, ":imod"),
            (val_mul,":weaponbreakchance",90),
            (val_div,":weaponbreakchance",100),
        (try_end),
    #Worse than Average
        (try_begin),
            (eq, imodbit_bent, ":imod"),
            (val_mul,":weaponbreakchance",110),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_rusty, ":imod"),
            (val_mul,":weaponbreakchance",125),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_chipped, ":imod"),
            (val_mul,":weaponbreakchance",150),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_cracked, ":imod"),
            (val_mul,":weaponbreakchance",200),
            (val_div,":weaponbreakchance",100),
        (try_end),
#--End imod Quality Modifier
        (try_begin),
            (assign, reg8, ":weaponbreakchance"),
      #      (display_message, "@{reg8}"),
            (ge,":weaponbreakchance",9:cool:,
            (agent_unequip_item,":player_agent",":breakweapon"),
            (play_sound,"snd_shield_broken",),
            (troop_remove_item, "trp_player", ":breakweapon"),
            (display_message, "@Hah! Your weapon broke."),
            (lt,":playermounted",0),
            (agent_set_animation, ":player_agent", "anim_strike_chest_front"),
            (try_end),

      (try_end),
      ], [])

And below, the script checks the imod to determine how drastically to damage the weapon. Better weapons just lose their improvements, normal weapons get chipped, lesser weapons break.

common_weapon_break =  (
        0.4, 0, 0,
      [

      #(player_get_agent_id, ":player_agent", ":player_no"),
      (get_player_agent_no, ":player_agent"),
      (agent_get_attack_action, ":playeraction", ":player_agent"), #returned values: free = 0, readying_attack = 1, releasing_attack = 2, completing_attack_after_hit = 3, attack_parried = 4, reloading = 5, after_release = 6, cancelling_attack = 7
        (try_begin),
            (eq,":playeraction",3),
          (agent_get_wielded_item,":breakweapon",":player_agent",0),
          (gt,":breakweapon",2),
            (item_get_type, ":weapontype", ":breakweapon"),
#--imod, get weapon imod
            (try_for_range, ":i_slot", 0, 10),
                (troop_get_inventory_slot, ":item_id", "trp_player", ":i_slot"),  #Find Item Slot with same item ID as Equipped Weapon
                (eq, ":item_id", ":breakweapon"),
                (troop_get_inventory_slot_modifier, ":imod", "trp_player", ":i_slot"),
            (try_end)
#--End Get imod
          (agent_get_horse,":playermounted",":player_agent"),
          (store_random_in_range,":weaponbreakchance",1,100),
          (try_begin),
            (ge,":playermounted",0),
      #      (display_message, "@Mounted."),
              (val_mul,":weaponbreakchance",104),
            (val_div,":weaponbreakchance",100),
            (eq,itp_type_polearm,":weapontype"),
            (val_mul,":weaponbreakchance",110),
            (val_div,":weaponbreakchance",100),
            (try_end),
        (try_begin),
            (eq,itp_type_polearm,":weapontype"),
      #      (display_message, "@Polearm"),
            (val_mul,":weaponbreakchance",102),
            (val_div,":weaponbreakchance",100),
          (try_end),
          (try_begin),
            (eq,itp_type_two_handed_wpn,":weapontype"),
      #      (display_message, "@2 hander"),
            (val_mul,":weaponbreakchance",101),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq,itp_type_one_handed_wpn,":weapontype"),
      #      (display_message, "@1 hander"),
            (val_mul,":weaponbreakchance",1),
        (try_end),
#--imod Quality Modifier
    #Better than Average
        (try_begin),
            (eq, imodbit_masterwork, ":imod"),
            (val_mul,":weaponbreakchance",50),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_tempered, ":imod"),
            (val_mul,":weaponbreakchance",75),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_balanced, ":imod"),
            (val_mul,":weaponbreakchance",85),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_heavy, ":imod"),
            (val_mul,":weaponbreakchance",90),
            (val_div,":weaponbreakchance",100),
        (try_end),
    #Worse than Average
        (try_begin),
            (eq, imodbit_bent, ":imod"),
            (val_mul,":weaponbreakchance",110),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_rusty, ":imod"),
            (val_mul,":weaponbreakchance",125),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_chipped, ":imod"),
            (val_mul,":weaponbreakchance",150),
            (val_div,":weaponbreakchance",100),
        (try_end),
        (try_begin),
            (eq, imodbit_cracked, ":imod"),
            (val_mul,":weaponbreakchance",200),
            (val_div,":weaponbreakchance",100),
        (try_end),
#--End imod Quality Modifier
        (try_begin),
            (assign, reg8, ":weaponbreakchance"),
      #      (display_message, "@{reg8}"),
            (ge,":weaponbreakchance",9:cool:,
#--imod Weapon Damage
    #Better than Average
        (try_begin),
            (eq, imodbit_masterwork, ":imod"),
            (troop_set_inventory_slot_modifier, "trp_player", ":i_slot", imodbit_balanced),
        (else_try),
            (eq, imodbit_tempered, ":imod"),
            (troop_set_inventory_slot_modifier, "trp_player", ":i_slot", 0),
        (else_try),
            (eq, imodbit_balanced, ":imod"),
            (troop_set_inventory_slot_modifier, "trp_player", ":i_slot", 0),
        (else_try),
            (eq, imodbit_heavy, ":imod"),
            (troop_set_inventory_slot_modifier, "trp_player", ":i_slot", imodbit_chipped),
    #Worse than Average
        (else_try),
            (eq, imodbit_bent, ":imod"),
            (troop_set_inventory_slot_modifier, "trp_player", ":i_slot", imodbit_cracked),
    #Chipped, Cracked, Rusty weapons break
        (else_try),
            (this_or_next|eq, imodbit_rusty, ":imod"),
            (this_or_next|eq, imodbit_chipped, ":imod"),
            (eq, imodbit_cracked, ":imod"),
            (agent_unequip_item,":player_agent",":breakweapon"),
            (play_sound,"snd_shield_broken",),
            (troop_remove_item, "trp_player", ":breakweapon"),
            (display_message, "@Hah! Your weapon broke."),
            (lt,":playermounted",0),
            (agent_set_animation, ":player_agent", "anim_strike_chest_front"),
    #Normal Weapon gets Chipped
        (else_try),
            (troop_set_inventory_slot_modifier, "trp_player", ":i_slot", imodbit_chipped),
        (try_end),
#--End imod Weapon Damage
      (try_end),

      (try_end),
      ], [])

 
Back
Top Bottom