Sign in to follow this  
AireAyquaza

[Help Modding] Action & Recipe not work

Recommended Posts

AireAyquaza    5

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

Share this post


Link to post
Share on other sites
Lumina    2149
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.

Share this post


Link to post
Share on other sites
AireAyquaza    5

Hi ! Thanks for the code. This add the item in the tab like I would but same issue, when I craft it I get nothing in my inventory. I try DebugSpawn my item and nothing spawn :/ I'm so disapointed 

Share this post


Link to post
Share on other sites
Lumina    2149

@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)" ?

Share this post


Link to post
Share on other sites
AireAyquaza    5

Ok, I've see the code of sewingkit, sewing, SGwilson_client, SGwilson, componentactions and add missing lines in my code.

But new issue : "There was some sort of trouble starting the server. Please try again". I'm unable to start a game with my mod (this is the unique mod in the game)

Linked new archive :

whetstone_kit.zip

Share this post


Link to post
Share on other sites
Lumina    2149

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

Share this post


Link to post
Share on other sites
Lumina    2149
[00:00:01]: [string "../mods/whetstone_kit/modmain.lua"]:21: attempt to concatenate field 'ACTIONS' (a table value)

This seems to be an error, but i can't help you to know how to solve it, sadly.

Share this post


Link to post
Share on other sites
AireAyquaza    5

Yes ! It works ! I can craft the item and get it in my inventory. But i think i forget a line because when i take the whetstone kit hover my damaged axe i will see the repair action in right click and i cannot see that :/

 

This is the last step, i'll search for my part

whetstone_kit.zip

Share this post


Link to post
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
Sign in to follow this