ID:1134235
 
Keywords: attack, coding, combos, flick
(See the best response by Critical172.)
Code:
        Attack()
flick("Attack",src)
for(var/mob/character/m in get_step(src, dir))
world << m
//rest of the attack stuff.


Problem description:
My problem with my attack verb is that it does the entire combo after you press the macro for the verb, which i know is because of the "flick" part. But i was wondering if there is another was to animate the attack verb so that a player would have to repeatedly press the macro inorder to do the whole combo. Im not really sure how to ask this, and thats also the reason why i dont know how to search for it in other forums. Any kind of help would be appreciated! thanks.
You'll have to show us everything. This doesn't tell us anything.
well the entire attack verb is this:
        Attack()
if(!src.canattack)
return 0
src.canattack = 0
freeze(7)
flick("Attack",src)
for(var/mob/character/m in get_step(src, dir))
world << m
var/Damage=max(0,src.Str-m.Def)
flick("Hit",m)
step(m,WEST)
step(m,m.dir)
step(m,WEST)
m.dir=EAST
Bump()
m.KnockBack(10)
view(m)<<"[src] hit [m] for [Damage] Damage!"
m.Deathcheck()
spawn(10)
src.canattack = 1
return 1


anything else i would need to show?
What you are showing is a basic attack *wait* attack verb.
Do you want combos like hit 1, hit 2, hit 3(knockback), wait, then you atk again
or do you mean F,G,F, wait, then you atk again
the "hit1,hit2,hit3(knockback)" one!
Best response
Attack()
if(src.canattack==3)
return 0
src.canattack += 1
var/g=src.canattack
freeze(7)
flick("Attack[src.canattack]",src)
for(var/mob/character/m in get_step(src, dir))
world << m
var/Damage=max(0,src.Str-m.Def)
flick("Hit",m)
step(m,WEST)
step(m,m.dir)
step(m,WEST)
m.dir=EAST
Bump()
if(src.canattack==3)
m.KnockBack(10)
view(m)<<"[src] hit [m] for [Damage] Damage!"
m.Deathcheck()
spawn(10)
if(src.canattack==g)
src.canattack = 0
return 1


You can try this out for size. BTW change
if(!src.canattack)//change it to if(src.canattack==3)
if(src.canattack)//change this to if(src.canattack<3)
Also create "Attack1","Attack2", and "Attack3" icon_states for your mob
The "Attack[src.canattack]" is so you can flick different animations depending on how far you are in combo. If you don't have "Attack1","Attack2",and "Attack3" as icon_states you'll disappear real quick. If you would like the animation to stay the same change it back to "Attack".

The way you coded it src.canattack=0 or !src.canattack means they can't atk for a short moment. The way it is now, src.canattack==3, means once you have done a 3 hit combo you can't atk for a short moment.

You have src.canattack to represent that they can attack someone. The way it is now, src.canattack<3, as long as you havent done a devastating combo you can still attack without delay.
Perfect! thanks alot for the help!