Skip to content

Items, recipes and books

Craftwright’s data lives in three kinds of data assets. Create them in the Content Browser with Add > Craftwright:

Asset Class What it holds
Craftwright Item UTACraftwrightItem An item that recipes use or make
Craftwright Recipe UTACraftwrightRecipe Ingredients in, outputs out, at a station or by hand
Craftwright Recipe Book UTACraftwrightRecipeBook A list of recipes given to crafters

In the Content Browser, items show their icon as thumbnail, and recipes show their own icon or the icon of their first output.

Property Category Default Meaning
Display Name Item Empty The name in menus. When empty, the asset name is used.
Description Item Empty Text for your UI, for example a tooltip.
Icon Item None A texture (soft reference). The menu shows it for ingredients and outputs, and for recipes without their own icon.
Tags Item Empty Gameplay tags. Tag ingredients use them (“any item with Item.Material.Wood”), and your game code can too.
Max Stack Item 99 How many fit in one slot of the built-in inventory. Minimum 1.
External Class Adapter None For inventory adapters: the item class of your inventory system that this item stands for.
External Asset Adapter None For inventory adapters: the item asset of your inventory system that this item stands for.
External Id Adapter None For inventory adapters: an id or row name in your inventory system.

The built-in inventory stores Craftwright items directly. Other inventories map their own items to Craftwright items through the three Adapter fields; see Mapping your items.

Get Display Name Or Default returns the Display Name, or the asset name when it is empty.

Property Default Meaning
Display Name Empty The name in menus. When empty, the first output’s name is used, then the asset name.
Description Empty Shown in the menu’s details.
Icon None Optional. Menus fall back to the icon of the first output.
Category None A gameplay tag for grouping and filtering in your UI, for example Recipe.Category.Weapons. The crafting menu makes its category tabs from it.
Property Default Meaning
Ingredients Empty What one unit needs. See Ingredients.
Outputs Empty What one unit makes. See Outputs.
Craft Time 2 s Seconds per unit at speed 1. 0 makes the recipe instant: it is made at once, without a queue.
Max Batch 0 The most units one request may ask for. 0 means no limit.
Property Default Meaning
Stations Empty The station types that can craft the recipe: gameplay tags compared with each station’s Station Tag. Empty means the recipe is crafted by hand, in the crafter’s own queue.

A station matches when its Station Tag is one of these tags or a child of one. A station tagged Station.Forge.Masterwork can craft recipes listed for Station.Forge; a station tagged Station.Forge can’t craft recipes listed only for Station.Forge.Masterwork. See Stations and fuel.

Property Default Meaning
Unlock Always Known Always Known: every crafter whose recipe books contain it knows it. Learned: it must be taught with Learn Recipe (a scroll, a trainer, a quest, the Learn Recipes effect). Discovered: learned automatically when the crafter carries at least one item for each of its ingredients.
Unlock Hint Empty Shown on the locked recipe in crafting menus, for example “Taught by the blacksmith”. Empty = the menu’s text for the unlock type.

See Unlocks.

Property Default Range Meaning
Failure Chance 0 0 to 1 The chance that a unit fails: it makes no outputs, and part of its ingredients comes back. 0.1 = 10 %.
Failure Refund 0.5 0 to 1 The share of a failed unit’s ingredients that comes back.
Cancel Refund 1 0 to 1 The share of the ingredients of unfinished units that comes back when a job is cancelled.
Bonus Chance 0 0 to 1 The chance that a successful unit is lucky and also makes the Bonus Outputs. The crafter’s luck multiplies it.
Bonus Outputs Empty What a lucky unit makes on top of its outputs, entries like outputs. Empty = the outputs once more.

See Failure and refunds for how refunds are counted, and Lucky crafts.

Property Default Meaning
Salvageable Off Players can salvage the main output back into ingredients, at the same stations (or by hand).
Salvage Refund 0.5 The share of the used-up ingredients that salvaging gives back, rounded down over the whole batch. Tag ingredients and tools are not given back. From 0 to 1.
Salvage Outputs Empty What salvaging one unit gives instead (scrap, a rare part), entries like outputs. Empty = Salvage Refund of the ingredients.
Salvage Time 0 s Seconds per salvaged unit at speed 1. 0 = instant (no queue).

The other three are editable only while Salvageable is on. See What salvage gives back.

Property Meaning
Conditions Extra requirements, checked on the client (for the menu) and again on the server. A condition can also pay a cost when the craft starts. Built in: Crafter Has Tags; the GAS module adds three more.
Effects Run on the server after each crafted unit, also after failed ones. Built in: Learn Recipes; the GAS module adds two more.

