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.


Fixed-option traits (rarity)

Traits with a chooseOne type give a fixed option list — rarity (common, uncommon, rare, epic, legendary, quest) ships this way for every game, and you can define your own in the item_traits file.

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.)
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
learn_recipeRecipe id this item teaches — adds a "Learn" choice that learns it and consumes the item (see Apply)
statusWhat stats/abilities/skin layers to apply when equipped

A traits.item_level number renders as a level badge on the item card – a purely visual indicator. Systems that scale item instances (e.g. the experience plugin's dungeon-level scaling) stamp it on creation.

Example - Iron Sword:

FieldValue
slotsmain_hand, off_hand
traits.name"Iron Sword"
traits.damage25
traits.weight5
traits.raritycommon
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 (auto-makes this a craft station — see Apply)
group_recipesRecipe groups available here (the recipe_groups editor tab). Every recipe in the group is added on top of recipes, so one station can take a whole group plus a few extras
interactiveCustom apply interaction (craft, enchant, …). Auto-set to craft when recipes or group_recipes bring in at least one recipe; set by hand only for non-crafting interactions
itemsStarting items in this inventory
traitsCustom inventory data (definitions live in the inventory_traits editor tab; plugins can inject their own, e.g. the experience plugin's dungeon trait)
auto_createInstantiate this inventory at game start. An inventory opened via loot:/trade: must have a live instance – without one, opening throws "Inventory not found". Use it for GLOBAL inventories (shops, shared stashes). For dungeon chests prefer the experience plugin's dungeon inventory trait: the inventory is created on first entry of the bound dungeon (or any dungeon sharing its level group), so contents pick up the dungeon level and lock at entry (no save-scumming). Leave both OFF for battle-loot inventories: those are read as pure drop tables by the reward system (never instantiated)

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 are consumable for one-time-use effects (potions, scrolls, buff foods). There is no is_consumable flag — an item is consumable when it has any consume effect: it applies a status, restores/reduces a resource, or defines a consume action script. When it does, a Consume choice appears in the inventory automatically.

What Happens on Consume

StepWhat happens
1item_consume_before event fires (return false to cancel)
2Each apply_statuses_on_consume status is applied (by template id, with stacks)
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
apply_statuses_on_consumeList of { status, stacks }. Applies real status templates — each carries its own duration, max_stacks, polarity, and group_id (no per-item shaping fields).
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 applied on equip (independent of consume). See below.

Equip status and consume statuses are independent

status is applied on equip; apply_statuses_on_consume on consume. An item can carry both and they can differ — e.g. a Golden Apple gives +2 luck while equipped, and +10 health when eaten.

Duration, stacking, and mutual exclusion live on the status

Because consume statuses are real templates, their duration / max_stacks / multi_stack come from the status itself. To make ranked variants replace each other (small_blessing → big_blessing), give them the same group_id on the status template — applying one removes any other in the group, regardless of how it was applied (status action, consumable, or battle effect).

Usable Items

An item with a use_scene trait gets a Use choice in the inventory. The trait's value is a scene reference (dungeon_id.room_id.scene_id, room_id.scene_id, a full #id, or an &anchor), and picking Use plays that scene with the item as the active item.

The engine does nothing else: no cost, no gating, no consumption. The scene owns all of it, which is what makes one trait enough for every kind of usable item — a key, a letter, a single-use charm.

Inside the sceneHow
Name the itemThe |item| placeholder resolves to the active item's name
Show its card{item_view: true}
Spend it{remove_item: true} removes one of that exact stack ({remove_item: 3} for more)
#lockpick_use
1
%
|I| work the |item| into the lock until something inside it gives.
{remove_item: true}

book and painting are the two specialized cousins of this trait — they render their own reader / viewer instead of playing an authored scene. Reach for use_scene for everything else.



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").
remove_itemRemove items from an inventory. true (or a number) takes one/N of the active item; otherwise the add_item spec ("potion#5").
use_scenePlay the scene an item's use_scene trait names, with that item active. Powers the auto Use choice.
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. A ^pool value opens a placement-unique pool-generated inventory (experience plugin's Rewards & Scaling guide).
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