Sanity as a trigger


Lynnden

Recommended Posts

@Blueberrys

 so where do i put this? in the fn function or wrap that around sanityCheck?

right never mind that i figured that out. I wrapped it around the call for sanity check in fn, compiled it and it ran. the mod was enabled, i booted up a level, and upon using "c_setsanity(.20)" promptly gave me this message

Reset() returningQueryServerComplete no callback..._starve/data/../mods/Ellen/scripts/prefabs/ellen.lua:40: attempt to index local 'data' (a nil value)..._starve/data/../mods/Ellen/scripts/prefabs/ellen.lua:40: attempt to index local 'data' (a nil value)LUA ERROR stack traceback:        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/../mods/Ellen/scripts/prefabs/ellen.lua(40,1) in function 'sanityCheck'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/../mods/Ellen/scripts/prefabs/ellen.lua(62,1) in function 'fn'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/entityscript.lua(690,1) in function 'PushEvent'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/components/sanity.lua(142,1) in function 'DoDelta'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/components/sanity.lua(261,1) in function 'Recalc'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/components/sanity.lua(187,1) in function 'OnUpdate'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/update.lua(104,1)scripts/frontend.lua(723,1) SCRIPT ERROR! Showing error screen	Force aborting...

so now i'm in the same issue when i scratch my head when it yells at me for using "inst." in the wrong place.

Link to comment
Share on other sites

@Blueberrys,

alright so everything works, it executes. i can run the game without crashing, now the problem is nothing dies, i've spawned a hound did c_setsanity(.2) it prints here's johnny" but doesn't kill anything. here's the code.

function sanityCheck(inst, data)     if data.newpercent <= .2 then    	print(inst)	    local i = 1	    print("spooks skeletons")	    local CurrentSanity = inst.components.sanity:GetPercent()    	    if CurrentSanity <= .20 then	    	print("well you're insane")	        inst.components.sanity:DoDelta(30)	        local x,y,z = inst.Transform:GetWorldPosition()	        local ents = TheSim:FindEntities(x,y,z, 25)	        for k, v in pairs(ents) do	        	print("here's johnny")	            inst.components.health:Kill()	        end	    end	endend
Link to comment
Share on other sites

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.