ID:263178
 
Code:
mob
var
targetlist = ""
mob
Click(mob/M)
if(istype(M,/mob))
if(usr.Target == 1)
for(M in usr.targetlist)
M.overlays -= /obj/Target
usr.targetlist -= M
usr.Target = 0
if(usr.Target == 0)
usr.targetlist+=M
M+=/obj/Target
usr.Target = 1


Problem description:
The mobs will not get an overlay, and they are not added to the variable targetlist.

No overlay is being added to the mob, because you don't have any such statement anywhere in that code. All you have that has to do with overlays is "M.overlays -= /obj/Target".

As for your problem with targetlist... it's not a list, it's text. You need to define that variable as a list if you want to treat it as a list:
mob
var
list/targetlist = new /list()
mob
Click(mob/M)
if(istype(M,/mob))
if(usr.Target == 1)
for(M in usr.targetlist)
M.overlays -= /obj/Target
usr.targetlist.Remove(M)
usr.Target = 0
if(usr.Target == 0)
usr.targetlist.Add(M)
M+=/obj/Target
usr.Target = 1
Do you really want all the Players to see the target object on the mob, even if they're not the one targeting the mob? Otherwise, if you want only the mob who targeted the target to see the target object, then read up on client.screen.
In response to Y2kEric
Y2kEric wrote:
Do you really want all the Players to see the target object on the mob, even if they're not the one targeting the mob? Otherwise, if you want only the mob who targeted the target to see the target object, then read up on client.screen.

Hmmm...how would I do that?
mob
var
list/targetlist = new /list()
mob
Click(mob/M)
if(istype(M,/mob))
if(usr.Target == 1)
for(M in usr.targetlist||M in usr.client.screen)
usr.client.screen-=/obj/Target

usr.targetlist.Remove(M)
usr.Target = 0
if(usr.Target == 0)
var/obj/Target/T
usr.targetlist.Add(M)
usr.client.screen+=T
T.screen_loc = M.loc
usr.Target = 1