mrpoke20xx Posted March 12, 2015 Share Posted March 12, 2015 need help with stategraphs, the creature of the mod does not want to turn.I don't know what name to put in spriter to fix. here's the code:require("stategraphs/commonstates")local states={ State{ name = "idle", tags = {"idle"}, onenter = function(inst, playanim) inst.AnimState:PlayAnimation("idle") end, }, State{ name = "attack", tags = {"attack", "canrotate"}, onenter = function(inst) inst.components.combat:StartAttack() inst.Physics:Stop() inst.AnimState:PlayAnimation("atk") end, timeline= { TimeEvent(20*FRAMES, function(inst) inst.components.combat:DoAttack() inst.sg:RemoveStateTag("attack") inst.sg:RemoveStateTag("busy") end), }, events= { EventHandler("animqueueover", function(inst) inst.sg:GoToState("idle") end), }, },State{ name = "death", tags = {"busy"}, onenter = function(inst) inst.AnimState:PlayAnimation("dead") inst.Physics:Stop() RemovePhysicsColliders(inst) inst.components.lootdropper:DropLoot(Vector3(inst.Transform:GetWorldPosition())) end, }, State{ name = "hit", tags = {"busy"}, onenter = function(inst) inst.AnimState:PlayAnimation("hit") inst.Physics:Stop() end, events= { EventHandler("animover", function(inst) inst.sg:GoToState("idle") end ), }, },}local event_handlers={EventHandler("death", function(inst) inst.sg:GoToState("death") end), EventHandler("doattack", function(inst) if inst.components.health:GetPercent() > 0 and not inst.sg:HasStateTag("busy") then inst.sg:GoToState("attack") end end),}return StateGraph("SGmimic", states, event_handlers, "idle", {})Sorry for my bad english, i am from brazil. used google translate. Link to comment https://forums.kleientertainment.com/forums/topic/51977-help-with-stategraphs/ Share on other sites More sharing options...
Mobbstar Posted March 12, 2015 Share Posted March 12, 2015 did you set it four-faced? (look at other creatures (not sg!) if you don't know what I mean) Link to comment https://forums.kleientertainment.com/forums/topic/51977-help-with-stategraphs/#findComment-621133 Share on other sites More sharing options...
mrpoke20xx Posted March 12, 2015 Author Share Posted March 12, 2015 (edited) yes, but it does not run any of the animations, wanted to know what name to put on spriter to work. I put those names:idleatk_downatk_upatk_sidesdeadhitEDIT: it worked. Edited March 12, 2015 by mrpoke20xx Link to comment https://forums.kleientertainment.com/forums/topic/51977-help-with-stategraphs/#findComment-621135 Share on other sites More sharing options...
mrpoke20xx Posted March 12, 2015 Author Share Posted March 12, 2015 IT WORKS! thank you very much!soon, you will see a new mod coming out! Link to comment https://forums.kleientertainment.com/forums/topic/51977-help-with-stategraphs/#findComment-621136 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