Jump to content

[Help Modding] Action & Recipe not work


Recommended Posts

Hi all ! Today I'm trying to make a new mod witch add an item witch can repair tool like sewing kit repair hats.

I've added:

- a components : sharpening

- a prefab : whetstone_kit

 

I've added the recipe in tool recipe tab, craft is 5cutstones + 4houndstooth + 10flints

When i craft my new item i receive nothing, no item in my inventory. I've no idea where is my error and I need your help. I'll add you as a contributor in modinfo.lua.

 

I've done the same mod for DS and i receive the item in my inventory.

 

See the mod in ZIP file

 

 

 

whetstone_kit.zip

Edited by AireAyquaza
Last issue fixed
Link to comment
Share on other sites

AddRecipe(
	"whetstone_kit", 
	{
		Ingredient("cutstone", 5),
		Ingredient("flint", 10),
		Ingredient("houndstooth", 4)
	},
	RECIPETABS.TOOLS,
	TECH.SCIENCE_TWO,
	nil, 1, nil, nil, nil, "images/inventoryimages/whetstone_kit.xml"
)

What is the "1" for, in nil, 1, nil, nil line ? Because as far as i know, the number here is only for min_spacing for building. Maybe first try replacing it by a nil and see if it works better ?

 

(Also, your tag is named "shaprens" both time, will probably not create errors, but just mentionning it just in case)

 

As far as i know, code is a little different in DST than DS. Usually when i add a recipe is this way :



		local whetstone_kit = AddRecipe("whetstone_kit", {Ingredient("cutstone", 4), Ingredient("flint", 10), Ingredient("houndstooth", 4)  }, RECIPETABS.TOOLS, TECH.SCIENCE_TWO, nil, nil, nil, nil, nil, "images/inventoryimages/whetstone_kit.xml", "whetstone_kit.tex")

Hope it could help.

Link to comment
Share on other sites

@AireAyquaza If the item doesn't work even with DebugSpawn, the recipe isn't the first problem. When looking at your code, it seems that you didn't have any of theses lines :


    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

I suggest that maybe you could look at the sewingkit.lua of DST and see how it works and what line could be missing in your prefab. DST code isn't like DS, they have a lot in common but DST require specific lines for server side code and things like this.

I'm not sure this is why your item doesn't spawn, but i'm sure that you will need this part sooner or later.

Also, in your prefab you have :

local function fn(Sim)

I don't understand, why "(Sim)" ?

Link to comment
Share on other sites

What do you have in the log at

 

C:\Users\YourUserName\Documents\Klei\DoNotStarveTogether

client_log.txt ?

 

(If you are on ANewReign beta, search in the DoNotStarveTogetherANewReignBeta folder. Crash usually let an error log somewhere, sometime it's in the folder of the world crashing. If there is no error in client_log.txt try searching in Cluster_Numberofthesave/Master/Server_log.txt

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...