Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Yagenius

[HELP] attempt to index field 'inventory' (a nil value) : CAVE ISSUES

Recommended Posts

Yagenius    1

Hello It's me again ; U ; l l  !!

 

Now I get a new issues ... # Am I a Trouble maker?! X'''D

I try to fix this Bugs with Cave On . 

 

it's always said this error When I try to Transforms << Press Z >> :  

=================================================================

[string "scripts/components/playercontroller.lua"]:1858: attempt to index field 'inventory' (a nil value)

LUA ERROR stack traceback:

    scripts/components/playercontroller.lua:1858 in (method) OnUpdate (Lua) <1683-2057>
    scripts/update.lua:192 in () ? (Lua) <149-228>

-------------------------------------------- OR ---------------------------------------------------

[string "scripts/components/playercontroller.lua"]:1052: attempt to index field 'inventory' (a nil value)
LUA ERROR stack traceback:
    scripts/components/playercontroller.lua:1052 in (method) HasAOETargeting (Lua) <1051-1057>
    scripts/components/playeractionpicker.lua:293 in (method) DoGetMouseActions (Lua) <284-326>
    scripts/components/playercontroller.lua:1803 in (method) OnUpdate (Lua) <1683-2057>
    scripts/update.lua:192 in () ? (Lua) <149-228>

==================================================================

FAWFA.thumb.jpg.ec65fe9ab5eed6abbbba8465464583a1.jpg

 

Here is the Full error log : client_log.txt

And here is my Script Use for this mod : modmain.lua  aikawa.lua

Could you Help me please ? ; u ; 

Sorry for my brain i'm just a dumber ,,, 

Thank you very much !

Share this post


Link to post
Share on other sites
Yagenius    1

 

Hello , I have Try to add this code to fix my issues  :

 

1:    inst:AddComponent("inventory") 
-------------------------------------------------------------------
2:    if inst.components.inventory ~= nil then
    inst.components.inventory:DropEverything()
    end

 

1. I Try to adding to the master_postinit and it's doesn't work.

 

2. I Try to adding to the common_postinit and it's doesn't work.

 

3. I Try to adding to the master_postinit and common_postinit and it's doesn't work.

 

4. I Try to adding it to the Onbecametiger(inst) but it's get the same error.

         [ 1-4 I Try to adding 1: only and it's doesn't work.]

         [ 1-4 I Try to adding 2: only and it's doesn't work.]

 

 

5. I try to Remove all of the " inventory " mentions and.... it's get the same error.

string "scripts/widgets/inventorybar.lua":157: attempt to index local 'inventory' (a nil value)

 

 

Or there have another ways to fix this error ? BUT IDK How to fix it.

 Please Anyone has any tips?  

, ,

Share this post


Link to post
Share on other sites

I am getting the second error consistently.

It happens when I try to walk around in a world with caves.

It does not matter if it is a new world or not.

My character is like wx-78 so eating means upgrades and previous versions of my mod worked.
I am going to try it with removing an OnEnterDark function and see what happens.

If you found out the problem (this is an old post) let me know please!

 

UPDATE:
It was my OnEnterDark function.
 

This is what the function did 

--local function OnEnterDark(inst)
	--if inst.LightWatcher:GetLightValue() <= 1 then
		--inst.components.sanity.current = 0
		--inst.components.hunger.current = inst.components.hunger.current / 2
	--end
--end

 

And in the master_postinit

--inst:ListenForEvent("enterdark", OnEnterDark)

 

Anyone know what the problem with this function on cave worlds?

Share this post


Link to post
Share on other sites