Jump to content

Recommended Posts

Hello Survivors,

Im currently trying to add a new item althought I have unknown problems with my mod, it crashes everytime I enter my world and I dont mean the crash that shows you what went wrong but under the mod icon there is in red "Crashed!". What is the cause of this? Can those be the art files?

 

Link to comment
https://forums.kleientertainment.com/forums/topic/71534-unknown-mod-crash-reason/
Share on other sites

Usually, try checking the log file. Sometime the screen when you crash can't show you the reason when the log could. If neither of them show the reason, post your mod here, because it's hard to tell without the mod :)
If there is a error in the log and you can't understand it, post both mod and log.

Oh it was a stupid mistake but I fixed it, but now I get a new error
[00:55:01]: [string "scripts/components/sanityaura.lua"]:8: attempt to call field 'aurafn' (a nil value)
LUA ERROR stack traceback:
    scripts/components/sanityaura.lua:8 in (method) GetAura (Lua) <7-9>
    scripts/components/sanity.lua:290 in (method) Recalc (Lua) <259-322>
    scripts/components/sanity.lua:236 in (method) OnUpdate (Lua) <231-245>
    scripts/update.lua:187 in () ? (Lua) <150-223>

and this should be what causes it I think
 

Quote

local function flowersets(inst)
    if not GLOBAL.TheWorld.ismastersim then
        return
    end
    inst:AddComponent("sanityaura")
    if GetModConfigData("flowerStrenght") == ("1") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SUPERTINY
    elseif GetModConfigData("flowerStrenght") == ("2") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_TINY
    elseif GetModConfigData("flowerStrenght") == ("3") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SMALL
    else
    --No Aura
    end
end

AddPrefabPostInit("flower", flowersets)

local function pickFern(inst, picker)
    if picker and picker.components.sanity then
        picker.components.sanity:DoDelta(TUNING.SANITY_TINY)
    end
    inst:Remove()
end

local function fernSets(inst)
    if not GLOBAL.TheWorld.ismastersim then
        return
    end
    inst:AddComponent("sanityaura")
    if GetModConfigData("fernStrenght") == ("1") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SUPERTINY
    elseif GetModConfigData("fernStrenght") == ("2") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_TINY
    elseif GetModConfigData("fernStrenght") == ("3") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SMALL
    else
        --No Aura
    end
    
    inst.components.pickable.onpickedfn = pickFern
end

AddPrefabPostInit("cave_fern", fernSets)

 

Edited by DragonflyTheGiant
    if GetModConfigData("flowerStrenght") == ("1") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SUPERTINY
    elseif GetModConfigData("flowerStrenght") == ("2") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_TINY
    elseif GetModConfigData("flowerStrenght") == ("3") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SMALL
    else
        inst.components.sanityaura.aura = 0    --No Aura
    end

and

    if GetModConfigData("fernStrenght") == ("1") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SUPERTINY
    elseif GetModConfigData("fernStrenght") == ("2") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_TINY
    elseif GetModConfigData("fernStrenght") == ("3") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SMALL
    else
        inst.components.sanityaura.aura = 0    --No Aura
    end

 

6 minutes ago, alainmcd said:

    if GetModConfigData("flowerStrenght") == ("1") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SUPERTINY
    elseif GetModConfigData("flowerStrenght") == ("2") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_TINY
    elseif GetModConfigData("flowerStrenght") == ("3") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SMALL
    else
        inst.components.sanityaura.aura = 0    --No Aura
    end

and


    if GetModConfigData("fernStrenght") == ("1") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SUPERTINY
    elseif GetModConfigData("fernStrenght") == ("2") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_TINY
    elseif GetModConfigData("fernStrenght") == ("3") then
        inst.components.sanityaura.aura = TUNING.SANITYAURA_SMALL
    else
        inst.components.sanityaura.aura = 0    --No Aura
    end

 

no changes the same error again

duqxeygsgrytsrstvflkaoxzxzilvqwqeaxbqxbx

@DragonflyTheGiant

Add a GLOBAL. for each TUNING- right now you're making them nil which defaults to calling the aurafn because nil and nil or nil.

So:

GLOBAL.TUNING.SANITYAURA_TINY etc.

Tidbit of personal annoyance: "Strenght" -> "Strength"

Edited by CarlZalph
Added player callout for notification.
26 minutes ago, CarlZalph said:

@DragonflyTheGiant

Add a GLOBAL. for each TUNING- right now you're making them nil which defaults to calling the aurafn because nil and nil or nil.

So:

GLOBAL.TUNING.SANITYAURA_TINY etc.

Tidbit of personal annoyance: "Strenght" -> "Strength"

why is GLOBAL needed ? I thought in case of TUNING you don't need GLOBAL , even in modmain?!

Hahaha Fun Fact, the error stayed

Quote

local function flowersets(inst)
    if not GLOBAL.TheWorld.ismastersim then
        return
    end
    inst:AddComponent("sanityaura")
    if GetModConfigData("flowerStrenght") == ("1") then
        inst.components.sanityaura.aura = GLOBAL.TUNING.SANITYAURA_SUPERTINY
    elseif GetModConfigData("flowerStrenght") == ("2") then
        inst.components.sanityaura.aura = GLOBAL.TUNING.SANITYAURA_TINY
    elseif GetModConfigData("flowerStrenght") == ("3") then
        inst.components.sanityaura.aura = GLOBAL.TUNING.SANITYAURA_SMALL
    else
        inst.components.sanityaura.aura = 0
    end
end

 

Edited by DragonflyTheGiant
14 minutes ago, DragonflyTheGiant said:

Hahaha Fun Fact, the error stayed

 

SUPERTINY doesn't exist.

		SANITYAURA_TINY = 100/(seg_time*32),
		SANITYAURA_SMALL_TINY = 100/(seg_time*20),
		SANITYAURA_SMALL = 100/(seg_time*8),
		SANITYAURA_MED = 100/(seg_time*5),
		SANITYAURA_LARGE = 100/(seg_time*2),
		SANITYAURA_HUGE = 100/(seg_time*.5),

Pick 'em.

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
×
  • Create New...