Add a recipe¶
A recipe is one Data Asset listed in the recipe book. Once it is there, the crafting window (C) shows it under its category and the host accepts it. No graph is needed.
Steps¶
- In
Content/ZombieSurvival/DataAssets/Recipes/Childs/, duplicate one of the fifteenDA_Recipe_*, or create a Data Asset of the classPDA_RecipeDef. - Fill its fields (table below). Give it a unique
RecipeId. - Add it to
DA_RecipeBook_Default, in the same folder. - If it makes a new item, register that item in
DA_ItemRegistry_Default. - If players do not know it from the start, give them a way to learn it:
TeachesRecipesof a magazine, orGrantedRecipesof an occupation or a trait.
| Field | What it does |
|---|---|
RecipeId |
A unique Name. A character's learned recipes and favourites are stored by it. |
DisplayName, Description |
The row label, and the text of the detail column. |
Category |
A Recipe.Category.* tag: the column it is listed under. |
Inputs |
Items and counts, all used up when the craft ends. |
Outputs |
Items and counts, all given. What the bag cannot take lands at the crafter's feet. |
Tools |
For each tool: the item, its WearChance and WearAmount, and ChargeUse for a tool that runs on a charge. A tool is needed in the bag and is not used up. |
SkillTag, MinLevel |
The skill and the level it asks for. Below it the window says "Skill too low". |
Workstation |
The workbench that must be within reach. Empty: none. |
ActionDef, BaseDuration |
The timed action that runs it (DA_Action_Craft, DA_Action_CraftWood or DA_Action_Weld), and its time in seconds before skill and traits. |
XP |
The points each craft grants, per skill. |
NoiseTag |
The row of the noise table it makes when it ends. Empty: silent. |
bKnownByDefault, LearnAtLevel |
Known from the start. Otherwise learned when SkillTag reaches LearnAtLevel (-1: never by level). |
A new category¶
- Declare a
Recipe.Category.*tag in Edit > Project Settings > Gameplay Tags. - Add it to
CategoriesonBlueprints/UI/WBP_CraftWindow. - Add its label to
CategoryLabelson the same widget.
A workbench¶
A workbench is a PDA_WorkstationDef with three fields: WorkstationTag (under Workstation.),
DisplayName and Range. One ships, DataAssets/Recipes/Childs/DA_Workstation_Carpentry: "Carpentry
Workbench", with a reach of 200 uu.
- Create the workstation Data Asset.
- Name it in the
Workstationfield of a piece of furniture. Every piece of that furniture is then a bench for the recipes that ask for this station. - To let players build one, add a buildable piece for it to the build book.
A repair item¶
A repair item is a PDA_RestoreDef in DataAssets/Items/Childs/. Three ship: DA_Restore_DuctTape,
DA_Restore_Glue and DA_Restore_Propane.
| Field | What it does |
|---|---|
ConsumedItem |
The item used up. |
TargetItems, TargetCategories |
The items, or the categories, it mends. |
Field |
Condition or Charge. |
BaseAmount |
A fraction of the maximum: 0.20 for the tape, 0.30 for the glue, 1.0 for the propane. |
bUsesWeaponCare |
Whether the Weapon Care skill counts. |
DecayPerRepair |
What each earlier repair takes off: 0.25. |
ActionDef |
The timed action: DA_Action_Repair. |
BaseDuration |
Its time: 4 s for the tape, 6 s for the glue, 3 s for the propane. |
XP |
The experience: 3 Weapon Care points for the tape, 4 for the glue. |
Add it to Restores in DataAssets/Recipes/Childs/DA_CraftingSettings_Default. The Repair category
then offers it. The same asset holds the largest batch (MaxBatch, 20) and the margin the host adds to the reach of the sources of ingredients (SourceTolerance, 80 uu).
Test it¶
- Open
Content/ZombieSurvival/Maps/L_Worldand press Play. - Press T and type
/give <ItemSaveId> [count]for each input and tool. - Press C. The recipe is under its category. The detail column shows what you have against what it needs, in green or red.
- Press Make. The action runs, then the outputs go into your bag.
For a recipe that is learned, read the magazine that teaches it first.
If it does not work¶
- It is not in the crafting window, and the host answers "Unknown recipe": it is missing from
DA_RecipeBook_Default. - It is in the book but not in the window: your character does not know it. The window lists only known recipes.