Jump to content

Recommended Posts

Hi! I tried to add new action animation for my custim weapon, but still it not work corrctly.

I'm add action in modmain, but when i cast it my character just dissapear and I can't move or do something. But, server not crushed. 

Maybe I not add something in code I don't know. 

My code for anim:

-- New Animation
 
 local slice_state = State{
        name = "slice",
        tags = { "slice" },

        onenter = function(inst)
            inst.components.locomotor:Stop()
            --inst.components.locomotor:Clear()
			--inst:ClearBufferedAction()
			
			inst.AnimState:PlayAnimation("slice")
        end,
		
		 events =
        {
			-- events like "firedamage", etc. go here. 
			-- Check out Steam/SteamApps/common/Don't Starve Together/scripts/stategraphs/SGwilson.lua to learn more.
			
			 --EventHandler("locomote", function(inst, data)
        --if inst.sg:HasStateTag("busy") then
           -- return
       -- end
        },

        onexit = function(inst)
			-- define what happens while we're exiting our custom state
			
			inst:ClearBufferedAction()
			return inst
        end,

      
    }

local function yamato_slice(sg)
    sg.states["slice"] = slice
end

AddStategraphState("SGwilson", slice_state)
AddStategraphPostInit("vergil", yamato_slice) 
 
local SLICE = GLOBAL.Action({ priority= 10 })	
SLICE.str = "Slice"
SLICE.id = "SLICE"
SLICE.fn = function(act)
    return true
end
AddAction(SLICE)

AddComponentAction("SCENE", "health", function(inst, doer, actions, right)
    if right and inst and inst:HasTag("player") and doer and doer == inst then
        table.insert(actions, ACTIONS.SLICE)
    end
end)

In weapon I use spellcaster and add 

caster.AnimState:PlayAnimation("SLICE")  in function of spell

Add any character model for scml

I create only one side of action just look how it works, but it not work anyway

 

slice.scml

Link to comment
https://forums.kleientertainment.com/forums/topic/110108-add-new-anination/
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...