stasio30 Posted July 13, 2017 Share Posted July 13, 2017 Hello I am working on a character to DST but unfortunately I can't find a way to make him poop while eating local function OnEat(inst, food) if food.components.edible and food.components.edible.foodtype == "VEGGIE" then --poop local poo = SpawnPrefab("poop") poo.Transform:SetPosition(inst.Transform:GetClosestInstWithTag("player", inst, MyRadius)()) end end local function fn(Sim) inst:AddComponent("eater") inst.components.eater:SetOmnivore() -- all standard foodtypes besides wood, elemental and horrible --add horrible inst.components.eater.strongstomach = true -- can eat monster meat inst.components.eater:SetOnEatFn(OnEat) return inst end I tried to use part of the Pigman code but it does not work. I would be really grateful if someone would give me some help c: (Sorry for my bad english) Link to comment https://forums.kleientertainment.com/forums/topic/80567-help-with-mod/ Share on other sites More sharing options...
Lumina Posted July 13, 2017 Share Posted July 13, 2017 Try putting the inst:AddComponent("eater") inst.components.eater:SetOmnivore() -- all standard foodtypes besides wood, elemental and horrible --add horrible inst.components.eater.strongstomach = true -- can eat monster meat inst.components.eater:SetOnEatFn(OnEat) in the masterpostinit of your character, maybe ? Link to comment https://forums.kleientertainment.com/forums/topic/80567-help-with-mod/#findComment-939005 Share on other sites More sharing options...
. . . Posted July 13, 2017 Share Posted July 13, 2017 (edited) If you want your character to poop from eating veggies u can do something like this I think in his master_postinit in YOURCHARACTER.lua inst:ListenForEvent("oneat", function(inst, data) if data.food and data.food.components.edible and data.food.components.edible.foodtype == "VEGGIE" and inst.poop_cooldown == nil then inst.poop_cooldown = true inst:DoTaskInTime(480, function() inst.poop_cooldown = nil end) -- 480 = 1 DS day or u can put whatever amount of seconds u want local x, y, z = inst.Transform:GetWorldPosition() SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end end) Edited July 13, 2017 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/80567-help-with-mod/#findComment-939026 Share on other sites More sharing options...
stasio30 Posted July 13, 2017 Author Share Posted July 13, 2017 2 hours ago, Lumina said: Try putting the inst:AddComponent("eater") inst.components.eater:SetOmnivore() -- all standard foodtypes besides wood, elemental and horrible --add horrible inst.components.eater.strongstomach = true -- can eat monster meat inst.components.eater:SetOnEatFn(OnEat) in the masterpostinit of your character, maybe ? Seems to crash the game 47 minutes ago, SuperDavid said: If you want your character to poop from eating veggies u can do something like this I think in his master_postinit in YOURCHARACTER.lua inst:ListenForEvent("oneat", function(inst, data) if data.food and data.food.components.edible and data.food.components.edible.foodtype == "VEGGIE" and inst.poop_cooldown == nil then inst.poop_cooldown = true inst:DoTaskInTime(480, function() inst.poop_cooldown = nil end) -- 480 = 1 DS day or u can put whatever amount of seconds u want local x, y, z = inst.Transform:GetWorldPosition() SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end end) Seems to work just fine Thank you very much Link to comment https://forums.kleientertainment.com/forums/topic/80567-help-with-mod/#findComment-939035 Share on other sites More sharing options...
stasio30 Posted July 13, 2017 Author Share Posted July 13, 2017 If I could ask you about one more thing. It's a big one but I don't even know where to start. I would like to make a custom plant and custom seeds for it. Thank you in advance Link to comment https://forums.kleientertainment.com/forums/topic/80567-help-with-mod/#findComment-939046 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