Jump to content

can not use custom variable in class??


 Share

Recommended Posts

well...this really drive me insane...not wilson,i'm sorry,it's me......try to modify data\scripts\components\sanity.luaadd new variable self.ct = 1

local Sanity = Class(function(self, inst)    self.inst = inst    self.max = 100    self.current = self.max	--local dt = 1	--self.task = self.inst:DoPeriodicTask(dt, function() self:Recalc(dt) end)	self.inst:StartUpdatingComponent(self)	self:Recalc(0)	self.rate = 0	self.sane = true		self.ct = 1	end)
then in the function below
function Sanity:DoDelta(delta, overtime)	self.ct = self.ct + 1end
self.ct = self.ct + 1,crash the game...well,this really make me insane,cause the original clauseself.current = self.current + deltajust do so,and no crash....so,what's wrong....:fatigue:i can not add a custom counter timer and change it??
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...