Skip to main content

Equipping Resources on Characters

Pre-requisites

Before you can fetch history for a character, you'll need the following:

  1. A project
  2. At least one created/imported Honeycomb Resource
  3. At least one character

Intro

Honeycomb Protocol has a rich inventory and resource system that allows your players to equip resources on characters to boost a character's stats or abilities. This guide will show you how to incorporate these elements in your game.

Equipping Resources

Before equipping the resources, please make sure that your players have both the character and the resource that's being equipped in their inventory. Otherwise, this transaction will fail.

Once you make perform the pre-requisite checks, here's how you can equip the resource:

const { 
createEquipResourceOnCharacterTransaction: txResponse // The transaction response that you have to get signed and send the transaction
} =
await client.createEquipResourceOnCharacterTransaction({
characterModel: characterModelAddress.toString(), // The address of the character model
characterAddress: characterAddress.toString(), // The character the resource is being equipped to
resource: resourceAddress.toString(), // The address of the resource being equipped
owner: userPublicKey.toString(), // The public key of the owner
amount: "1000", // The amount of the resource being equipped
});

Unequipping/Dismounting Resources

To unequip or dismount a resource from a character, you can use the following query:

const { 
createDismountResourceOnCharacterTransaction: txResponse // The transaction response that you have to get signed and send the transaction
} =
await client.createDismountResourceOnCharacterTransaction({
characterModel: characterModelAddress.toString(), // The address of the character model
characterAddress: characterAddress.toString(), // The character the resource is being unequipped from
resource: resourceAddress.toString(), // The address of the resource being unequipped
owner: userPublicKey.toString(), // The public key of the owner
amount: "1000", // The amount of the resource being unequipped
});