Equipment / Create Equipment

How to Create Equipment Video

How to Create New Equipment
How to Create New Equipment — 8:38
To follow along with this video, Download the Meat Maul Icon Texture

How Equipment Items Work

All pieces of equipment are considered items but not all items are considered equipment.

It is because of this simple fact that we don’t want to just stuff equipment specific data into our items data table, or vice versa. Instead we use two different data tables, one for the item information DT_Items, and the other for equipment information DT_Equipment. We associate our equipment to our item by making the row names match each other. Both of these data tables can be found in the Blueprints/Variables/DataTables/ folder.

So for every item in our DT_Equipment data table there is a matching row with the same exact row name in the DT_Items table.

The row in the DT_Items data table is how our equipment exists in our world when it is not being shown or used by our character. When you see it on the UI this is the item form of it. Such as when it is stored in our inventory or a storage container, or for sale on a vendor, loot in a chest, or the result of a crafting recipe.

When we attempt to equip or use our equipment is when the data from the DT_Equipment data table is used. Anything related to and including the mesh being used on our pawn when we equip something is found in this table.

For example you won’t find weapon names inside of the DT_Equipment because the weapon name does not matter when it is in the Equipment side of the system. Weapon name is something that is only visible when it is in the Item form, like when we hover over it in our inventory to see the item info tooltip. You will find EquipmentSlot in there, because every piece of equipment has an equipment slot, but not every item will have one, so our equipment data table is a more appropriate place for it.

Prerequisites

As mentioned above, a piece of equipment is an extension of an item and if you haven’t done so already, take a minute and create your item. Make sure it spawns properly in your world and that you can pick it up.

You will also need to make sure you set up your equipment slot and specialty slot if you are not using one of the included ones.

If you are attaching equipment using a mesh make sure the pivot point on your mesh is in the right location. This is the point on the mesh that will be used to attach your mesh to your pawn’s socket. If you need to change the pivot point you can do so in the editor using the modeling tools.

Create your equipment definition

  1. Open the DT_Equipment data table in the Blueprints/Variables/DataTables folder.
  2. Add a new row to the data table, make sure your row name matches the row name of your item. As mentioned above, this shared row name is how we link the item to the equipment.
  3. Fill out the remainder of the fields using the variables, see below for a breakdown of the purpose of each variable.
EquipmentSlot The slot on the pawn the equipment should be assigned to when equipped. See the Equipment Slot chapter to learn more, and to create new ones.
EquipmentSlotIndex An optional index that will be sent with your equipment slot when relaying info to and from your pawn. For example our grenade is a main hand weapon, but you may have noticed it actually equips to the left hand instead of right. This is because we have an index of 1 set for this value, and inside our pawn we are checking for that value, and if it is 1 we return the left hand, and if it is 0 we return the default right hand.
EquipmentStance The stance influenced by this equipment when equipped. See the Equipment Stance chapter to learn more, and to create new ones.
EquipmentHandler The equipment handler to use when this equipment is equipped. See the Equipment Handler chapter to learn all about them.
EquipSkeletalMesh If our equipment is a skeletal mesh we can provide it in this field.
EquipStaticMesh If our equipment is a static mesh we can provide it in this field.
EquipOther If we want to equip a custom blueprint, we can assign it here. The system is designed to equip actors, actor components, and scene components. Your custom blueprint should be one of these types.
EquipInputMappingContext The input mapping context to inject when this equipment is equipped. You can manually define your IMCs inside the equipment handler using the linkInput method. For multiplayer make sure you are calling this only on the client (typically by using onSetupClient override).
EquipUserInterface The UI to show when the equipment is equipped. You can manually define your UIs inside the equipment handler using the linkCustomUI method. For multiplayer make sure you are calling this only on the client (typically by using onSetupClient override).
EnableMirroring? Toggle to enable equipment mirroring on this equipment. Mirroring lets us show our mesh in multiple locations. For example our boots are mirrored form our right foot to our left foot in our demo world. See the Equipment Mirroring chapter to learn more.
EnableLeaderPose? If you need the mesh you are using to follow a leader pose component you should enable this and respond to the getLeaderPoseComponent BPI_Equipment_Pawn interfaced method with your leader mesh.
EquipRelativeModifiers If you would like to provide a relative transform modification to all pawns equipping this equipment you would use this variable to set it. This is in addition to the values returned from your pawn when getEquipTarget and getMirroTarget is called. Location is added to the location returned by your pawn. Rotation is combined with the rotation returned from pawn, and scale is multiplied by the scale returned from pawn.

Pop quiz Timmy! To add a new piece of equipment to our game, which data table do we need to use, DT_Items or DT_Equipment?

Pawn Setup

If you haven’t done so already you will want to set up equipment on your pawn. If you have already finished this then you should be able to equip your equipment item now and see it on your pawn.

If you can’t equip your item because you haven’t created the slot for your equipment window, see the equipment slot chapter to finish setting up the specialty slot and associating the specialty slot with your player profile.

A note about Custom Blueprints

Equipment handlers are great and can handle most of our needs, but if you need to take it a step further you can leverage the system to easily equip your own custom blueprints. You can define your blueprint on the DT_Equipment data table using the EquipOther variable.

You will want to implement the BPI_EquipmentBluperint blueprint interface into your custom blueprint. This will provide an event called equipmentReady that will be called when the handler is finished setting up. This event call will provide your blueprint with a reference to the handler, from which you can get all the data you need about the equipment, item, or player. Use this event as your “begin play” / “on equip” event. There is also unequipBlueprintEquipment which is called during unequipping, and hideBlueprintEquipment which will be called when a request to hide the mesh has been received (the hide or show state is provided as an input on this event).

If you are using a custom blueprint in a multiplayer game it is your responsibility to make sure you properly set it up for replication. If you are new to multiplayer replication I highly recommend reading through the Multiplayer Compendium by Cedric Neukirchen.

A note about Custom Widgets

If you are creating a custom widget you should also implement the BPI_EquipmentBluperint into the widget, then use the equipmentReady event to get a reference to the equipment handler. The other included events will not be called on your custom widget.