Both lists hold instanced objects: click +, pick a class and fill in its properties right in the recipe. See Conditions and effects.

Function Returns
Get Display Name Or Default Display Name, else the first output’s name, else the asset name
Is Hand Recipe True when Stations is empty
Is Instant True when Craft Time is 0
Can Craft At (Station Tag) True when a station with this tag can craft the recipe
Get Main Output The first output’s item, or none
Get Main Output Count The first output’s count: how many items one salvaged unit takes
Can Salvage True when the recipe is Salvageable and has a main output
Get Salvage Outputs (Units = 1) What salvaging Units units gives back, for previews in the UI

Each entry of Ingredients is one input of one unit:

Property Default Meaning
Item None The item to use. Leave it empty to accept any item with Item Tag.
Item Tag None Used when Item is empty: any item whose Tags contain this tag counts. Editable only while Item is empty.
Count 1 The amount needed for one unit. Minimum 1.
Consumed On Turn it off for tools: the item must be there but is not used up.

An ingredient with an Item accepts only that item.

An ingredient without an Item accepts any item that has its Item Tag, so “1 any wood” can use Oak Logs or Pine Logs. Items with a child tag count too: an item tagged Item.Material.Wood.Oak matches an ingredient asking for Item.Material.Wood.

When several items match, Craftwright first sets aside the specific items the recipe needs, then fills tag ingredients from what is left, taking the matching items in the alphabetical order of their asset paths. In the example, Item_OakLog comes before Item_PineLog, so Sticks and Planks use Oak Logs first. See How ingredients are taken.

An ingredient with Consumed off is a tool, like the Hammer in the example’s Iron Nails recipe. A tool:

  • is needed once per job, not once per unit: a batch of 10 nails needs one hammer;
  • must still be there after the consumed ingredients are set aside: if a recipe also uses up the same item, the crafter needs one more of it;
  • is checked when the job is queued and stays in the inventory.

Tools can be tag ingredients too (“any hammer”).

Each entry of Outputs is one result of one unit:

Property Default Meaning
Item None The item made.
Count 1 How many. Minimum 1.
Chance 1 The chance to get this output per unit, from 0 to 1. 1 = always; lower values make bonus or random outputs.

Every output rolls its chance separately for every unit. A recipe can make “3 Planks” always and “1 Sawdust” at 0.25.

For every unit, Craftwright first rolls Failure Chance. A failed unit:

  • makes no outputs (no output chances are rolled);
  • gives back Failure Refund of the ingredients one unit used;
  • still runs the recipe’s effects, with Succeeded off, and fires On Crafted with an empty output list.

When a job is cancelled, Cancel Refund of the ingredients of every unfinished unit comes back. The unit in progress counts as unfinished: its progress is lost, its ingredients are refunded.

Refunds are counted per item that was taken and rounded down:

refund = floor( floor(taken × units / units in the job) × refund share )

Examples:

Situation Refund
A unit of “2 Iron Ore → 1 Iron Ingot” fails with Failure Refund 0.5 1 Iron Ore
The example’s Cooked Meat burns (Failure Chance 0.1, Failure Refund 0) Nothing
A job of 3 Iron Ingots (6 ore taken) is cancelled after the first ingot, Cancel Refund 1 4 Iron Ore
A job of 3 Planks took 2 Oak Logs and 1 Pine Log and is cancelled after the first unit 1 Oak Log (2 × 2 / 3 rounds down to 1; 1 × 2 / 3 rounds down to 0)

Tools are never taken, so they are never refunded. Refunds go back to the crafter who ordered the job, in the same order as outputs; only what fits nowhere waits in the tray. See Outputs and the tray.

After a unit succeeds, Craftwright rolls Bonus Chance times the luck of the crafter who ordered the job (at most 100 %). A lucky unit also makes the Bonus Outputs, each with its own Chance, or its outputs once more when Bonus Outputs is empty. Failed units are never lucky. See Lucky crafts for the crafter’s luck and the events.

Salvaging a Salvageable recipe takes its main output, the first output in its count per unit (Get Main Output Count), and gives back for every unit:

  • the Salvage Outputs, each rolled with its own Chance, when the list isn’t empty;
  • otherwise Salvage Refund of every used-up ingredient that names an item, rounded down over the whole batch. Tag ingredients and tools are not given back.
given back for N units = floor(ingredient count × Salvage Refund × N)

Every unit gives its share of that total, so fractions add up over the batch instead of being lost per unit. With the example’s Salvage Refund of 0.5:

