Jump to content

Character mod crashes server on load [code included] pls help!


Recommended Posts

So i added custom component to character and its crashing when:

  1. i enter cave
  2. i load existing world - creating new world is fine but when i disconnect and resume it teleports my character to some random spot and after few seconds crash server.

here is code for component:

--blood.lua
local Blood = Class(function(self, inst)
	self.inst = inst
	self.max = 100
	self.current = 0
end)

function Blood:OnSave()
	return {currentblood = self.current}
end

function Blood:OnLoad(data)
    if data.currentblood then
        self.current = data.currentblood
        self:DoDelta(0, true)
    end
end
--Ustawia aktualna wartosc bloodpoints
function Blood:SetCurrent(amount)
	self.current = amount
end

function Blood:GetCurrent()
	return self.current
end

return Blood

and i add component to character this way

inst:AddComponent("blood")

its probably something with saving or loading, maybe? idk

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