realitymeltdown Posted January 14, 2017 Share Posted January 14, 2017 (edited) So I've got a stategraph, with a state called "leave". The only problem is, it doesn't ever hit the "animover" event. It keeps looping the event and the animation over and over. State{ name = "leave", tags = { "busy" }, onenter = function(inst, target) inst.SoundEmitter:KillSound("danger_music") inst.AnimState:PlayAnimation("leave") end, events = { EventHandler("animqueueover", function(inst) inst.Remove() end), }, }, It might be in the brain, but I do not see why this would re-invoke and keep trumping the original event... other prefabs didn't seem to need to check if they were re-entrant safe function prefab_brain:OnStart() local root = PriorityNode( { WhileNode(function() return WantsToEat(self.inst) end, "eating", DoAction(self.inst, MY_EAT)), ActionNode(function() return self.inst.sg:GoToState("leave") end) }, .25 ) self.bt = BT(self.inst, root) end Anyone know what I am missing here? Edited January 14, 2017 by realitymeltdown Link to comment https://forums.kleientertainment.com/forums/topic/73349-stagegraphanimation-loop-problem/ Share on other sites More sharing options...
realitymeltdown Posted January 15, 2017 Author Share Posted January 15, 2017 State{ name = "leave", tags = { "busy" }, onenter = function(inst) inst.components.health:SetInvincible(true) inst.Physics:Stop() RemovePhysicsColliders(inst) inst.AnimState:PlayAnimation("leave") inst:SetBrain(nil) end, events= { EventHandler("animover", function(inst) inst:Remove() end), }, }, For anyone reading this, I checked the Krampus brain - which had nearly identical code to my original, except it removed the brain (spooky!). That appeared to get it to properly abandon ship Link to comment https://forums.kleientertainment.com/forums/topic/73349-stagegraphanimation-loop-problem/#findComment-858554 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