Jump to content

Recommended Posts

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

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