ID:459937
 
Code:
obj/Skills/Substitute
icon='Test.dmi'
icon_state="b"
mouse_drag_pointer="b"
layer=91
proc
Tech(mob/M)
set popup_menu = 0
src=M

M.invisibility = 101

var/mob/Clone/MM = new()//creates a clone of the user
MM.owner = M
MM.icon = M.icon
MM.icon_state = M.icon_state
MM.overlays += M.overlays.Copy()
MM.underlays += M.underlays.Copy()
MM.loc = M.loc
MM.health = infinite

sleep(55)//time for player to run around invisible

flick(/obj/smoke,MM)//flick smoke on the clone to see hes disappearing
sleep(3)
var/obj/Log/L = new(MM.loc)//create a log in its place so they know theyve been fooled
del(MM)

spawn(30)
flick(/obj/smoke,L)//when thats complete, in 30 ticks delete the log
sleep(3)
del(L)

M.subon = 0
flick(/obj/smoke,M)//poof of smoke at the users real location to show hes visible again.
M.invisibility = 0


Problem description:

When the skill is used, flick() goes off at the very start where the clone is created. I don't want this.. I only want it to do that after the sleep is completed. I have no idea why its doing this. flick() is after sleep after-all?
So, I guess its something else causing this problem.
Maybe instead of doing like you have try using an overlay that flicks when created not sure if that would help though.
obj/smoke
icon = 'smoke.dmi'

New()
..()
flick("smoke", src)
del(src)


obj/Skills/Substitute
icon='Test.dmi'
icon_state="b"
mouse_drag_pointer="b"
layer=91
proc
Tech(mob/M)
set popup_menu = 0
src=M

M.invisibility = 101

var/mob/Clone/MM = new()//creates a clone of the user
MM.owner = M
MM.icon = M.icon
MM.icon_state = M.icon_state
MM.overlays += M.overlays.Copy()
MM.underlays += M.underlays.Copy()
MM.loc = M.loc
MM.health = infinite

sleep(55)//time for player to run around invisible

MM.overlays += new/obj/smoke//flick smoke on the clone to see hes disappearing
sleep(3)
var/obj/Log/L = new(MM.loc)//create a log in its place so they know theyve been fooled
del(MM)

spawn(30)
L.overlays += new/obj/smoke//when thats complete, in 30 ticks delete the log
sleep(3)
del(L)

M.subon = 0
M.overlays += new/obj/smoke//poof of smoke at the users real location to show hes visible again.
M.invisibility = 0

I thought maybe something like this.
Tried it out, but i get the exact same problem. I'm unsure xD
try this quick and tell me what happens. replace
            spawn(30)
L.overlays += new/obj/smoke//when thats complete, in 30 ticks delete the log
sleep(3)
del(L)

with
            sleep(30)
L.overlays += new/obj/smoke//when thats complete, in 30 ticks delete the log
sleep(3)
del(L)

Same deal.
Hmm I'm really not to sure then other then making sure you have all the right icon_states.
I figured it out, Elsewhere in my game I have clones of a player on /mob/Clone. They flick the smoke overlay when created. I just had to define something new.

Thanks for your help anyway!
Ah well there you go then and no prob.