ID:150462
 
I have a verb in my game that activates and over lay i have thats 5 frames long in movie format. I was wondering how to make the moviel play from the beginning every time i use it.
I have this code for my scan verb


mob
verb
scan(M/mob in view())
usr<<"[M] has a Power Level of [M.PowerLevel]"


But it keeps telling me that M is a bad var, i have used M as a mob in other places in my code (mainly my attack verb) but it wont let me use it here, can anyone please tell me why?
In response to Jotdaniel
Try mob/M
In response to Nadrew
i feel stupid now(for good reason) thanky you for pointing that out to me. ive had a long day (biology test, english speech and so on...)
I don't believe there's an easy way to do that, with the current movie format. My suggestion would be to make 5 different (non-movie) icon states, one for each frame of animation, like: stupidripoffofstupidcartoon1, stupidripoffofstupidcartoon2, stupidripoffofstupidcartoon3, stupidripoffofstupidcartoon4 (kind of like looking at the Hub listings, huh?), and stupidripoffofstupidcartoon5. Then, in the code where you set the overlay, instead of setting the overlay to the animation, you manually add the overlay stupidripoffofstupidcartoon1, wait a tick, remove that and add stupidripoffofstupidcartoon2, and so on.
In response to LexyBitch
Thanks, i see what needs to be done now, and its not STUPID, i admit its a rippoff of a cartoon though. heh
In response to LexyBitch
ok heres what i have now,
usr.overlays+="ka1"
spawn(2)
usr.overlays-="ka1"
spawn(1)
usr.overlays+="ka2"
spawn(2)
usr.overlays-="ka2"
spawn(1)
usr.overlays+="ka3"
spawn(2)
usr.overlays-="ka3"
spawn(1)
usr.overlays+="ka4"
spawn(2)
usr.overlays-="ka4"
spawn(1)
usr.overlays+="ka5"
spawn(5)
usr.overlays-="ka5"'


but the "ka5" wont leave, and when this happens even though they are all overlays the usr mob will still dissapear like when i was using flick, sorry for the ba grammer its 2:11 am and im gettin kinda tired
In response to Jotdaniel
Jotdaniel wrote:
ok heres what i have now,
usr.overlays+="ka1"
spawn(2)
usr.overlays-="ka1"
spawn(1)
usr.overlays+="ka2"
spawn(2)
usr.overlays-="ka2"
spawn(1)
usr.overlays+="ka3"
spawn(2)
usr.overlays-="ka3"
spawn(1)
usr.overlays+="ka4"
spawn(2)
usr.overlays-="ka4"
spawn(1)
usr.overlays+="ka5"
spawn(5)
usr.overlays-="ka5"'


but the "ka5" wont leave, and when this happens even though they are all overlays the usr mob will still dissapear like when i was using flick, sorry for the ba grammer its 2:11 am and im gettin kinda tired

Didnt read any of this but just a note : To remove all overlays you can do this : usr.overlays.Cut() (Look up Cut)
Also make sure your not using usr in the wrong spot.

Alathon
Another way to do this is to create a blank obj over the target and flick the animation on it. I'll include a snippet here, but since you already have Lexy's method working, I wouldn't worry about using this method. Consider it an alternative for future reference.

// create a new object at victim loc
var/obj/O = new(victim.loc)
// move obj over the victim
O.layer = FLY_LAYER
// show the star with animation
flick('star.dmi',O)
// and remove it after 5 ticks
spawn(5) del(O)

There is an added complication of keeping the animation over top of a moving target. For short animations it shouldn't be too bad.
In response to Jotdaniel
Are your overlays actually transparent in places??
In response to Jotdaniel
Jotdaniel wrote:
ok heres what i have now,
usr.overlays+="ka1"
spawn(2)
usr.overlays-="ka1"
spawn(1)
usr.overlays+="ka2"
spawn(2)
usr.overlays-="ka2"
spawn(1)
usr.overlays+="ka3"
spawn(2)
usr.overlays-="ka3"
spawn(1)
usr.overlays+="ka4"
spawn(2)
usr.overlays-="ka4"
spawn(1)
usr.overlays+="ka5"
spawn(5)
usr.overlays-="ka5"'


but the "ka5" wont leave, and when this happens even though they are all overlays the usr mob will still dissapear like when i was using flick, sorry for the ba grammer its 2:11 am and im gettin kinda tired

Change spawn() to sleep(). Spawn only delays lines that are indented below. In your above code, all of the lines process one after the other in quick succession, which is why you just see the last icon in the series. Your spawn() lines are just spawning null procs.

You could actually do this two different ways:

usr.overlays+="ka1"
spawn(2)
usr.overlays-="ka1"
spawn(1)
usr.overlays+="ka2"
spawn(2)
usr.overlays-="ka2"

or just:
usr.overlays+="ka1"
sleep(2)
usr.overlays-="ka1"
sleep(1)
usr.overlays+="ka2"
sleep(2)
usr.overlays-="ka2"

Quick tip: if the next line isn't indented (or unless you have the spawned statement on the same line), it's just not doing anything useful.

And by the way, why do you lay each overlay twice? That sure seems pointless to me