ID:263727
 
Code:
client/Click(mob/O)
//if they already have a target, remove that target.
if(usr.target != "")
O.overlays -= image('target.dmi')
usr.target=""

//if what they clicked is a mob
if(istype(O,/mob/))
//if they clicked themselves
if(O == usr)
world<<"Coo coo cachu!"
//Otherwise, set the mob to the persons target
else
world<<"Moo!"
O.overlays += image('target.dmi')
usr.target=O
world<<"[usr.target]"

//if they clicked an object, let them know. And target it.
if(istype(O,/obj/))
world<<"LOL!"
O.overlays += image('target.dmi', icon_state="object")


Problem description:
If you have something targeted, and then you decide to target something else, the previous target still has the target icon overtop of it.
change O.overlays -= image('target.dmi') to usr.target.overlays -= image('target.dmi')

You are just subtracting from the current target, not the old target.
In response to Ter13
Ter13 wrote:
change O.overlays -= image('target.dmi') to usr.target.overlays -= image('target.dmi')

You are just subtracting from the current target, not the old target.

I'm sorry, but I don't understand. Target is just a variable I am using to specify the target, so as the player would automatically follow said target if they wished
In response to Dead_Demon
yes, and target = the person theyre following
so usr.target.overlays-=overlay would take the overlay off the person theyre folowing
In response to Falacy
He might also have to typecast the target variable at a movable atom in order to subtract the overlay, unless of course, he already has defined the variable as a movable.

Either way, it's pretty simple.