ID:269713
 
mob
character
Normal
icon = 'NK Base.dmi'
density = 1
Click()
for(var/mob/clone/C in oview(src,9))
if(C.owner==usr)
walk_to(C,src,1,5)


So, im using this to make my clone walk to other mobs when i click on that mob. The thing is, if i click myself, it goes to me (obviously, which i dont really want). But the main problem is that im looking for how to make it that when my clone meets that mob, (next to it) it deletes itself (the clone). AZA told me to use
for(var/mob/clone/C in range(1,src))

Obviously after i would use del C. This doesn't seem to work though.

What im asking you is, whats the best way to do this? Please explain how to do this :)

Edit
The reason why the full code:
mob
character
Normal
icon = 'NK Base.dmi'
density = 1
Click()
for(var/mob/clone/C in oview(src,9))
if(C.owner==usr)
walk_to(C,src,1,5)
for(var/mob/clone/N in range(1,src))
N.overlays += 'poofy.dmi'
sleep(10)
del(N)

the for() doesn't activate because of the walk_to proc, because its not ending. How could i go about this?
To kill the clone, ya have to do it when one o' ya moves. Rig up overrides on the rudders an' do yer deletin' there.

Cap'n Lummox JR
In response to Lummox JR
Please, can you write it out properly, i would appreciate it. Thank you. Also could you explain it. :)
He's saying that you should override a proc dealing with either you or the other mob moving, which include Move(), walk_to(), step(), etc...

But, you just basically want a clone to delete itself when it meets te object it moves to? If that is the case,use something like

mob/Click()
for(var/mob/clone/C in oview(usr,9))
if(C.owner==usr)
walk_to(C,src,1,5)
del(C)


That should delete the clone after it stops the proc, but if I were you, I'd make the clone mobs a specific proc that you can call when you click another mob. If you don't and the character has more than one clone, the clones will go to the mob one at a time.

Also, you may want to store text strings that relate t the mob instead of the actual mob and decipher who they are whenever, most easily done with keys.

Also, I just noticed something within your Click() procedure. Click() is a bit different from the other procs. Anyway, down to the point, src in Click() is the atom being clicked. usr is the person performing the click.
In response to CaptFalcon33035
Well, i dont know if i delete my old code. I did, and tried it. Nothing happened. I tried WITH, and it was just like normal, didn't delete.

So i guess that didn't work, maybe i should add a bump() to it to delete?
In response to Dark Shadowss
Dark Shadowss wrote:
Well, i dont know if i delete my old code. I did, and tried it. Nothing happened. I tried WITH, and it was just like normal, didn't delete.

So i guess that didn't work, maybe i should add a bump() to it to delete?

Might be a problem with your owner var, did you make sure that the clone's owner is the player when the clone is created?
In response to Dark Shadowss
I didn't even consider that, that would most likely be the best procedure to take, or at least the easiest.