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 https://forums.kleientertainment.com/forums/topic/41563-what-did-do-wrong/ 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 https://forums.kleientertainment.com/forums/topic/41563-what-did-do-wrong/#findComment-545843 Share on other sites More sharing options...
Heavenfall Posted October 6, 2014 Share Posted October 6, 2014 (edited) 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) Edited October 6, 2014 by Heavenfall Link to comment https://forums.kleientertainment.com/forums/topic/41563-what-did-do-wrong/#findComment-545855 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 https://forums.kleientertainment.com/forums/topic/41563-what-did-do-wrong/#findComment-545862 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 https://forums.kleientertainment.com/forums/topic/41563-what-did-do-wrong/#findComment-545864 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now