Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Purpulear

Need Help With Character Specific Crafting

Recommended Posts

Purpulear    1

Hello I am currently working on a character mod for DST. And I've added a bow and arrow to the game. But, i'd like to make it so only my character can craft them, but be able to share them. Like Wigfrig and her helmets. 

My current recipes and code for them are: 


local bow = AddRecipe("bow",{ Ingredient("log", 10), Ingredient("rope", 2)}, GLOBAL.RECIPETABS.WAR, GLOBAL.TECH.NONE, nil, nil, nil, 1, nil, ATLAS_BOW)


local arrow = AddRecipe("arrow", { Ingredient("rocks", 1 ),  Ingredient("twigs", 1)  }, GLOBAL.RECIPETABS.WAR, GLOBAL.TECH.NONE, nil, nil, nil, 3,  nil, ATLAS_ARROW)

Share this post


Link to post
Share on other sites
thomas4846    526

can you tell us the problem what does it come up with when their is a error is it that you want it to be a character specific item,i'll give you an e.g but if you don't understand please ask me i'll try to help with the best of my ability 

AddRecipe("item name",
    {
        Ingredient("type of ingredient 1", amount),
        Ingredient("type of ingredient 2", amount),
    },
    RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, 'the tag you select for your character', "images/inventoryimages/image name.xml")

(the tag select for your character basically makes it so that only your character can craft it)

(this is the basic crafting recipe that i put on my post anyway, i would put this in a coded version but with this you can see the highlighted areas )

Share this post


Link to post
Share on other sites
Purpulear    1
40 minutes ago, thomas4845 said:

can you tell us the problem what does it come up with when their is a error is it that you want it to be a character specific item,i'll give you an e.g but if you don't understand please ask me i'll try to help with the best of my ability 

AddRecipe("item name",
    {
        Ingredient("type of ingredient 1", amount),
        Ingredient("type of ingredient 2", amount),
    },
    RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, 'the tag you select for your character', "images/inventoryimages/image name.xml")

(the tag select for your character basically makes it so that only your character can craft it)

(this is the basic crafting recipe that i put on my post anyway, i would put this in a coded version but with this you can see the highlighted areas )

No errors or anything. The item is currently craftable id just like it to be exclusively craftable.

But I think I got it. Just, how do I set up the tag for my character?

Share this post


Link to post
Share on other sites
Ultroman    537

In your character's prefab Lua file, go to the common_postinit function and add this line

inst:AddTag("whatever_tag_you_want")

 

Share this post


Link to post
Share on other sites
Ultroman    537

The error says you're using TECH which is a global variable. Either do GLOBAL.TECH or add the following to the top of your modmain.lua

local TECH = GLOBAL.TECH

 

Share this post


Link to post
Share on other sites