Dudedude Posted January 18, 2015 Share Posted January 18, 2015 (edited) Thanks for taking the time to read this, stranger!My character has a tool.... I want to make it to where he can only use it, and if another character equips itm it unequips itself and the character says, "That's not mine, I can't use it!" or something. I KINDA know how it works, but I don't know how to translate that knowledge into code.I also want to make it when he eats a crock pot dish, he gains more sanity than a regular character.Thanks! Edited January 18, 2015 by Dudedude Link to comment https://forums.kleientertainment.com/forums/topic/49361-coding-help/ Share on other sites More sharing options...
przemolsz Posted January 18, 2015 Share Posted January 18, 2015 What does your tool do? Regarding crock pot foods:local function oneat(eater, food) eater.components.sanity:DoDelta(food.components.edible:GetSanity(self.inst))endand then, in "master_postinit(inst)":inst.components.eater.oneatfn = oneat Link to comment https://forums.kleientertainment.com/forums/topic/49361-coding-help/#findComment-603464 Share on other sites More sharing options...
Dudedude Posted January 18, 2015 Author Share Posted January 18, 2015 (edited) What does your tool do? Regarding crock pot foods:local function oneat(eater, food) eater.components.sanity:DoDelta(food.components.edible:GetSanity(self.inst))endand then, in "master_postinit(inst)":inst.components.eater.oneatfn = oneat My tool is basically a pick/axe, but a little better.Also, I fail to see how that's crock pot - specific. Could you clarify? Edited January 18, 2015 by Dudedude Link to comment https://forums.kleientertainment.com/forums/topic/49361-coding-help/#findComment-603467 Share on other sites More sharing options...
rezecib Posted January 18, 2015 Share Posted January 18, 2015 @Dudedude, This thread was discussing preventing equipping armor, but I think you could adapt the code to do what you want, too. Link to comment https://forums.kleientertainment.com/forums/topic/49361-coding-help/#findComment-603470 Share on other sites More sharing options...
Dudedude Posted January 18, 2015 Author Share Posted January 18, 2015 @Dudedude, This thread was discussing preventing equipping armor, but I think you could adapt the code to do what you want, too. Thanks for linking me to the thread. I understand everything, but how do I make it unequip a specific item, not all in general? Link to comment https://forums.kleientertainment.com/forums/topic/49361-coding-help/#findComment-603478 Share on other sites More sharing options...
rezecib Posted January 18, 2015 Share Posted January 18, 2015 @Dudedude, if item.prefab == "myitem" then --use the unequip code from the other threadend Link to comment https://forums.kleientertainment.com/forums/topic/49361-coding-help/#findComment-603481 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