ID:175328
 
Now I KNOW I've asked about this before, and I have a couple of ideas how to do this but it's just not going anywhere. I think I remember Maz having something on this.

Anyway, how do you create an overlay over a character that shows the sequence of the overlay from its first frame to its last? Normally, when an overlay appears over a character, the sequence is usually messed up. It could start on frame 6 of 20, as opposed to the first frame.

-Dagolar
proc
v_flick(var/N,atom/A,var/Delay as num)
if(isfile(N))
var/obj/O = new()
O.icon = N
A.overlays += O
spawn(Delay) A.overlays -= O
else if(istext(N))
var/obj/O = new()
O.icon = A.icon
O.icon_state = N
A.overlays += O
spawn(Delay) A.overlays -= O
else return 0


I suppose you just have to find the correct amount of time to display it.

~>Volte
Place an obj over the player that moves in sync with the player. Make sure the obj has no icon (icon = null). Now, flick() the icon on that obj to play the animation from start to finish one time. After the animation is over, the obj reverts to a null icon and can be deleted at your leisure (or you can just leave it there to be used later.)
In response to Shadowdarke
That's an interesting thought. Here's the problem. That would work great if it was just one of those objects being flicked at any one time, right? What if you had 4 flicking icons happening at one time?

-Dagolar
In response to Dagolar
Then you create 4 objs.
In response to Shadowdarke
this is what I did:

obj
BGoverlays
Graphic
icon = 'BattleGraphics.dmi'

var/obj/BGoverlays/Graphic = new()
Graphic.loc = target.loc
flick("[src.cast]",Graphic)

//spell procedure goes here blah blah

del(Graphic)


Now this works great on single player. The graphic is created at the target's location, the graphic flicks the spell graphic that the character chose, and after that's all done, the graphic is deleted. Does this look good for multiple uses (suppose 8 fights are happening at once)?

-Dagolar