Adding New Item

As an example let’s try to create one handed wooden sword.

Firstly we need to create item object blueprint.
We have several base blueprints which already has interfaces / modifiers / default values etc.

  • Item_Base - base item blueprint.
    Create new item from it, if none of base blueprints below fits your requirements
  • Item_Armor
  • Item_Arrow
  • Item_MeleeWeapon
  • Item_RangeWeapon
  • Item_Spell
  • Item_Ring
  • Item_Necklace
  • Item_Potion
  • Item_Shield

We want to create one handed weapon so as base class let’s use Item_MeleeWeapon.
Let's name it WoodenSword and move to Instances folder.

We have bunch of settings there that we should modify to customize our sword.

  • BlockValue - percentage value of absorbed damage on block
  • TwoHanded - whether item is one or two handed
  • WeaponType - type of weapon
  • Modifiers - bonus stats that will be added when item is equipped.
    By default there are 4 modifiers, but you could add more like Health bonus etc.
  • DisplayedItem - class of item that will be displayed when this sword is equipped
  • Details - base info about item

Now that we have our sword’s object item, we should also create it’s visual representation, which is DisplayedItem.
We again have few base blueprints to choose.

  • DisplayedItem - base displayed item blueprint.
    Create new item from it, if none of base blueprints below fits your requirements
  • DI_MasterPose - used on items that should use owner’s mesh as master pose, e.g armor/gloves/boots/pants etc.
  • DI_Hand - used for items which are equipped to hand e.g shield/sword/bow etc.

Obviously we want to create blueprint based on DI_Hand, since our sword will be equipped to hand.
Let's name it DI_WoodenSword and move to Instances folder.

Before modifying displayed item, let’s check our wooden sword static mesh.
It should have sockets which will be used to detect hits.

Now we can add wooden sword mesh to displayed item hierarchy

Additionally let's add Dissolve tag to sword mesh (used by AI on death).

Since parent blueprint DI_Hand handles attachment socket method, we don’t have to write any code there, just change socket names.

  • HandAttachmentSocket - socket used when character is in combat
  • AttachmentSocket - socket used when character is not in combat

Do not change Equipment variables manually, it will be updated by EquipmentComponent on equip.

Make sure to go back to object item blueprint and change it’s displayed item class to DI_WoodenSword.

Finally we can test it, let's add it to PickupActor, gather and equip.