ID:263150
 
Code:
var/obj/h = new/obj/overlay/emoticon
h.icon_state = v
usr.emoticon = h
usr.overlays += usr.emoticon


Problem description:
(v is a parameter passed into the proc)

Ok so I do the above, and the overlay appears fine (I also have it set on a timed disappear). HOWEVER, for some of the icon states it plays from like the middle of the animation, which ruins what I'm trying to do.

I need it to be an overlay, cause, as you can see, it's an emoticon. Any ideas why this is happening?

Failing that, is there any way to reset the animation of an icon so that it plays in the correct order?
It's not animating at the right spot because all icon states start at a select time. So if you used that code 100 times at different times, they all would look the same at one given time. In order to force the animation to start from the start, you have to use <code>flick()</code>. But the problem is that you cannot use flick on overlays, so you have to use an image object in this case.

var/image/I = image('emoticon.dmi', usr, v) // create a new image object, and place it on usr.  Set the icon state to 'v'
world << I // display the image object to everyone
flick(v, I) // start animating


~~> Unknown Person
In response to Unknown Person
Even flick() has never worked for me. :-(
In response to Unknown Person
I was under the impression you can't use flick() on an image, but only flick an image itself.
In response to Unknown Person
Unknown Person wrote:
It's not animating at the right spot because all icon states start at a select time. So if you used that code 100 times at different times, they all would look the same at one given time. In order to force the animation to start from the start, you have to use <code>flick()</code>. But the problem is that you cannot use flick on overlays, so you have to use an image object in this case.

> var/image/I = image('emoticon.dmi', usr, v) // create a new image object, and place it on usr.  Set the icon state to 'v'
> world << I // display the image object to everyone
> flick(v, I) // start animating
>

~~> Unknown Person

Gah if that's the case I may be in trouble...
If it's an emoticon, why not just make a 'movie' for the icon and delay the transition from state to state during the movie? Like say running water. You've got 4 state making it run in the movie thing but you want them to wait for a bit before changing. Just use the 'delay' feature in the 'movie'.

If that's not right, oh well. That'd just the impression I got from what he's saying and trying to do.
In response to Unknown Person
I'm pretty sure that flick() doesn't work with image() objects. At least, it didn't work for me when I last tried it, which wasn't all that long ago.