Jump to content

Making some items uncraftable by a certain character


Recommended Posts

Hi, I was trying to figure out a way to set it so my custom character is unable to craft anything that uses living animals in the recipe. Any help would be much apreciated. I would assume there's something I can do with the builder component but I don't really know.

Edited by Yumesuki
Link to comment
Share on other sites

So, inside your character's prefab:

local forbidden = {    minerhat = true,    pumpkin_lantern = true,    beebox = true,    beemine = true,    researchlab4 = true,    rainhat = true,    earmuffshat = true,}local function common_postinit(inst)    inst:DoTaskInTime(0, function()        local old = inst.replica.builder.CanLearn        function inst.replica.builder:CanLearn(recname)            if forbidden[recname] then                return false            else                return old(self, recname)            end        end    end)end
Edited by DarkXero
Link to comment
Share on other sites

Thanks much, worked perfectly. Is there something similar to CanLearn I can use to make the same items unable to be used if someone hands them to the character or they're picked up? Or would I need to do something that would check for certain items in the inventory and make the character drop them?

Edited by Yumesuki
Link to comment
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
 Share

×
  • Create New...