FruityKinqz Posted January 23, 2015 Share Posted January 23, 2015 Is there any way I can make my custom Item craft-able by JUST my custom character? Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/ Share on other sites More sharing options...
FruityKinqz Posted January 23, 2015 Author Share Posted January 23, 2015 (edited) The Books prefab has this code: inst:AddComponent("characterspecific")inst.components.characterspecific:SetOwner("wickerbottom") Is there anyway I could use this somehow? Any help would be much appreciated. Edited January 23, 2015 by FruityKinqz Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605206 Share on other sites More sharing options...
SenL Posted January 23, 2015 Share Posted January 23, 2015 I think so, just change it to your character's name.I haven't tried it but it should work. Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605237 Share on other sites More sharing options...
rezecib Posted January 23, 2015 Share Posted January 23, 2015 @FruityKinqz, This method will not work. The character specific component has more to do with whether it lets you keep the item when you leave. The books tab is actually hard coded in crafttabs.lua to check for the "bookbuilder" tag, but adding your own tab that works like that is quite an ordeal. As for adding some items to existing tabs, currently this is something that's a bit tricky to do, but basically what you do is just hide the recipe from characters who aren't supposed to make this. The way I did this for Wigfrid and Webber was the following:if not GLOBAL.TheNet:IsDedicated() then local OldIsRecipeValid = GLOBAL.IsRecipeValid local function IsRecipeValid(recipe) return OldIsRecipeValid(recipe) and ((GLOBAL.ThePlayer and GLOBAL.ThePlayer:HasTag(recipe.name.."_builder")) or not recipe.tagneeded) end GLOBAL.IsRecipeValid = IsRecipeValidendlocal recipes = { Recipe("spidereggsack", {Ingredient("silk", 12), Ingredient("spidergland", 6), Ingredient("papyrus", 6)}, RECIPETABS.TOWN, TECH.NONE), Recipe("wathgrithrhat", {Ingredient("goldnugget", 2), Ingredient("rocks", 2)}, RECIPETABS.WAR, {SCIENCE = 0, MAGIC = 0, ANCIENT = 0}, nil, nil, nil, nil, true), Recipe("spear_wathgrithr", {Ingredient("twigs", 2), Ingredient("flint", 2), Ingredient("goldnugget", 2)}, RECIPETABS.WAR, {SCIENCE = 0, MAGIC = 0, ANCIENT = 0}, nil, nil, nil, nil, true),}for k,v in pairs(recipes) do v.tagneeded = trueendThen in the character's prefabs you add a tag for each recipe that only they can craft: inst:AddTag("spidereggsack_builder") Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605243 Share on other sites More sharing options...
FruityKinqz Posted January 24, 2015 Author Share Posted January 24, 2015 @rezecib thank you so where do I put the first bit of code?And just to clarify I just copy it over and replace "ThePlayer", "_builder" and recipes with my own. I don't really know much about modding only started like a week ago. Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605606 Share on other sites More sharing options...
rezecib Posted January 24, 2015 Share Posted January 24, 2015 where do I put the first bit of code In your modmain. And do not change "ThePlayer", it's a constant that refers to the local player object. The only stuff you should need to change is the recipes, and then the tag that you add to the prefab. For example, let's say your recipe is for the "shotgun" prefab, in your character's common_postinit you'd add inst:AddTag("shotgun_builder"). Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605633 Share on other sites More sharing options...
FruityKinqz Posted January 24, 2015 Author Share Posted January 24, 2015 Ahh I'll try when I get back home, thanks a lot! Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605638 Share on other sites More sharing options...
FruityKinqz Posted January 25, 2015 Author Share Posted January 25, 2015 Okayy so I added It but it does not show up at all now :/ I think it because I removed the line: crown_recipe.atlas = "images/inventoryimages/Crown.xml" Doesn't work when I leave it in if I leave It like above it says attempt to index global "crown_recipe" (a nil value)and if i put it as:Local crown_recipe.atlas = "images/inventoryimages/Crown.xml" It says unexpected symbol near "." Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605928 Share on other sites More sharing options...
rezecib Posted January 25, 2015 Share Posted January 25, 2015 (edited) @FruityKinqz, look at the game's constructor for recipes (recipe.lua), there's already an argument you can use for the atlas. Derp, was thinking of Ingredient Edited January 26, 2015 by rezecib Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605958 Share on other sites More sharing options...
FruityKinqz Posted January 26, 2015 Author Share Posted January 26, 2015 I tried but I'm not sure what I'm looking for I added Ingredient = Class(function(atlas) self.atlas = (resolvefilepath("images/crown.xml"))end) to my modmain but not sure what I'm achieving with this :/ Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605986 Share on other sites More sharing options...
rezecib Posted January 26, 2015 Share Posted January 26, 2015 @FruityKinqz, No, not that. But actually double-checking it, looks like I was wrong. The atlas argument is just for the ingredients. But show me how you're declaring your recipes and I can show you how to get it to change the atlas. Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605992 Share on other sites More sharing options...
FruityKinqz Posted January 26, 2015 Author Share Posted January 26, 2015 Just how you've said above (first post) I got rid of: local crown_recipe = GLOBAL.Recipe("crown",{ Ingredient("flint", 1) }, RECIPETABS.DRESS, TECH.NONE ) crown_recipe.atlas = "images/inventoryimages/Crown.xml" when I put the code in Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-605996 Share on other sites More sharing options...
rezecib Posted January 26, 2015 Share Posted January 26, 2015 @FruityKinqz, Well, I wanted your actual code, but hopefully I can explain how to do it. In my example, recipes[1] is the spidereggsack recipe, recipes[2] is the wrathgrithrhat recipe, and recipes[3] is the wrathgrithr_spear recipe. So if yours was the first entry in your recipe table, you can do recipes[1].atlas = "images/inventoryimages/Crown.xml" Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-606027 Share on other sites More sharing options...
FruityKinqz Posted January 26, 2015 Author Share Posted January 26, 2015 Thank you! It's working perfectly now Link to comment https://forums.kleientertainment.com/forums/topic/49620-making-item-craft-able-by-single-character/#findComment-606031 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