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 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 Share on other sites More sharing options...
mrpoke20xx Posted March 12, 2015 Author Share Posted March 12, 2015 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. Link to comment 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 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.