there is an event called "on animation finished"
so let's say you are using spacebar as your attack button
it would look something like:
on spacebar pressed
subevents
animation attack1 is playing >> add 1 to variable1
animation walking is playing >> set animation attack1
on animation attack1 finished
and variable1 is greater than 0 >> set animation attack2, set variable1 to 0
on animation attack2 finished >> set animation walking