Salvaged Gives back
1 Pickaxe (2 Stick, 3 Iron Ingot, a Hammer as tool) 1 Stick, 1 Iron Ingot
2 Pickaxes 2 Stick, 3 Iron Ingot
1 Hammer (2 Stick, 1 Iron Ingot, 1 Rope) 1 Stick
2 Hammers 2 Stick, 1 Iron Ingot, 1 Rope

See Salvage for the requests, the queue and the events.

A condition is an object of a class derived from UTACraftwrightCondition. It has two functions you can override in Blueprint or C++:

Function When What to do
Is Met (Context, Out Reason) Every check, on the client for the menu and on the server before crafting Return false and fill Out Reason when the craft isn’t allowed. The reason is shown to the player.
On Craft Started (Context) On the server, once the craft is accepted and its ingredients are taken Pay costs: stamina, mana, money.

The Context has Crafter, Station (none for hand crafting), Recipe and Count (the number of units asked for).

Crafter Has Tags is built in:

Property Default Meaning
Required Tags Empty Gameplay tags the crafter must have. Empty always passes.
Require All On On: every tag is needed. Off: any one is enough.
Fail Reason Empty Shown when the crafter lacks the tags. When empty: Requires <tags>.

The tags come from the crafter’s Crafter Tags (set them on the server: skills, perks, faction), or from the ability system with the GAS crafter.

An effect is an object of a class derived from UTACraftwrightEffect. Override On Crafted (Context, Succeeded). It runs on the server after each unit, with Count 1 in the context and Succeeded off when the unit failed. Use effects for XP, stats, achievements or quest progress.

Learn Recipes is built in:

Property Default Meaning
Recipes Empty Recipes taught to the crafter who ordered the job.
Only On Success On Teach only when the unit succeeded.

In the example, the Pickaxe recipe has a Learn Recipes effect that teaches the Iron Sword.

A recipe book gives recipes to crafters. Put books into a crafter’s Recipe Books.

Property Meaning
Recipes The recipes of this book.
Included Books Other books whose recipes this book includes, for example a Book_Player that includes Book_Basics and Book_Smithing.

Get All Recipes returns the recipes of a book and all its included books, without duplicates. Books that include each other are safe.

A recipe that is in no book can’t be used by any crafter (unless it is learned directly), and the editor reports it as Not in a recipe book. An Always Known recipe is known by every crafter whose books contain it; Learned and Discovered recipes must also be learned. See Unlocks.

The example map’s 10 recipes are all in Book_Example. Wood means any item tagged Craftwright.Example.Material.Wood (Oak Log and Pine Log).

Recipe Where Time Max batch Ingredients Outputs Shows
Sticks By hand 1 s 1 any Wood 4 Stick A tag ingredient
Rope By hand 2 s 3 Plant Fiber 1 Rope Discovered, with an Unlock Hint
Torch By hand Instant 1 Stick, 1 Coal 2 Torch An instant recipe
Planks Workbench 2 s 1 any Wood 3 Plank A station recipe, Bonus Chance 0.1
Hammer Workbench 4 s 1 2 Stick, 1 Iron Ingot, 1 Rope 1 Hammer Max batch, Salvageable (2 s)
Iron Nails Workbench 2 s 1 Iron Ingot, 1 Hammer (tool) 8 Iron Nails A tool
Pickaxe Workbench 5 s 1 2 Stick, 3 Iron Ingot, 1 Hammer (tool) 1 Pickaxe Learn Recipes: teaches Iron Sword; Salvageable (3 s)
Iron Ingot Forge 3 s 2 Iron Ore 1 Iron Ingot Fuel, ore from a nearby chest, Bonus Chance 0.15
Iron Sword Forge 6 s 1 3 Iron Ingot, 1 Stick 1 Iron Sword Learned, with an Unlock Hint; Salvageable (4 s)
Cooked Meat Campfire 4 s 1 Raw Meat 1 Cooked Meat Failure Chance 0.1, Failure Refund 0

Every example recipe has Failure Refund 0 and the default Cancel Refund 1; the salvageable ones have the default Salvage Refund 0.5. The unlock hints are “Carry plant fiber to discover it.” (Rope) and “Forge your first pickaxe to learn it.” (Iron Sword). The recipes’ categories are Materials (Sticks, Rope, Planks, Iron Nails, Iron Ingot), Tools (Torch, Hammer, Pickaxe), Weapons (Iron Sword) and Food (Cooked Meat), as tags under Craftwright.Example.Category. The 16 example items are Oak Log, Pine Log, Plank, Stick, Plant Fiber, Rope, Iron Ore, Coal, Iron Ingot, Iron Nails, Hammer, Pickaxe, Iron Sword, Torch, Raw Meat and Cooked Meat.