Items System

Items in Dryad Engine follow the same layered philosophy as everything else. When equipped, an item applies a status to the character - adding stats, granting abilities, or changing appearance.


Items Are Status Containers

Like skills and buffs, equipped items add a status layer to the character:

ActionStatus Effect
Equip a sword+10 Damage
Wear armor+50 Health, armor skin layer
Hold a magic staffGrants "Fireball" ability

Unequip the item, and its status is removed. The character loses those bonuses immediately.


The Editor Forms

Item Traits

What they are: Custom data fields for items (like Character Traits, but for items).

Go to Items > Item Traits and define fields like:

FieldTypeExample Value
namestring"Iron Sword"
descriptionrich-text"A sturdy blade..."
imageimage(icon path)
weightnumber5
damagenumber25

When to use: Any data you want to store on items - display info, stats, custom properties.


Item Attributes

What they are: Categories with fixed options (like Character Attributes).

AttributeOptions
raritycommon, uncommon, rare, legendary
typeweapon, armor, accessory, consumable
elementfire, ice, lightning, none

When to use: Filtering items in UI, driving visual styles, game logic branches.


Item Slots

What they are: Equipment positions on characters.

Slot IDDisplay Name
main_handMain Hand
off_handOff Hand
headHead
chestChest
accessory_1Accessory

