Cyde042 Posted October 6, 2014 Share Posted October 6, 2014 This errors are like ping pong, what am I supposed to do?function farmplotpostinit(inst) oldGrower = inst.components.grower:RemoveCrop(crop) inst.components.grower:RemoveCrop(crop) = function(inst) --it wants a function argument near =, but when I add it - "(crop)", it says unexpected symbol near = if GLOBAL.GetPlayer():HasTag("winnie") then GLOBAL.GetPlayer().components.sanity:DoDelta(TUNING.SANITY_MED) end endend Link to comment Share on other sites More sharing options...
_Q_ Posted October 6, 2014 Share Posted October 6, 2014 This errors are like ping pong, what am I supposed to do?function farmplotpostinit(inst) oldGrower = inst.components.grower:RemoveCrop(crop) inst.components.grower:RemoveCrop(crop) = function(inst) --it wants a function argument near =, but when I add it - "(crop)", it says unexpected symbol near = if GLOBAL.GetPlayer():HasTag("winnie") then GLOBAL.GetPlayer().components.sanity:DoDelta(TUNING.SANITY_MED) end endend You want to add sanity bonus when she harvest crops? Link to comment Share on other sites More sharing options...
Heavenfall Posted October 6, 2014 Share Posted October 6, 2014 inst.components.grower:RemoveCrop(crop) = function(inst) That line makes no sense to me. If you just want to redefine RemoveCrop function then do inst.components.grower.RemoveCrop = function(inst) Link to comment Share on other sites More sharing options...
_Q_ Posted October 6, 2014 Share Posted October 6, 2014 function GrowerComponentPostInit(inst)inst.RemoveCrop = function(self ,crop) crop:Remove() self.crops[crop] = nil if GLOBAL.GetPlayer():HasTag("player") then GLOBAL.GetPlayer().components.sanity:DoDelta(TUNING.SANITY_MED) end for k,v in pairs(self.crops) do return end self.isempty = true self.inst:RemoveTag("NOCLICK") self.cycles_left = self.cycles_left - 1 if self.setfertility then self.setfertility(self.inst, self:GetFertilePercent()) endendendAddComponentPostInit("grower", GrowerComponentPostInit)Just change "player" to "winnie" Link to comment Share on other sites More sharing options...
Cyde042 Posted October 6, 2014 Author Share Posted October 6, 2014 function GrowerComponentPostInit(inst)inst.RemoveCrop = function(self ,crop) crop:Remove() self.crops[crop] = nil if GLOBAL.GetPlayer():HasTag("player") then GLOBAL.GetPlayer().components.sanity:DoDelta(TUNING.SANITY_MED) end for k,v in pairs(self.crops) do return end self.isempty = true self.inst:RemoveTag("NOCLICK") self.cycles_left = self.cycles_left - 1 if self.setfertility then self.setfertility(self.inst, self:GetFertilePercent()) endendendAddComponentPostInit("grower", GrowerComponentPostInit)Just change "player" to "winnie" Did really want to replace the function but I can't get the thing to work, guess I'll have to use it. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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.