Equipment
Scripting with the Equipment class.
The Equipment
class serves as the settings and functionality of the inventory's equipment section. All fields listed in the Equipment tab of the Inventool editor window are public and can be changed at runtime.
When making edits to the equipment, relevant parts of the Inventool Window may need to be refreshed.
Accessing the Equipment
You can access the player's equipment with Inventool.Equipment
.
Fields & Properties
rotationType
The character viewer rotation type.
Equipment.RotationType
public
parityX
Controls whether the amount of slots on the X-axis are even or odd.
Equipment.Parity
public
parityY
Controls whether the amount of slots on the Y-axis are even or odd.
Equipment.Parity
public
characterImage
A character image to use instead of the 3D character viewer. This is meant for 2D games only.
Sprite
public
useEquipFallback
If enabled, when an item is attempted to be equipped through the TryEquip method and there are no slots available for it, the item will replace an existing one.
bool
public
slots
A list of all created equipment slots.
List<EquipmentSlot>
public
canEquip
A function that checks if an item can be equipped. You can use this to set your own logic to prevent/allow equipping.
Func<ItemStack, bool>
public
canUnequip
A function that checks if an item can be unequipped. You can use this to set your own logic to prevent/allow unequipping.
Func<ItemStack, bool>
public
Parity
Equipment grid parity types.
Even
An even number of rows or columns.
Odd
An odd number of rows or columns.
Equipment Slots
The equipment uses Equipment Slot as it's slots.
Adding Slots
Inventool.Equipment.slots.Add(mySlot);
Getting Slots
You can access the full list of slots with the slots
field.
Check If A Slot Exists
bool result = Inventool.Equipment.HasSlot("My Slot Name");
Get Slot By Name
EquipmentSlot slot = Inventool.Equipment.GetSlot("My Slot Name");
Get Slot At Position
// Get slot at position 0
EquipmentSlot slot = Inventool.Equipment.GetSlot(0);
Get Slot With A Specific Item Stack
EquipmentSlot slot = Inventool.Equipment.GetSlot(myItemStack);
Get First Slot of An Item Type
EquipmentSlot slot = Inventool.Equipment.GetSlot(myItemType);
Removing Slots
Inventool.Equipment.slots.Remove(mySlot);
Equipping
Checking Item Equipped State
The IsEquipped
method checks if an Item Stack or Item is currently equipped at any slot.
bool result = Inventool.Equipment.IsEquipped(myItem);
Equip An Item
The TryEquip
method attempts to equip an ItemStack
at the first slot possible. This method returns true if the item was successfully equipped. This may fail if there isn't a slot that can equip the item.
bool result = Inventool.Equipment.TryEquip(itemStack);
Unequipping
Unequip An Item
The TryUnequip
method attempts to unequip an ItemStack
. This method returns true if the item was successfully unequipped. This will only fail if the item stack was not equipped.
bool result = Inventool.Equipment.TryUnequip(itemStack);
Unequip All
The UnequipAll
method unequips all item stacks from all slots.
Inventool.Equipment.UnequipAll();
Last updated