Hiru315 Posted November 24, 2020 Share Posted November 24, 2020 Quote --In modmain.lua AddPrefabPostInit("hambat", function(inst) if GetPlayer().prefab == "hwasa" then inst:AddComponent("sanityaura") inst.components.sanityaura.aura = TUNING.SANITYAURA_MED inst:AddComponent("edible") inst.components.edible.foodtype = "MEAT" inst.components.edible.healthvalue = -10 inst.components.edible.hungervalue = 50 inst.components.edible.sanityvalue = 20 end end) I followed this tutorial to make Hambat edible for my character. It worked fine yesterday but somehow not today. The game keeps crashing with "attempt to index a nil value" Here's the client log: Quote [00:00:57]: [string "../mods/workshop-2270789417/modmain.lua"]:69: attempt to index a nil value LUA ERROR stack traceback: ../mods/workshop-2270789417/modmain.lua(69,1) =(tail call) ? =[C] in function 'xpcall' scripts/mods.lua(164,1) in function 'mod' scripts/mainfunctions.lua(267,1) =[C] in function 'SpawnPrefab' scripts/mainfunctions.lua(306,1) in function 'SpawnPrefab' scripts/mainfunctions.lua(323,1) in function 'SpawnSaveRecord' scripts/gamelogic.lua(557,1) in function 'PopulateWorld' scripts/gamelogic.lua(807,1) in function 'DoInitGame' scripts/gamelogic.lua(920,1) in function 'cb' ... =[C] in function 'GetPersistentString' scripts/saveindex.lua(282,1) in function 'Load' scripts/gamelogic.lua(1150,1) in function 'callback' scripts/playerprofile.lua(1151,1) in function 'Set' scripts/playerprofile.lua(1002,1) =[C] in function 'GetPersistentString' scripts/playerprofile.lua(1000,1) in function 'Load' scripts/gamelogic.lua(1149,1) in main chunk =[C] in function 'require' scripts/mainfunctions.lua(952,1) [00:00:57]: Reconstructing topology [00:00:57]: ...Sorting points [00:00:57]: ...Sorting edges [00:00:57]: ...Connecting nodes [00:00:57]: ...Validating connections [00:00:58]: ...Housekeeping [00:00:58]: ...Done! [00:00:58]: 1 uploads added to server. From server_temp [00:00:58]: Telling Client our new session identifier: 307ECD31C9379FB0 [00:00:58]: Check for write access: TRUE [00:00:58]: Check for read access: TRUE [00:00:58]: Available disk space for save files: I64u MB [00:00:58]: ModIndex: Load sequence finished successfully. [00:00:58]: Reset() returning [00:01:00]: Setting lobby region to default: US [00:01:00]: Registering master server in US lobby [00:01:01]: Warning: Widget:SetFocusFromChild is happening on a widget outside of the screen/widget hierachy. This will cause focus moves to fail. Is ScriptErrorWidget not a screen? [00:01:01]: stack traceback: scripts/widgets/widget.lua:605 in (method) SetFocusFromChild (Lua) <602-627> scripts/widgets/widget.lua:656 in (method) SetFocus (Lua) <629-665> scripts/widgets/scripterrorwidget.lua:107 in (method) OnUpdate (Lua) <102-119> scripts/update.lua:95 in () ? (Lua) <33-134> [00:01:10]: Warning: Widget:SetFocusFromChild is happening on a widget outside of the screen/widget hierachy. This will cause focus moves to fail. Is ScriptErrorWidget not a screen? [00:01:10]: stack traceback: scripts/widgets/widget.lua:605 in (method) SetFocusFromChild (Lua) <602-627> scripts/widgets/widget.lua:624 in (method) SetFocusFromChild (Lua) <602-627> scripts/widgets/widget.lua:624 in (method) SetFocusFromChild (Lua) <602-627> scripts/widgets/widget.lua:624 in (method) SetFocusFromChild (Lua) <602-627> scripts/widgets/widget.lua:656 in (method) SetFocus (Lua) <629-665> scripts/widgets/scripterrorwidget.lua:107 in (method) OnUpdate (Lua) <102-119> scripts/update.lua:95 in () ? (Lua) <33-134> [00:01:10]: Force aborting... [00:01:10]: Removing server from US lobby [00:01:10]: ModWorkshop::CancelDownloads clearing all unfinished downloads [00:01:11]: Collecting garbage... [00:01:11]: lua_gc took 0.19 seconds [00:01:11]: ~ShardLuaProxy() [00:01:11]: ~cEventLeaderboardProxy() [00:01:11]: ~ItemServerLuaProxy() [00:01:11]: ~InventoryLuaProxy() [00:01:11]: ~NetworkLuaProxy() [00:01:11]: ~SimLuaProxy() [00:01:11]: ModWorkshop::CancelDownloads clearing all unfinished downloads [00:01:11]: lua_close took 0.46 seconds [00:01:11]: ModWorkshop::CancelDownloads clearing all unfinished downloads [00:01:11]: [Steam] Auth ticket cancelled [00:01:11]: Could not unload undefined prefab (brokenwall_stone_2) [00:01:11]: Could not unload undefined prefab (brokenwall_ruins_2) [00:01:12]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:01:12]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:01:12]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:01:12]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:01:12]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:01:12]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:01:12]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:01:12]: CurlRequestManager::ClientThread::Main() complete [00:01:12]: HttpClient2 discarded 0 callbacks. [00:01:12]: Shutting down Link to comment Share on other sites More sharing options...
Thomas Die Posted November 24, 2020 Share Posted November 24, 2020 Pardon but what does GetPlayer() do Link to comment Share on other sites More sharing options...
penguin0616 Posted November 24, 2020 Share Posted November 24, 2020 (edited) You're using code for DS, which doesn't work in DST. There's a guide about converting from DS to DST somewhere, but I can't seem to find it. @thomas4846 In DS & DLCs, GetPlayer() would return ThePlayer. Edited November 24, 2020 by penguin0616 1 Link to comment Share on other sites More sharing options...
Hiru315 Posted November 25, 2020 Author Share Posted November 25, 2020 (edited) ohhh yeh i was reading the tutorial for DS ;;; Do anyone know what's the code in DST? edit: I found da wae. Thank yall. Edited November 25, 2020 by Hiru315 Link to comment Share on other sites More sharing options...
Hiru315 Posted November 29, 2020 Author Share Posted November 29, 2020 Oh right. I wonder if the code "player.components.talker:Say("")" is correct in dst. Since it doesn't appear in the game but only lines that from speech file. 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