fmo080308 Posted November 29, 2016 Share Posted November 29, 2016 Anyone know how to make a prefab digable? Tag or component or anything else needed? Link to comment Share on other sites More sharing options...
Lumina Posted November 30, 2016 Share Posted November 30, 2016 inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.DIG) inst.components.workable:SetOnFinishCallback(dig_up) inst.components.workable:SetWorkLeft(1) You need to create the related "dig_up" function. Look at berry_bush prefab or grass prefab for example. Another example, stump for tree inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.DIG) inst.components.workable:SetOnFinishCallback(dig_up_stump) inst.components.workable:SetWorkLeft(1) Related function local function dig_up_stump(inst, chopper) inst.components.lootdropper:SpawnLootPrefab("log") inst:Remove() end Don't forget to add the drop to the prefab list of the item if it's a custom prefab. For example, if you want your "sandpile" to drop "sand", sand must be in local prefabs = { "twigs", "rocks", "sand", } Link to comment Share on other sites More sharing options...
fmo080308 Posted November 30, 2016 Author Share Posted November 30, 2016 1 hour ago, Lumina said: inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.DIG) inst.components.workable:SetOnFinishCallback(dig_up) inst.components.workable:SetWorkLeft(1) You need to create the related "dig_up" function. Look at berry_bush prefab or grass prefab for example. Another example, stump for tree inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.DIG) inst.components.workable:SetOnFinishCallback(dig_up_stump) inst.components.workable:SetWorkLeft(1) Related function local function dig_up_stump(inst, chopper) inst.components.lootdropper:SpawnLootPrefab("log") inst:Remove() end Don't forget to add the drop to the prefab list of the item if it's a custom prefab. For example, if you want your "sandpile" to drop "sand", sand must be in local prefabs = { "twigs", "rocks", "sand", } Thanks alot, i don't know why i didn't notice these line....swear to god i have checked berrybush/grass/twig prefab many times..... Link to comment Share on other sites More sharing options...
Lumina Posted November 30, 2016 Share Posted November 30, 2016 Because these prefab are now very complex between withering, disease, and others stuffs, so it's easy to be lost ^^ 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