ID:148312
 
Its a Hud, its suppost to change if theres a mob in the view of the person, But it doesnt, so there must be somthing im doing wrong. Does any one know?

proc
Update_Enemy(mob/M as mob)
for(var/obj/Enemy/C in M.client.screen)
C.icon_state="1"
for(var/mob/L in world)
for(L in view())
if(M == L) return
if(L)
C.icon_state="2"
else
C.icon_state="1"
proc
Update_Enemy(mob/M as mob)
for(var/obj/Enemy/C in M.client.screen)
for(L in view(M))
if(M == L) return
if(L)
C.icon_state="2"
else
C.icon_state="1"



That might fix it, though I don't know what L is. Also I deleted C.icon_state="1" because if this is something that is constantly updated, your going to get it switching back and fourth between icon_states if L is true.
Wanabe wrote:
if(L)
C.icon_state="2"
else
C.icon_state="1"

That if() is a little troubling. L will always be non-null during the loop, so the C.icon_state="1" line will never even be run. Instead I'd try this:
L = locate() in view(M)    // I assume L has a type like /mob/monster
C.icon_state = L ? "2" : "1"
That should do the trick, no for(L ...) loop required.

Lummox JR