beforeidecay96 Posted March 4, 2016 Share Posted March 4, 2016 (edited) I'm trying to get my follower to act as a container the same way chester does. I got it to work when I play on a server alone, but I'm getting this error when I try to play with my sister and one of us tries to click on the follower to open the container: Quote [00:02:21]: [string "scripts/widgets/containerwidget.lua"]:29: attempt to index local 'widget' (a nil value) LUA ERROR stack traceback: scripts/widgets/containerwidget.lua:29 in (method) old_container_open (Lua) <24-132> ../mods/workshop-365119238/modmain_segments/containerwidgetfunction.lua:21 in (method) Open (Lua) <20-60> scripts/screens/playerhud.lua:191 in (upvalue) OpenContainerWidget (Lua) <188-193> scripts/screens/playerhud.lua:201 in (method) OpenContainer (Lua) <195-203> scripts/components/container_replica.lua:204 in (method) Open (Lua) <190-211> scripts/components/container_replica.lua:58 in (field) fn (Lua) <56-59> scripts/scheduler.lua:194 in (method) OnTick (Lua) <168-225> scripts/scheduler.lua:406 in (global) RunScheduler (Lua) <404-412> scripts/update.lua:166 in () ? (Lua) <150-223> [00:02:33]: Force aborting... Can anyone help me with this error? EDIT: It seems to only crash when someone other than the host tries to open a followers container menu. Edited April 27, 2016 by beforeidecay96 Link to comment https://forums.kleientertainment.com/forums/topic/65092-need-help-fixing-a-crash-related-to-follower-thats-able-to-hold-stuff/ Share on other sites More sharing options...
beforeidecay96 Posted March 5, 2016 Author Share Posted March 5, 2016 (edited) Can someone please help me? This error is really frustrating me. (。•́︿•̀。) Edited March 5, 2016 by beforeidecay96 Link to comment https://forums.kleientertainment.com/forums/topic/65092-need-help-fixing-a-crash-related-to-follower-thats-able-to-hold-stuff/#findComment-730163 Share on other sites More sharing options...
Aquaterion Posted March 5, 2016 Share Posted March 5, 2016 I remember having this problem with my chest mod, and this is what I was told to do, I guess you can try it.. : local containers = GLOBAL.require("containers") local oldwidgetsetup = containers.widgetsetup containers.widgetsetup = function(container, prefab, data) prefab = "PUTCONTAINERNAMEHERE" --replace with ur container prefab name oldwidgetsetup(container, prefab, data) end Link to comment https://forums.kleientertainment.com/forums/topic/65092-need-help-fixing-a-crash-related-to-follower-thats-able-to-hold-stuff/#findComment-730168 Share on other sites More sharing options...
beforeidecay96 Posted March 5, 2016 Author Share Posted March 5, 2016 8 minutes ago, Aquaterion said: I remember having this problem with my chest mod, and this is what I was told to do, I guess you can try it.. : local containers = GLOBAL.require("containers") local oldwidgetsetup = containers.widgetsetup containers.widgetsetup = function(container, prefab, data) prefab = "PUTCONTAINERNAMEHERE" --replace with ur container prefab name oldwidgetsetup(container, prefab, data) end Where am I supposed to put it at? Modmain? Link to comment https://forums.kleientertainment.com/forums/topic/65092-need-help-fixing-a-crash-related-to-follower-thats-able-to-hold-stuff/#findComment-730172 Share on other sites More sharing options...
Aquaterion Posted March 5, 2016 Share Posted March 5, 2016 Just now, beforeidecay96 said: Where am I supposed to put it at? Modmain? yea sorry forgot that part Link to comment https://forums.kleientertainment.com/forums/topic/65092-need-help-fixing-a-crash-related-to-follower-thats-able-to-hold-stuff/#findComment-730174 Share on other sites More sharing options...
zUsername Posted March 5, 2016 Share Posted March 5, 2016 (edited) 3 minutes ago, Aquaterion said: yea sorry forgot that part Your code will broke some container else like cookpot. Put this code to your prefab file in local function fn(Sim) if not TheWorld.ismastersim then inst.OnEntityReplicated = function(inst) inst.replica.container:WidgetSetup("chester") end return inst end Or you can use this in modmain: local containers = GLOBAL.require("containers") local oldwidgetsetup = containers.widgetsetup containers.widgetsetup = function(container, prefab) if not prefab and container.inst.prefab == "yourcontainername" then prefab = "chester" end oldwidgetsetup(container, prefab) end Edited March 5, 2016 by zUsername Link to comment https://forums.kleientertainment.com/forums/topic/65092-need-help-fixing-a-crash-related-to-follower-thats-able-to-hold-stuff/#findComment-730176 Share on other sites More sharing options...
beforeidecay96 Posted March 5, 2016 Author Share Posted March 5, 2016 18 minutes ago, Aquaterion said: yea sorry forgot that part It worked! Thank you so much for your help! And thanks to zUsername as well! I really appreciate you both taking the time to help me~ ^w^ Link to comment https://forums.kleientertainment.com/forums/topic/65092-need-help-fixing-a-crash-related-to-follower-thats-able-to-hold-stuff/#findComment-730185 Share on other sites More sharing options...
beforeidecay96 Posted April 27, 2016 Author Share Posted April 27, 2016 (edited) Alright, I thought it fixed the crock pot container issue, but it really didn't. The crock pot still acts like a chest. I tried using both of zUsername's codes they gave me, but it still doesn't work. Maybe I'm just putting them in wrong... Can anyone help me? Edited April 27, 2016 by beforeidecay96 Link to comment https://forums.kleientertainment.com/forums/topic/65092-need-help-fixing-a-crash-related-to-follower-thats-able-to-hold-stuff/#findComment-758519 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