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. Characters define which slots they have (and where they appear in the equipment UI).


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
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 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