ID:1135020
 
(See the best response by Critical172.)
I have tried many different codes but none seem work the way i want it to.It a simple code but i been years since i mess with some codes. Am trying add a flick on M.(Ex. I punch a mob or mob punch me a punch impact show.) Anyone can help me thank you for help in advance.
Best response
I'm not sure how to do that either so I use this
obj/effects
layer=MOB_LAYER+10
punch
icon='Your effect.dmi'
New()
flick("Your icon state that flicks",src)
spawn(4)//how long it stays
del src
//now do new/obj/effects/punch(locate(mob.x,mob.y,mob.z))
not sure why you need the flick() statement, the icon should already have the effect graphics
Usually, you would want to play an animation of effect from start to end. flick() helps you do this.
Animations can start in the middle of a set of frames because DM does not start frame animations at New(), instead it has more like a global frame index that changes for the entire world at the same time.

I have a "flick" obj that follows my mobs around so I can do overlay flick effects without losing the player's icon / icon state / overlays underneath. Doing it the way Critical suggested will only work if the player stands still.
In response to Jemai1
Jemai1 wrote:
Usually, you would want to play an animation of effect from start to end. flick() helps you do this.

Oh right...I generally use /images for this kind of thing, which always start at the beginning of the animation. Although people have advised me that I should use atomic objects instead...
If the animation does not require a chronological order of frames, using images is not too bad. Sometimes, you just want to display a still or blinking sprite for 4 ticks.
I'm pretty sure images will display the first frame when created.
Nah. You'll have to add them to images of the clients you want to show them to. Then there's the limitation of not being able to flick() an /image object.