reims9875 Posted April 18, 2021 Share Posted April 18, 2021 How to do it ?Help Link to comment Share on other sites More sharing options...
pickleplayer Posted April 18, 2021 Share Posted April 18, 2021 Do you mean it should only be "crafted" by your character? Or only be "picked up" by your character? Making a specific item only craftable by your character is relatively easy. The other is a bit tricky. Link to comment Share on other sites More sharing options...
reims9875 Posted April 19, 2021 Author Share Posted April 19, 2021 (edited) both options Edited April 19, 2021 by reims9875 Link to comment Share on other sites More sharing options...
Goregonzola Posted April 20, 2021 Share Posted April 20, 2021 (edited) Oh, a problem I know the solution to! I'm assuming it's about a custom item. If you want to create a recipe that's only available to a specific character to craft, create a coding like this and add it to your modmain.lua's bottom: Quote AddRecipe("name_of_the_item",{ Ingredient("first_ingredient_name", quantity), Ingredient("second_ingredient_name", quantity)}, tab_name, tech_level,nil,nil,nil,1,"required_tag_for_craft", "images/inventoryimages/name_of_the_item.xml", "name_of_the_item.tex") The red part is where you can add what tag is required to make the recipe appear for the survivors. If you want to make the custom item tag restricted, add this to your item's prefab file. You should add it inside the local function fn(Sim) part under the inst.entity:SetPristine() part. Quote inst:AddComponent("equippable") inst.components.equippable.restrictedtag = "required_tag_for_craft" inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) If it's not a custom item, come back for a refund. Edited April 21, 2021 by C_Thun Link to comment Share on other sites More sharing options...
pickleplayer Posted April 20, 2021 Share Posted April 20, 2021 C_Thun pretty much beat me to what I was thinking, but I can also go over how to make it only useable by your character. Assuming this is an equippable item (otherwise I'm not sure why it would be restricted) You can have the game check who is equipping the item, and if it's not the character you want, drop the item. You can add this function into your item's file, or add the contents of the function to an already existing OnEquip function. Just replace "kaji" with your character's name local function OnEquip(inst, owner) if owner.prefab ~= "kaji" and owner.components.inventory ~= nil then owner.components.inventory:DropItem(inst) end end Haven't tested this at all but it's similar to a character function I've used before, so I think it should work Link to comment Share on other sites More sharing options...
reims9875 Posted April 21, 2021 Author Share Posted April 21, 2021 Thank you so much Link to comment Share on other sites More sharing options...
reims9875 Posted April 23, 2021 Author Share Posted April 23, 2021 I didn't understand anything about crafting. How to do them. Can you explain the details of C_Thun please Link to comment Share on other sites More sharing options...
Goregonzola Posted April 24, 2021 Share Posted April 24, 2021 I've created a guidebook and tutorial collection about character modding. It features some extras as well - including custom items. Most of the extra chapters are just collected links to previous awesome tutorials. Check out the chapters you're interested in: Link to comment Share on other sites More sharing options...
reims9875 Posted April 24, 2021 Author Share Posted April 24, 2021 OK Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now