Jump to content

Recommended Posts

Hello, I need help!

So, if someone can help tell me is there a event that plays right when the player starts a attack? I tried "onattackother" but that plays after you landed a attack..because I wanna play a different state & I need it to happen before the attack animation starts when you're doing a attack :(..

 

If there's no event like that then does someone know how I can play a different state for a action?

I tried something like this

Spoiler

local handle = inst.sg.sg.actionhandlers[ACTIONS.ATTACK]
handle.deststate = function(inst) return "critical" end

 

but I don't know how to undo it :(.. So, any help would be very great :D!

Edited by SuperDavid

try, not sure when it fires but it should be before it hits:

local function OnStartAttack(inst)
	--code
end

inst:ListenForEvent("startaction", function(inst, data)
	if data.action and data.action.action == ACTIONS.ATTACK then
		OnStartAttack(inst)
	end
end)

 

"startaction" event seems to never get triggered no matter what I do, unfortunately :(...but thanks for your help, Aquaterin :D!

I guess there's no event for something like this, that's a bummer but oh well..

Edited by SuperDavid

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