ID:171491
 
It goes through the loops just fine, its just when i log out then back in, it leaves a trace star that won't disappear.

mob/var/obj/GM_Star // to keep track of the object.

mob/Login()
..()
loc = locate(4,4,1)
if(usr.key=="ElderKain")
usr.GM_Star = new /obj/GM/Star // create a new instance of it.
spawn() usr.gmoverlay() // kick off the loop.
src.overlays -= GM_Star

mob/Logout()
src.overlays -= src.GM_Star
del(src.GM_Star) // remove the star when you log out.
..()


obj/GM/Star
icon='turfs.dmi';icon_state="star";layer=MOB_LAYER;density=0 // we only need one.

mob/proc/gmoverlay()
src.overlays -= GM_Star // remove the star.
src.GM_Star.pixel_y=32 // adjust the offsets.
src.GM_Star.pixel_x=0
src.overlays += GM_Star // add the star again.
sleep(1) // wait 1 tick and do it again for the new position.

src.overlays -= GM_Star
src.GM_Star.pixel_y=32
src.GM_Star.pixel_x=32
src.overlays += GM_Star
sleep(1)

src.overlays -= GM_Star
src.GM_Star.pixel_y=0
src.GM_Star.pixel_x=32
src.overlays -= GM_Star
sleep(1)

src.overlays -= GM_Star
src.GM_Star.pixel_y=-32
src.GM_Star.pixel_x=32
src.overlays += GM_Star
sleep(1)

src.overlays -= GM_Star
src.GM_Star.pixel_y=-32
src.GM_Star.pixel_x=0
src.overlays += GM_Star
sleep(1)

src.overlays -= GM_Star
src.GM_Star.pixel_y=-32
src.GM_Star.pixel_x=-32
src.overlays += GM_Star
sleep(1)

src.overlays -= GM_Star
src.GM_Star.pixel_y=0
src.GM_Star.pixel_x=-32
src.overlays += GM_Star
sleep(1)

src.overlays -= GM_Star
src.GM_Star.pixel_y=32
src.GM_Star.pixel_x=-32
src.overlays += GM_Star
sleep(1)

spawn() usr.gmoverlay() // call the proc again to make the start go around agan.
Don't use usr in procs.
In response to Garthor
Garthor wrote:
Don't use usr in procs.

I desided just to make it where it the icon was animated and went around the character automaticly on login.

so this is what i'm using now, and it works just fine.
mob/Login()
loc = locate(4,4,1)
if(usr.key=="ElderKain")
usr.overlays += new /obj/GM/StarN
usr.overlays += new /obj/GM/StarNE
usr.overlays += new /obj/GM/StarE
usr.overlays += new /obj/GM/StarSE
usr.overlays += new /obj/GM/StarS
usr.overlays += new /obj/GM/StarSW
usr.overlays += new /obj/GM/StarW
usr.overlays += new /obj/GM/StarNW

obj
GM/StarN
icon='star.dmi';icon_state="2";layer=MOB_LAYER+4;density=0
New()
pixel_y=32
GM/StarNE
icon='star.dmi';icon_state="3";layer=MOB_LAYER+4;density=0
New()
pixel_y=32;pixel_x=32
GM/StarE
icon='star.dmi';icon_state="6";layer=MOB_LAYER+4;density=0
New()
pixel_x=32
GM/StarSE
icon='star.dmi';icon_state="9";layer=MOB_LAYER+4;density=0
New()
pixel_x=32;pixel_y=-32
GM/StarS
icon='star.dmi';icon_state="8";layer=MOB_LAYER+4;density=0
New()
pixel_y=-32
GM/StarSW
icon='star.dmi';icon_state="7";layer=MOB_LAYER+4;density=0
New()
pixel_y=-32;pixel_x=-32
GM/StarW
icon='star.dmi';icon_state="4";layer=MOB_LAYER+4;density=0
New()
pixel_x=-32
GM/StarNW
icon='star.dmi';icon_state="1";layer=MOB_LAYER+4;density=0
New()
pixel_x=-32;pixel_y=32