ID:1985485
 
(See the best response by Somepotato.)
Code:
mob/verb/change(mob/m)
flick("Attack",m)//Animation duration 2 secs
sleep(10)
flick("BeingHit",m)//Animation duration 1 sec


Problem description:
My problem is that when I use flick() with sleep() the animation won't change on the right moment. More specifically it playes the whole Attack animation and then the BeingHit animation instead of playing only 1 sec of the attack and then BeingHit

Best response
This is intended as far as I'm aware. Use icon_state instead.
no the problem is the icon is set to repeat an endless amount of times in the icon file

set it to repeat once
I'm not sure what you're getting at there, but if you replace the first flick with setting icon_state (and then back), it will resolve your issue.
it is set repeat once, so isn't there a library or can't I override the flick proc or something to handle icon_states??

When I call flick again it has to end the first animation first and go to the next one caused by flick afterwards. I want it to halt the previous and start the other.
yes and as I've said, setting icon_state will resolve that