Jump to content

attempt to index field " " , "inventory" (a nil value)


Recommended Posts

HELLO!!!! It's me again!! 

 

And I got a new errors Again ... X''D

 

:: NO CAVE / Multiplayer / As Host ::

Spoiler

 

When I'm as a Host and my friends get this error :

( Those errors... It happened when his/her move the cursor on my character.  )

Spoiler


[string "scripts/componentactions.lua"]:1182: attempt to index a nil value
LUA ERROR stack traceback:
    scripts/componentactions.lua:1182 in (method) CollectActions (Lua) <1168-1194>
    scripts/components/playeractionpicker.lua:97 in (method) GetSceneActions (Lua) <94-119>
    scripts/components/playeractionpicker.lua:215 in (method) GetLeftClickActions (Lua) <176-234>
    scripts/components/playeractionpicker.lua:322 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>

 

   here is my full error log :  client_log.txt 

 

 

 

 

:: WITH CAVE / Single player / Offline  ::

Spoiler

 

And here is another error appeared when my Char Transforms into Kittyz with The cave is enable.

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

Spoiler


[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 this ...

Spoiler


[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>

 

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

here is their full error log : client_log CAVE.txt

HERE IS  FULL FILE  :  AIKA - Copy.zip

 

If it not too hard , Could anyone help me understand those error please? ; w ;

Edited by Yagenius
Forgot to put ZIP file.
Link to comment
Share on other sites

Whenever you start one of these threads, you need to provide the full context. Which mod is giving the problem, and if it's a new mod you're making, what kind of mod it is (character, worldgen, stat tweaker etc.) and preferably your mod in a zip file, along with the log files with the errors in them.

Also, this thread looks almost identical to the other one you posted, except this one has the client log at the end. You should NOT post duplicate threads.

Link to comment
Share on other sites

Hard to tell with the little information like ultroman said but based on that information my guess would be you have a server only component being ran on the client.  Prob need 

if GLOBAL.TheWorld.ismastersim then

 somewhere.

Link to comment
Share on other sites

@Wolf_EX

On 12/3/2018 at 7:16 AM, Wolf_EX said:

if GLOBAL.TheWorld.ismastersim then

I thinks I already put it in my function : ( around 4 - 5 function. ) 

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

 

:: master_postinit ::

Spoiler

local function master_postinit(inst)

	inst.level = 0
	Catzisgrow(inst)


		-- Stats
	local Light = inst.entity:AddLight()
    inst.Light:Enable(false)
    inst.Light:SetRadius(50)
    inst.Light:SetFalloff(.75)
    inst.Light:SetIntensity(.75)
    inst.Light:SetColour(205/255,0/255,0/255)
	
	
	inst.entity:SetPristine()
	
	if not TheWorld.ismastersim then
	return inst		
	
	end
	
	inst:AddComponent("sanityaura")
	inst.components.sanityaura.aura = 8.3-- 8.3
	
	inst:AddComponent("heater")	
	inst:AddComponent("lootdropper")
	inst:AddComponent("damagereflect")
	
	inst.components.damagereflect:SetReflectDamageFn(CalcReflect)
	--------------------------------------------------------------
 
	inst.components.heater.heat = 100
	
	inst.components.health:StartRegen(2, 2.5)
	inst.components.combat:SetDefaultDamage(2)
	
	inst.components.hunger.hungerrate = 0.8 * TUNING.WILSON_HUNGER_RATE
	
    inst.components.sanity.rate_modifier = 1
	inst.components.sanity.night_drain_mult = 1.2
	inst.components.sanity.neg_aura_mult = 0
	inst.components.temperature.maxtemp = 50
	inst.components.temperature.mintemp = 20
	inst.components.combat.damagemultiplier = 2
	inst.components.health.fire_damage_scale = 1
	--inst.components.sanity.dapperness = 1
	
	SetStandState(inst, "quad")--SetStandState(inst, "BI")
    inst.SetStandState = SetStandState
    inst.IsStandState = IsStandState
	inst.num_good_food_eaten = 0
    inst.num_food_cherrypicked = 0

	
	-- Custom Sound
	inst.soundsname = "willow"	
	
	inst._getstatus = nil
	inst.TransformTiger = TransformTiger


	
	-- WERETIGER --

        inst:AddComponent("tigerness")
        inst.components.tigerness.makeperson = onbecameaikawa
        inst.components.tigerness.maketiger = onbecametiger
	
	
	onbecameaikawa(inst)
	
    inst.components.eater:SetOnEatFn(onaikawaeat)
	
	
	inst:WatchWorldState("moonphase", OnIsFullmoon)
	OnIsFullmoon(inst, TheWorld.state.moonphase)
	
	-- WERETIGER END --

    inst.OnLoad = onload
    inst.OnPreLoad = onpreload
	inst.OnNewSpawn = onload
	inst.OnSave = onsave
	
	return inst
	
end

 

 

:: common_postinit ::

Spoiler

local function common_postinit(inst)

	inst:AddTag("woodcutter")
	inst:AddTag("birdwhisperer")
	inst:RemoveTag("scarytoprey")
	inst:AddTag("tiger")
	
	inst:AddComponent("keyhandler")
    --inst.components.keyhandler:AddActionListener("aikawa", TUNING.AIKAWA.KEY , "TIGER")
	inst.components.keyhandler:AddActionListener("aikawa", TUNING.AIKAWA.KEY2 , "POUND")
	inst.components.keyhandler:AddActionListener("aikawa", TUNING.AIKAWA.KEY3 , "SLEEP")
	inst.components.keyhandler:AddActionListener("aikawa", TUNING.AIKAWA.KEY5 , "WAKE")
	inst.components.keyhandler:AddActionListener("aikawa", TUNING.AIKAWA.KEY6 , "TARGETSTOLEN")	
	inst.components.keyhandler:AddActionListener("aikawa", TUNING.AIKAWA.KEY7 , "ATTACK")	
	inst.components.keyhandler:AddActionListener("aikawa", TUNING.AIKAWA.KEY8 , "POUNCEATTACK")
	
 
    inst:AddTag("tigerness")
	
	inst.GetTigerness = GetTigerness 
	
	inst.istigermode = net_bool(inst.GUID, "aikawa.istigermode", "istigermodedirty")
    inst:ListenForEvent("playeractivated", OnPlayerActivated)
    inst:ListenForEvent("playerdeactivated", OnPlayerDeactivated)
	
		inst.entity:SetPristine()
		
	    if not TheWorld.ismastersim then
        inst.OnEntityReplicated = onentityreplicated
    end
end

 

 

:: SetTigerMode ::

Spoiler

local function SetTigerMode(inst, istiger)
    if istiger then

        inst.HUD.controls.status:Show(true)
        if inst.HUD.TigerOL ~= nil then
            inst.HUD.TigerOL:Show()
        end

        if not TheWorld.ismastersim then
            inst.CanExamine = CannotExamine
            SetTigerActions(inst, true)

            if inst.components.locomotor ~= nil then
                inst.components.locomotor.runspeed = 6
            end
        end
    else

        inst.HUD.controls.status:Show(false)
        if inst.HUD.TigerOL ~= nil then
            inst.HUD.TigerOL:Hide()
        end

        if not TheWorld.ismastersim then
            inst.CanExamine = inst.istigermode:value() and CannotExamine or nil
            SetTigerActions(inst, false)
			 
            if inst.components.locomotor ~= nil then
                inst.components.locomotor.runspeed = 14
            end
        end
    end
end

 

 

:: OnPlayerDeactivated ::

Spoiler

local function OnPlayerDeactivated(inst)
    inst:RemoveEventCallback("onremove", OnPlayerDeactivated)
    if not TheWorld.ismastersim then
        inst:RemoveEventCallback("istigermodedirty", OnTigerModeDirty)
    end
    TheFocalPoint.SoundEmitter:KillSound("beavermusic")
end

 

 

:: OnPlayerActivated ::

Spoiler

local function OnPlayerActivated(inst)
    if inst.HUD.tigerOL == nil then
        inst.HUD.tigerOL = inst.HUD.overlayroot:AddChild(Image("images/filter/aikawa.xml", "tiger_vision_cc.tex"))
        inst.HUD.tigerOL:SetVRegPoint(ANCHOR_MIDDLE)
        inst.HUD.tigerOL:SetHRegPoint(ANCHOR_MIDDLE)
        inst.HUD.tigerOL:SetVAnchor(ANCHOR_MIDDLE)
        inst.HUD.tigerOL:SetHAnchor(ANCHOR_MIDDLE)
        inst.HUD.tigerOL:SetScaleMode(SCALEMODE_FILLSCREEN)
        inst.HUD.tigerOL:SetClickable(false)
    end
    inst:ListenForEvent("onremove", OnPlayerDeactivated)
    if not TheWorld.ismastersim then
        inst:ListenForEvent("istigermodedirty", OnTigerModeDirty)
    end
    OnTigerModeDirty(inst)
end

 

 

:: onbecametiger ::

Spoiler

local function onbecametiger(inst)

    inst.tiger = true
	
	inst.entity:AddDynamicShadow()
	inst.DynamicShadow:SetSize(12, 6.5)
	
    inst.Transform:SetScale(2, 2, 2, 2)
	
	    if not TheWorld.ismastersim then
        return inst
    end

    inst.components.eater:SetDiet(TIGER_DIET) 
	
	inst.components.talker:IgnoreAll("becametiger")	

	inst:AddComponent("groundpounder")
	
 if inst.components.groundpounder ~= nil then
    inst.components.groundpounder.destroyer = true
	inst.components.groundpounder.groundpoundfx = "firesplash_fx"
    inst.components.groundpounder.damageRings = 7
    inst.components.groundpounder.destructionRings = 7
    inst.components.groundpounder.numRings = 7
	end


-----------------------------------------------------------------------------------------
    inst:AddComponent("sleeper")
    inst.components.sleeper.sleeptestfn = NocturnalSleepTest
    inst.components.sleeper.waketestfn = NocturnalWakeTest	
	
-------------------------------------------------------------------------------------
   inst.components.sleeper:SetNocturnal(true)
	
-------------------------------------------------------------------------------------	
    inst:AddTag("IAMTIGER")
	inst:AddTag("tiger")
	inst:AddTag("cavedweller")
	inst:RemoveTag("IAMAIKAWA")
	
	inst:AddComponent("timer")
	inst:AddComponent("explosiveresist")

    inst.AnimState:SetBuild("weretiger_build")
    inst.AnimState:SetBank("WERETIGER")
	inst:SetStateGraph("SGweretiger")
-------------------------------------------	
	
	inst.components.locomotor.walkspeed = 5
	inst.components.locomotor.runspeed = 6
	
    inst.components.sanity.night_drain_mult = 6
	inst.components.sanity.neg_aura_mult = 5
	
	inst.components.temperature.maxtemp = 50
	inst.components.temperature.mintemp = 20
	
	--inst.components.health.fire_damage_scale = 0
	inst.components.health:SetAbsorptionAmount(1000)
	
	inst.components.eater.eatwholestack = true
	
	inst.components.health:StartRegen(100 , 2.5)
	
	inst.components.combat:SetDefaultDamage(5000*5) -- 20
	inst.components.combat:SetAreaDamage(10, 10)
   	
	inst.components.sanity.custom_rate_fn = tigersanityfn
	
    if inst.components.playercontroller ~= nil then
        inst.components.playercontroller:SetCanUseMap(false)
    end
	
	inst.components.inventory:DropEverything()
	
	inst.components.sanity:SetPercent(1)
    inst.components.health:SetPercent(1)
    inst.components.hunger:SetPercent(1)

    inst.components.pinnable.canbepinned = false
    inst.components.hunger:Pause()
	
    inst.components.sanity.ignore = true
    inst.components.health.redirect = tigerhurt
    inst.components.health.redirect_percent = 5
	
	if inst.components.inspectable.getstatus ~= TigerGetStatus then
        inst._getstatus = inst.components.inspectable.getstatus
        inst.components.inspectable.getstatus = TigerGetStatus
    end

    inst.CanExamine = CannotExamine

    inst.components.eater.strongstomach = true
    inst.components.eater.monsterimmune = true   
	
	SetAikawaWorker(inst, false)
	SetTigerWorker(inst, true)
    SetTigerActions(inst, true)
	 
	
	if not inst.istigermode:value() then
        inst:AddTag("IAMTIGER")
        inst.Network:AddUserFlag(USERFLAGS.CHARACTER_STATE_1)
        inst.istigermode:set(true)
        inst:PushEvent("tigerstart")
        OnTigerModeDirty(inst)
		 inst:DoTaskInTime(0.5, function() SetHUDState(inst) end)
    end
	
	inst.Light:Enable(true)
    inst.SoundEmitter:KillSound("eating")
    --inst.SoundEmitter:PlaySound("dontstarve/music/music_epicfight_winter", "danger")
	return inst
end	

 

here is full char.lua  : aikawa.lua

Link to comment
Share on other sites

If i had to take a shot in the dark my guess would be something from LeftClickPicker and SetTigerActions functions in the aikawa.lua. 
I think one of your errors is coming from componentactions.lua executing EntityScript:CollectActions which gets called from playeractionpicker.lua
I never messed with playeractionpicker before but my guess is that it shouldn't be ran on the client and is for some reason?

Link to comment
Share on other sites

 

On 12/6/2018 at 3:35 AM, Wolf_EX said:

If i had to take a shot in the dark my guess would be something from LeftClickPicker and SetTigerActions functions in the aikawa.lua. 
I think one of your errors is coming from componentactions.lua executing EntityScript:CollectActions which gets called from playeractionpicker.lua
I never messed with playeractionpicker before but my guess is that it shouldn't be ran on the client and is for some reason?

@Wolf_EX

I really appreciate it !! Thank you very much for your time !! :D 

 

 

Okay I'll try to looks at the componentactions.lua :D !!

 

 

hmmmm... okay.. I have... try to take a look and try to understand at those first error line...

 

[string "scripts/componentactions.lua"]:1182: attempt to index a nil value
LUA ERROR stack traceback:
    scripts/componentactions.lua:1182 in (method) CollectActions (Lua) <1168-1194>

 

line : 1182 <1168 -1194 >  in componentactions.lua

Spoiler

image.thumb.png.5c2c387fd9eeb7e935bd2dfc7431cfb3.png

 

image.png.fb8637005320396698fc14711865b922.png

at this line why it has stopped at theEnd, " before close if function ? : o

 

 

Maybe ,Dose that mean ... I need to adds 

those actions ...

 to my custom SG .. ?

Or create /add function to my *modmain : o ?

*( I just added TheSim:GetGameID to link the actions to the game in modmain.lua but I didn't test it with anyone yet. :'D )

--------------------------------------------------------------------

here is my files if you want to see : 

SGweretiger.lua 

modmain.lua

This file is my custom Sg use in Second Form of this Character.  

 Like Woodie is werebeaver form but , I modified to base on Creatures 's stagegraphs. (  not on werebeaver is stategraphs.)

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

 

ok let's move on !

Now I tried to looks at those 3 line :

Spoiler

    scripts/components/playeractionpicker.lua:97 in (method) GetSceneActions (Lua) <94-119>
    scripts/components/playeractionpicker.lua:215 in (method) GetLeftClickActions (Lua) <176-234>
    scripts/components/playeractionpicker.lua:322 in (method) DoGetMouseActions (Lua) <284-326>

 

 line : 97 < 94 - 119 > in playeractionpicker.lua

Spoiler

image.thumb.png.4acf585f2d038e59bbdfcbbd5e242815.png

  line : 215 < 176 - 234 > in playeractionpicker.lua

Spoiler

image.thumb.png.ca04fd750a02f3eac90efaf1019f27fb.png

  line : 322 < 284 - 326 > in playeractionpicker.lua

Spoiler

image.thumb.png.10a4c0386c348dff3fdf1e3b90d1d3ee.png

As I understand ...

If I Change the LeftClickPicker and SetTigerActions to something else ?

or

** removing it?? maybe it can be fixed ? 

 

* unfortunately I've tried this .. and have same error. :/ )

**( also.. I've tried this one too and my char can't do anything in another form can move around only , BTW

It has a this old error that idk how to fixed it it's call.. : actions are out of sync  :'') )

 

Or  If i try to add  ("inspectable") components ,

And create new function and link to Inspectable Components

maybe.. it might be work :') ?

 

here is my prefeb file : aikawa.lua

 

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

Or maybe I just can't really understand what it going to tell me X''D 

If that's true... If you don't mind, could you help me understanding it more please? :D 

<  I'm very sorry about my dumby chicken brain X''D >

PS:  And Thank you very much for your suggestion!! <<<333

 

SGweretiger.lua

image.png

Edited by Yagenius
Link to comment
Share on other sites

okay , today i've tried test my newest code with my friends ( and I play as Host )

and here is a result : 

 

48427415_1025895717613409_1043786935371300864_n.thumb.png.e7392c30cb55500dfe260dfba2be35c7.png

 

looks like a same error because it method to : componentactions , playeractionpicker , playercontroller.  :\

 

 I really don't know how to fix it..   Does anyone have any idea to fix this ?

here is full log and my lastest file :

LOGs : client_log (2).txt

My Lastest version : Aika - copy.rar

 

Link to comment
Share on other sites

Hello again!!!  X''D

 

I have tried to fixed some of those Error yesterday

( and it fixed. )

 now I got a new error. 

--------------------------------------------------------------------------------------------------------------------

 

I got it when I tried to Transforming to Second from [ Hosting + Cave Enable. ]

Spoiler

 


[string "scripts/components/hallucinations.lua"]:136: attempt to index field 'sanity' (a nil value)
LUA ERROR stack traceback:
    scripts/components/hallucinations.lua:136 in (field) fn (Lua) <135-156>
    scripts/scheduler.lua:177 in (method) OnTick (Lua) <155-207>
    scripts/scheduler.lua:371 in (global) RunScheduler (Lua) <369-377>
    scripts/update.lua:170 in () ? (Lua) <149-228>

 here is full error log :   client_log.txt

 

-- btw I need to create new Thread for this new error 

 

or just leave it here? --

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...