Enderia Posted January 28, 2022 Share Posted January 28, 2022 Being honest - I have no idea how oneat works and it been a while since I tried to play around with modding, I tried to base on another mods but I keep getting errors and I really could use some help here Daycare Attendant.rar client_log.txt Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/ Share on other sites More sharing options...
-LukaS- Posted January 28, 2022 Share Posted January 28, 2022 From what I can see you haven't declared the 'oneat' function anywhere so you're passing a nil value into 'inst.components.eater:SetOnEatFn()'. Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/#findComment-1536234 Share on other sites More sharing options...
Enderia Posted January 29, 2022 Author Share Posted January 29, 2022 17 hours ago, -t- said: From what I can see you haven't declared the 'oneat' function anywhere so you're passing a nil value into 'inst.components.eater:SetOnEatFn()'. Could you please explain more? I'm not sure what I'm supposed to do here Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/#findComment-1536442 Share on other sites More sharing options...
-LukaS- Posted January 29, 2022 Share Posted January 29, 2022 What exactly are you trying to achieve? Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/#findComment-1536444 Share on other sites More sharing options...
Enderia Posted January 29, 2022 Author Share Posted January 29, 2022 7 minutes ago, -t- said: What exactly are you trying to achieve? I tried to allow DA to use/eat trinkets specified at the bottom of modmain, so they can use it to gain 70 sanity back Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/#findComment-1536445 Share on other sites More sharing options...
-LukaS- Posted January 29, 2022 Share Posted January 29, 2022 I see. To do that you'll have to add FOODTYPE.SCRAP to your characters diet. if inst.components.eater ~= nil then inst.components.eater:SetDiet({ FOODGROUP.OMNI, FOODTYPE.SCRAP }) end Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/#findComment-1536450 Share on other sites More sharing options...
Enderia Posted January 31, 2022 Author Share Posted January 31, 2022 On 1/29/2022 at 5:05 PM, -t- said: I see. To do that you'll have to add FOODTYPE.SCRAP to your characters diet. if inst.components.eater ~= nil then inst.components.eater:SetDiet({ FOODGROUP.OMNI, FOODTYPE.SCRAP }) end Hey, sorry for late reply, life happened I tried to put it in, but couldn't get it to work at all, I keep getting error about OnEat not being declared. Mod only went through loading/character selection when I deleted this if inst.components.eater ~= nil then --Let em eat scrap --inst.components.eater.ignoresspoilage = true --inst.components.eater:SetCanEatGears() inst.components.eater:SetOnEatFn(oneat) end But it rendered DA unable to consume the item client_log.txt Daycare Attendant.rar Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/#findComment-1536783 Share on other sites More sharing options...
-LukaS- Posted January 31, 2022 Share Posted January 31, 2022 Try replacing attendant.lua with this: attendant.lua Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/#findComment-1536811 Share on other sites More sharing options...
Enderia Posted January 31, 2022 Author Share Posted January 31, 2022 1 hour ago, -t- said: Try replacing attendant.lua with this: attendant.lua 5.33 kB · 0 downloads Changing lua allowed me to join the server, but rendered DA unable to eat the trinket_16 and when I tried to spawn antliontrinket game crashed client_log.txt Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/#findComment-1536820 Share on other sites More sharing options...
-LukaS- Posted January 31, 2022 Share Posted January 31, 2022 Ah, I see where's the problem. In modmain.lua you have: AddPrefabPostInit("antliontrinket", "trinket_16", "trinket_31", "trinket_29", "trinket_22", "trinket_14", "trinket_24", "trinket_18", "trinket_19", "trinket_15", "trinket_30", "trinket_28", "trinket_7", "trinket_2", "trinket_11", "trinket_1", "trinket_5", ModTrinkets) AddPrefabPostInit can change only 1 prefab at a time. That's why "antliontrinket" causes a crash an why the rest of them are not edible. To edit all those trinkets you should iterate through a table with all of them: local trinkets_table = { "antliontrinket", "trinket_16", "trinket_31", "trinket_29", "trinket_22", "trinket_14", "trinket_24", "trinket_18", "trinket_19", "trinket_15", "trinket_30", "trinket_28", "trinket_7", "trinket_2", "trinket_11", "trinket_1", "trinket_5" } for i, trinket in ipairs(trinkets_table) do AddPrefabPostInit(trinket, ModTrinkets) end 1 Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/#findComment-1536821 Share on other sites More sharing options...
Enderia Posted January 31, 2022 Author Share Posted January 31, 2022 4 minutes ago, -t- said: Ah, I see where's the problem. In modmain.lua you have: AddPrefabPostInit("antliontrinket", "trinket_16", "trinket_31", "trinket_29", "trinket_22", "trinket_14", "trinket_24", "trinket_18", "trinket_19", "trinket_15", "trinket_30", "trinket_28", "trinket_7", "trinket_2", "trinket_11", "trinket_1", "trinket_5", ModTrinkets) AddPrefabPostInit can change only 1 prefab at a time. That's why "antliontrinket" causes a crash an why the rest of them are not edible. To edit all those trinkets you should iterate through a table with all of them: local trinkets_table = { "antliontrinket", "trinket_16", "trinket_31", "trinket_29", "trinket_22", "trinket_14", "trinket_24", "trinket_18", "trinket_19", "trinket_15", "trinket_30", "trinket_28", "trinket_7", "trinket_2", "trinket_11", "trinket_1", "trinket_5" } for i, trinket in ipairs(trinkets_table) do AddPrefabPostInit(trinket, ModTrinkets) end Worked like a charm! So I thought it was this piece of code failing me, thanks for help, saved me from this hole here Link to comment https://forums.kleientertainment.com/forums/topic/137188-problem-with-oneat/#findComment-1536822 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