Weapons and armors can optionally wear off, using Equipment Durability.

When an equipment’s durability reaches 0, it is outworn. An outworn equipment can either no longer give bonuses, automatically be unequipped or destroyed. The durability of equipment can be changed using the Event System – e.g. reducing a weapons durability each time it’s used in a physical attack. The durability settings are individual for each equipment level.

In this tutorial, we’ll enable durability for the Short Sword, add durability display to the equipment menu screen and update the attack battle events to wear off the weapon’s durability. Let’s get to it!

Adding durability

Open the ORK Framework editor and navigate to Inventory > Weapons. Select the Short Sword and change the following settings.

Level Settings

  • Use Durability
    Enable this setting.
  • Outworn Action
    Select No Bonuses.
    The weapon wont give any bonuses when the durability reaches 0.
  • Value Type (Maximum Durability)
    Select Value.
  • Value (Maximum Durability)
    Set to 100.

That’s it for the weapon – it’ll now have a durability of 100.

Updating the menu screen

Navigate to Menus > Menu Screens, select Equipment and change the following settings.

Part Box Settings

While we’re updating the menu screen, let’s enable changing equipment using drag+drop.

  • Enable Dragging
    Enable this setting.
  • Enable Double Click
    Enable this setting.

Equipment Box Settings

  • Enable Dragging
    Enable this setting.
  • Enable Double Click
    Enable this setting.

HUD Info Display (Parts)

The HUD Info Display settings are used to add HUD elements to the choices of the menu. In an Equipment menu part, they can be used to display level points and durability information about the weapon or armor the choice represents. We’ll display a simple value bar representing the durability. The Parts info display will be used by the Equipment Parts box.

  • Display Info
    Enable this setting.

Click on Add HUD Element to add an info element.

  • Element Type
    Select Durability.
  • Use Bar
    Enable this setting.
  • Color (Bar Image)
    Select Red.
  • Use Empty Bar
    Enable this setting.
  • Color (Empty Bar)
    Select Default Shadow.
  • Position
    Set to X=0, Y=40.
  • Anchor
    Select Upper Left.
  • Relative To
    Select Upper Left.
  • Use Last Element
    Disable this setting.
  • Width
    Set to 220.
  • Is Percent (Width)
    Disable this setting.
  • Adjust Width
    Enable this setting.
  • Height
    Set to 5.
  • Is Percent (Height)
    Disable this setting.
  • Adjust Height
    Enable this setting.

HUD Info Display (List)

The List info display will be used by the Equipment box.

  • Display Info
    Enable this setting.

Click on Add HUD Element to add an info element.

  • Element Type
    Select Durability.
  • Use Bar
    Enable this setting.
  • Color (Bar Image)
    Select Red.
  • Use Empty Bar
    Enable this setting.
  • Color (Empty Bar)
    Select Default Shadow.
  • Position
    Set to X=0, Y=40.
  • Anchor
    Select Upper Left.
  • Relative To
    Select Upper Left.
  • Use Last Element
    Disable this setting.
  • Width
    Set to 420.
  • Is Percent (Width)
    Disable this setting.
  • Adjust Width
    Enable this setting.
  • Height
    Set to 5.
  • Is Percent (Height)
    Disable this setting.
  • Adjust Height
    Enable this setting.

And that’s it – click on Save Settings to save the changes.

Updating battle events

Now we’ll update the attack and attackNoCalculation battle events to decrease the durability. Navigate to Events and open the attack.asset battle event.

Insert the new step after the Play Sound step when the attack hit the target.

gameplay_14_equipment_durability1

Change Equip Durability

Add > Combatant > Equipment > Change Equip Durability

  • Equipment Part
    Select Right Hand.
  • Value Type (Durability Change)
    Select Value.
  • Value
    Set to 1.
  • Operator
    Select Sub.
  • Object (Used Object)
    Select Actor.
  • Actor
    Select User.

That’s it for the attack event – click on Save Event to save the changes.

Now, open the attackNoCalculation.asset battle event. Here, we’ll add the new step after the Combatant Animation step.

gameplay_14_equipment_durability2

Change Equip Durability

Add > Combatant > Equipment > Change Equip Durability

  • Equipment Part
    Select Right Hand.
  • Value Type (Durability Change)
    Select Value.
  • Value
    Set to 1.
  • Operator
    Select Sub.
  • Object (Used Object)
    Select Actor.
  • Actor
    Select User.

That’s it for the attackNoCalculation event – click on Save Event to save the changes.

gameplay_14_equipment_durability3

Now, you’ll see the Short Sword‘s durability in the equipment menu, and the durability will decrease when attacking.

Tip: Repairing equipment

When adding equipment durability, you naturally also want to be able to repair the equipment when it’s broken or the durability is low.

You can add this mechanic using the Event System, similar to reducing the durability. E.g. add an NPC that asks to repair your equipment (for a fee) – it’s just a series of dialogues, inventory checks and durability changes, and you’ve got yourself a brand new repair NPC.