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.

Recommended Posts

Mackswell    0

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

Share this post


Link to post
Share on other sites