Items define which slots they can go into (the item's slots). Characters define which slots they have (and where they appear in the equipment UI).

accepts — sharing one item across many slots. A slot always admits items targeting its own id. The optional accepts field lists extra slot tokens it also admits, so a single item can fit many slots without listing each one. Define a shared "tag" slot (with no character instances) and have the real slots accept it:

Slot IDacceptsAdmits items whose slots include…
trinket_general–(tag-only slot — nothing equips it directly)
trinket_anetrinket_generaltrinket_ane or trinket_general
trinket_ordeliatrinket_generaltrinket_ordelia or trinket_general

A general trinket sets slots: ["trinket_general"] and fits every character's trinket slot; a character-specific trinket sets slots: ["trinket_ane"] and fits only Ane's. Adding a new character never touches existing items — its slot simply lists trinket_general in accepts. Leave accepts empty for an ordinary slot (it matches its own id only).


Item Categories

What they are: Player-facing inventory filter groups — the tabs (and their icons) in the inventory UI. Unrelated to Item Slots: categories never affect where an item equips; they only sort the inventory view.

Go to Items > Item Categories and define groups:

FieldDescription
nameTab label (e.g. "Consumables")
iconTab icon image (falls back to the name as a text chip if omitted)
orderTab order (lower shows first)

Each item template picks one category (its category field). The inventory shows a built-in All tab plus one tab per category, with a name search box; items with no category appear only under All.


Item Templates

What they are: The actual item definitions.

FieldDescription
traitsItem's custom data (name, damage, weight, etc.)
attributesCategories (rarity, type)
slotsWhich equipment slots this item fits
tagsFor filtering and game logic
categoryInventory filter category (player UI only)
priceTrading value in various currencies
max_stackHow many can stack (1 = no stacking)
is_currencyWhether this item is money
statusWhat stats/abilities/skin layers to apply when equipped

Example - Iron Sword:

FieldValue
slotsmain_hand, off_hand
traits.name"Iron Sword"
traits.damage25
traits.weight5
attributes.raritycommon
attributes.typeweapon
status.stats.damage25
status.abilitiespower_strike
status.skin_layersweapon_sword

Inventories

What they are: Containers that hold items.

FieldDescription
maxSizeMaximum number of stacks (0 = unlimited)
maxWeightMaximum total weight (0 = unlimited)
recipesWhich crafting recipes are available here
itemsStarting items in this inventory

Special inventories:

InventoryID FormatDescription
Party_party_inventoryShared inventory for all party members
Character private_character_[characterId]Personal storage per character (e.g., _character_mc)

Equipment Flow

StepWhat happens
1Character template defines equipment slots (main_hand, head, etc.)
2Item template defines compatible slots it can equip to
3On equip: item's status is applied (stats, abilities, skin layers)
4On unequip: item's status is removed

Consumable Items

Items can be marked as consumable for one-time-use effects like potions, scrolls, and buff foods. Enable is_consumable in the item template to unlock the consume fields.

What Happens on Consume

StepWhat happens
1item_consume_before event fires (return false to cancel)
2Item's status is applied to the character (visible, stackable)
3Percentage-based resource changes are applied
4Flat resource changes are applied
5Item quantity is reduced by 1 (removed if last in stack)
6item_consume_after event fires

Template Fields

FieldDescription
is_consumableEnable consume functionality
consume_durationHow many turns the applied status lasts. -1 or empty = permanent
consume_max_stacksMax stacks when consuming the same item multiple times. -1 = unlimited
consume_percentagePercentage of max resource to restore/reduce (e.g., heal 25% of max health)
consume_absoluteFlat resource amount to restore/reduce (e.g., restore 50 health)
statusStatus to apply on consume (same field used by equipment)

Stacking Behavior

Consuming the same item type multiple times produces the same status ID, so the engine's status stacking applies automatically. Use consume_max_stacks to cap how many stacks can accumulate.

Consume vs Equip

EquipConsume
DurationWhile equippedTemporary or permanent
Status visibilityHiddenVisible
ReversibleUnequip removesCannot undo
StackingOne per slotStackable
QuantityUnchangedReduced by 1

Accessing Items in Code

MethodDescription
game.createItem(id)Create an item instance
game.getInventory(id)Get an inventory by ID
inventory.addItem(item, quantity)Add items to inventory
inventory.getItemsById(id)Find items by template ID
inventory.getCurrencyAmount(id)Get currency total
inventory.canAffordPrice(price)Check if can afford
inventory.deductCurrency(price)Pay with currency
character.getEquippedItems()Items equipped on character

Common patterns:

TaskSteps
Give player a swordgame.createItem('iron_sword') → inventory.addItem(sword)
Check and deduct goldinventory.canAffordPrice({ gold: 100 }) → inventory.deductCurrency({ gold: 100 })

Item Actions (scripting)

Scene actions for items (used in dungeon content). See Actions for full syntax.

ActionWhat it does
equipEquip/unequip by real character + item-template ids (recommended). char -> item & item, char -> !item to unequip, !char.slot_type to clear a slot, !char to clear all.
equip_item / unequip_itemInternal/advanced — act on the active item (uid). Keep for active-item flows ({ equip_item: true }, e.g. an equip/unequip cancel handler). Prefer equip otherwise.
add_itemAdd items to an inventory by id ("sword, potion#5").
consume_itemConsume the active/target item.
item_slotAdd/remove equipment slots on a character ("alice->extra_ring, bob->!ring_3").
loot / tradeOpen a loot / trade exchange.
learn_recipeLearn crafting recipe(s).

Prefer equip over equip_item/unequip_item for normal scripting: it takes stable character and item ids, while equip_item/unequip_item operate on the active item's uid.


Item Events

EventWhen it fires
item_createItem instance is created
item_equip_beforeBefore equipping (return false to cancel)
item_equip_afterAfter equipping
item_unequip_beforeBefore unequipping (return false to cancel)
item_unequip_afterAfter unequipping
item_consume_beforeBefore consuming (return false to cancel)
item_consume_afterAfter consuming
trade_initWhen a trade opens (modify prices here)

Example - Cursed items:

EventCheckResult
item_unequip_beforeitem.traits.is_cursedreturn false, show notification

Quick Reference

I want to...Do this
Define item data fieldsItems > Item Traits
Create item categoriesItems > Item Attributes
Define equipment positionsItems > Item Slots
Create an itemItems > Item Templates
Create a containerItems > Inventories
Give player an iteminventory.addItem(item)

Next Steps

  • Exchange - Trading, shops, and currencies
  • Apply - Crafting and custom apply logic
  • Overview - How items connect to the status system