Jump to content

Recommended Posts

image.thumb.png.ceecc5fcf8baa420b0347fa0cfde74d9.png

Hi guys, I recently uploaded a mod to the steam workshop, but before that, the mod was ok, and then too, but today, I tried to create a world with caves and my mod. So I have this error, can anyone help me? It sure is my mod, but I really want to play with the mod. My mod is a character mod, using the extended sample character.

 

Take a look at your client and/or server logs, they will tell you what went wrong.

Client logs can be found under Documents\Klei\DoNotStarveTogether\client_log.txt

Server logs can be found under Documents\Klei\DoNotStarveTogether\[your_steam_id]\Cluster_[your_cluster_number]\Master\server_log.txt

If the log doesn't help you, post it here.

7 hours ago, Monti18 said:

Take a look at your client and/or server logs, they will tell you what went wrong.

Client logs can be found under Documents\Klei\DoNotStarveTogether\client_log.txt

Server logs can be found under Documents\Klei\DoNotStarveTogether\[your_steam_id]\Cluster_[your_cluster_number]\Master\server_log.txt

If the log doesn't help you, post it here.

server_log.txti can t find it myself srry. I begin to modding recently, so i m terrible. I read all the stuff but don t actually find the problem.

[Shard] A shard has disconnected: 'Caves(1484729150)'

It seems like your caves are crashing, take a look at the caves server log, it's in the Caves folder where you also found the other server.log

No worries, we all start somewhere :)

  • Like 1
20 minutes ago, Monti18 said:

[Shard] A shard has disconnected: 'Caves(1484729150)'

It seems like your caves are crashing, take a look at the caves server log, it's in the Caves folder where you also found the other server.log

No worries, we all start somewhere :)

server_log.txt
i think i found the error but i can t see what s wrong with the scripts look, he says i got an error on the lines 162-180 as you can see in the log:

[00:01:52]: [string "../mods/Wicolas, The Hybrid Beast/modmain.l..."]:164: attempt to index local 'inst' (a nil value)
LUA ERROR stack traceback:
    ../mods/Wicolas, The Hybrid Beast/modmain.lua:164 in (upvalue) hungerForm (Lua) <162-175>
    ../mods/Wicolas, The Hybrid Beast/modmain.lua:179 in (field) fn (Lua) <178-180>
    scripts/scheduler.lua:186 in (method) OnTick (Lua) <164-216>
    scripts/scheduler.lua:409 in (global) RunScheduler (Lua) <407-415>
    scripts/update.lua:234 in () ? (Lua) <218-292>

i will send my modmain too. Also, thanks for the help all the way at here.

modmain.lua

Well you want to run the function with inst, but in the AddSimPostInit, you never defined inst. So it will be nil and cause an error.

I would also add all these functions that you define in the modmain for your character to the prefab file of your character, this way it's better organized (in my opinion). You can also leave it there, it works both ways.

If you run a SimPostInit, you will not have your player as the argument. That's why you need to do it in a AddPrefabPostInit

Spoiler

local function hungerForm(inst)
	if inst.transformed then
		if inst:HasTag("wicolas") and inst.components.hunger.current <= 0 then 				
			originalform(inst)			
			local x, y, z = inst.Transform:GetWorldPosition()
			SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get())
			inst.components.talker:Say("Ouch, my head hurts...", 2.5,true)
			if inst.components.grogginess ~= nil then -- Ficar cansado quando fica com 0 de fome
        		inst.components.grogginess:MaximizeGrogginess()
			end
		end
	end
end

AddPrefabPostInit("wicolas",function(inst) 
  if GLOBAL.TheWorld.ismastersim then
    	inst:DoPeriodicTask(1, function(inst)
        	hungerForm(inst)
      	end)
    end
end)

 

This should get you rid of the error you had there.

You're welcome :)

Edited by Monti18
  • Thanks 1
22 minutes ago, Monti18 said:

Well you want to run the function with inst, but in the AddSimPostInit, you never defined inst. So it will be nil and cause an error.

I would also add all these functions that you define in the modmain for your character to the prefab file of your character, this way it's better organized (in my opinion). You can also leave it there, it works both ways.

If you run a SimPostInit, you will not have your player as the argument. That's why you need to do it in a AddPrefabPostInit

  Hide contents


local function hungerForm(inst)
	if inst.transformed then
		if inst:HasTag("wicolas") and inst.components.hunger.current <= 0 then 				
			originalform(inst)			
			local x, y, z = inst.Transform:GetWorldPosition()
			SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get())
			inst.components.talker:Say("Ouch, my head hurts...", 2.5,true)
			if inst.components.grogginess ~= nil then -- Ficar cansado quando fica com 0 de fome
        		inst.components.grogginess:MaximizeGrogginess()
			end
		end
	end
end

AddPrefabPostInit("wicolas",function(inst) 
  if GLOBAL.TheWorld.ismastersim then
    	inst:DoPeriodicTask(1, function(inst)
        	hungerForm(inst)
      	end)
    end
end)

 

This should get you rid of the error you had there.

You're welcome :)

Oooooohhhh my god, THANK YOUUUU SOOOOO MUCH SIR. It worked! Now i can use my mod. 

  • Like 1

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