ID:139055
 
Code:
var/tmp/obj/attack/ThunderBolt/tbolt = new()
tbolt.icon_state = "spell"
target.overlays += tbolt
sleep(10)
target.overlays -= tbolt
del(tbolt)


Problem description:
First problem is, this overlays my icon (an animated bolt of lightning) onto my target but with no animation, just the last frame is displayed. I've set the animation to play once. I've tried to use flick but for some reason flick("spell",tbolt) doesn't produce any icon. The icon by the way is 51x250 pixels.

Second problem is when I change my code to:
var/tmp/obj/attack/ThunderBolt/tbolt = new()
tbolt.icon_state = "spell"
tbolt.Move(target)
sleep(10)
del(tbolt)

... The animation plays correctly but the icon now randomly shows up in any grid control, there is no other code that would cause the grid to update. I have an inventory and a belt both are grids and randomly whenever I launch my tbolt attack, the icon is displayed in the grid aswell as on the desired location. It's as if I've Move()d the obj into my inventory.

Target by the way is whatever the mouse is hovering over as to cast a spell I use macros, I get the location using:
client
MouseEntered(object,location,control,params)
usr.lasttarget = location


Any ideas?

I changed my code in my mouse proc:

client
MouseEntered(object,location,control,params)
usr.lasttarget = object


now this works:
var/tmp/obj/attack/ThunderBolt/tbolt = new()
tbolt.icon_state = "spell"
target.overlays += tbolt
sleep(10)
target.overlays -= tbolt
del(tbolt)


This now gets the animation to play as an overlay over mobs and objs, however annoyingly not over turfs. Any ideas greatly appreciated!

Thanks :D
In response to Farkas
Turfs don't have a client.
In response to Lugia319
Thanks, I changed it to

atom/MouseEntered()
usr.lasttarget = src


but it still had the same effect.

EDIT

I just tried the same code with a 32x32 icon and it worked. So I'm guessing turfs can't have overlays bigger than 32x32 pixels?
In response to Farkas
You do not want to define it for all atoms as it will bog up your computer.

Could you explain what you wish to accomplish in more clear detail please?
In response to Luna Eclipse
EDIT

Completely didn't explain any kind of problem, I apologise and blame it of course, on lack of sleep!

Explanation of what I'm trying to do, create an overlay over my target to show they are being struck by a spell. Problem: large icons do not show their full animation when overlaid on turfs, rather they only show the last state. However when overlaid on mobs or objs, the animation is played from start to finish.

So, when testing with icons of 32x32 or 64x64, the full animation plays when a spell is cast. When my desired icon is tested, 51x250 pixels, the last state is shown as above.

Is this a bug in BYOND or is there something I can do to rectify this? Or a possible workaround?

Thanks.