[0.8.9][NK] Crafting Recipes

johnycilohoklajohnycilohokla REGISTERED Posts: 283 Developer
edited December 2015 in Modding Tutorials
Required: ModScriptClass

Recipe file

Each recipe needs to define a craftingActionName and craftingDisplayName.

The name of the recipe has to be unique!

craftingActionName combined with craftingDisplayName is used the display the message on the progress bar.
craftingDisplayName is used as a name for the Crafting Journal.

Example:
All Recipes
{
Recipe1
{
Script = "Scripts/Recipes/DefaultRecipe.lua"

LuaData
{
craftingActionName = "Crafting... "
craftingDisplayName = "Recipe1"
...
}
}

Recipe2
{
Script = "Scripts/Recipes/DefaultRecipe.lua"

LuaData
{
craftingActionName = "Crafting... "
craftingDisplayName = "Recipe2"
...
}
}
}
Adding crafting file to Eternus.CraftingSystem:
function MyMod:Initialize()
Eternus.CraftingSystem:ParseRecipeFile( "Data/Crafting/MyMod_CraftingGroup.txt",
"CraftingGroup" )
end

DefaultRecipe example

To create a recipe you will need a name for your recipe and a script
Example Recipe
{
Script = "Scripts/Recipes/DefaultRecipe.lua"
You will also need to define arguments for the script using LuaData:
	LuaData
{
First define common arguments:
		# required, name of the action
craftingActionName = "Crafting... "

# required, name of the crafting recipe
craftingDisplayName = "RecipeName"

# required, default craftTime
craftTime = 3.0

# optional, damage applied to unconsumed items
unconsumedDamage = 3

# optional, damage applied to unconsumed items
energyCost = 10.0

# optional, default to 0, higher priority recipes will be used first
priority = 1.0
Components section is used to define items that are required for the recipe and get used up:
		Components
{
Metal
{
# require 1 Latten or 3 Bronze Chunks
"Latten" = 1
"Bronze Chunks" = 3
}
Head
{
# and 1 Crude Hoe
"Crude Hoe" = 1
}
}
[Optional] Unconsumed Components section is used to define items that are required for the recipe but don't get used up, unconsumedDamage can be used to apply damage the items:
		Unconsumed Components
{
Stones
{
"Crude Rock Head" = 2
}
}
[Optional] Crafting Tool is used for tool that is required for the recipe:
		Crafting Tool
{
category = "Knife"
tier = 2
}
Results
		Results
{
"Bronze Hoe Head" = 1
}
[Optional] Failed Results section is used to define objects that are spawned when the crafting fail (ex. lack of energy)
		Failed Results
{
"Mad Mushroom Man" = 1
}
[Optional] Crafting Stations section is used to define in-game object that are required for the recipe, they don't get used up and need to be active:
		Crafting Stations
{
Crude Workbench
{
craftTime = 3.0
}
}
[Optional] Crafting Stations Optional section is used to define in-game object that are optional for the recipe, they don't get used up and need to be active:
		Crafting Stations Optional
{
Crafting Rock
{
craftTime = 2.0
}

Crafting Stump
{
craftTime = 2.0
}

Alchemy Table
{
craftTime = 3.0
energyCost = 7.0
}
}
Close the LuaData:
	}
And finally close the recipe:
}
My Blog
jc.png
  yt.png  t.png  
Sign In or Register to comment.