Jump to content

Recommended Posts

Can anyone offer some advice please? I know nothing about the game code but I have just had this loading error (screenshot attached) and I'm not sure if it's to do with some mods or not. I was playing a vanilla save file, but forgot to disable the mods I'd installed for my RoG/SW games. The mods did all say they were compatible with everything, however, they weren't installed when I first started this save file. It played fine last night regardless, but now the game won't load. The installed mods are Smart Crock Pot, Combined Status, Wormhole Marks and Storeroom. I didn't use any wormholes or build a storeroom. After it wouldn't load with the mods, I disabled them and tried again, but with the same result. I've also been having a weird issue where whenever I close down Don't Starve, Windows 10 seems to think the game has crashed, but this hasn't [until now?] affected any save data...

If it's a mod issue, I guess I'll just have to abandon the game, but if it's not down to mods, I can send a bug report. Thanks in advance!

Don'tStarveLuaErrorVanilla.PNG

Something loads with an invalid herd. (when the game loads, it tries to add the creature in question to a herd, but the creature already has a herd for some reason, and an invalid one too, which is why the game crashes)

From a quick glance at the code, it seems this is actually a flaw in the game code that just normally doesn't pop up. (the herd:RemoveMember function assumes herdmember:GetHerd() is the component, but it's the instance)

Your save file is not entirely corrupted, a well-written mod can solve this issue. EDIT: Try making a mod with this code in modmain.lua (warning: not SW compatible) :

Spoiler

AddComponentPostInit("herd",function(self)
	function self:AddMember(inst)
		if not self.members[inst] then
			self.membercount = self.membercount + 1
			self.members[inst] = true
			if inst.components.knownlocations then
				inst.components.knownlocations:RememberLocation("herd", Vector3(self.inst.Transform:GetWorldPosition() ))
			end
			if inst.components.herdmember then
				if inst.components.herdmember:GetHerd() ~= nil then
					inst.components.herdmember:GetHerd().components.herd:RemoveMember(inst)
				end
				inst.components.herdmember:SetHerd(self.inst)
			end
			if self.addmember then
				self.addmember(self.inst, inst)
			end
			self.inst:ListenForEvent("death", function(inst) self:RemoveMember(inst) end, inst)
			
			if self.onfull and self.membercount == self.maxsize then
				self.onfull(self.inst)
			end
		end
	end
end)

 

Edited by Mobbstar
20 hours ago, Mobbstar said:

From a quick glance at the code, it seems this is actually a flaw in the game code that just normally doesn't pop up. (the herd:RemoveMember function assumes herdmember:GetHerd() is the component, but it's the instance)

Your save file is not entirely corrupted, a well-written mod can solve this issue.

  Reveal hidden contents


AddComponentPostInit("herd",function(self)
	function Herd:AddMember(inst)
		if not self.members[inst] then
			self.membercount = self.membercount + 1
			self.members[inst] = true
			if inst.components.knownlocations then
				inst.components.knownlocations:RememberLocation("herd", Vector3(self.inst.Transform:GetWorldPosition() ))
			end
			if inst.components.herdmember then
				if inst.components.herdmember:GetHerd() ~= nil then
					inst.components.herdmember:GetHerd().components.herd:RemoveMember(inst)
				end
				inst.components.herdmember:SetHerd(self.inst)
			end
			if self.addmember then
				self.addmember(self.inst, inst)
			end
			self.inst:ListenForEvent("death", function(inst) self:RemoveMember(inst) end, inst)
			
			if self.onfull and self.membercount == self.maxsize then
				self.onfull(self.inst)
			end
		end
	end
end)

 

Thank you for the reply! Hmm. None of my mods were mob related, so this is sounding like a main game bug after all - unless those mods were badly written to somehow affect mobs accidentally, but they are popular and have never caused trouble before. Do you have any tips on how I could save the game file? Because I didn't actually want to use mods, and don't write them myself, but if it's too much hassle I'll just delete it and try again... I was seeing how long I could survive in a vanilla world now that I've got to grips with the more difficult expansions!

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