Jump to content

Hideout component: "variable 'count' is not declared"


maliblues
  • Pending

Working on a mod and when using the hideout component I'm not able to set a "OnGoHome" function because it runs into the error "scripts/components/hideout.lua"]:187: variable 'count' is not declared".

    inst:AddComponent("hideout")
	inst.components.hideout:SetGoHomeFn(OnGoHome)

Which leads back to this following code on the component:

function Hideout:GoHome( child )
    if self.storedcreatures[child] ~= nil then
        print("Ack! We already have this child inside!?")
        return
    end

    self.storedcreatures[child] = child
    self.numstoredcreatures = GetTableSize(self.storedcreatures)

    child:RemoveFromScene()
    child.Transform:SetPosition(0,0,0)
    if child.components.brain then
        BrainManager:Hibernate(child)
    end
    if child.SoundEmitter then
        child.SoundEmitter:KillAllSounds()
    end

    if self.ongohome then
        self.ongohome(self.inst, count)
    end

    if self.numstoredcreatures == 1 and self.onoccupied then
        self:onoccupied(self.inst)
    end
end

I believe "count" is not intended to be here and so causing the error. It would be great to be able to get this working, thank you in advance!


Steps to Reproduce
Set a function for "inst.components.hideout:SetGoHomeFn(OnGoHome)".



User Feedback


There are no comments to display.



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