ID:149679
 
Ok, this code snippet is to make numbers appear, according to a var.
mob/proc
update_hp()
usr.hp_st = num2text(usr.HP)
var/num1 = copytext(usr.hp_st,1,2)
var/num2 = copytext(usr.hp_st,2,3)
var/num3 = copytext(usr.hp_st,3,4)
var/num4 = copytext(usr.hp_st,4,5)
for(var/obj/O in oview(20))
if(istype(O,/obj/numbers/number1/))
O.icon_state = num1
if(istype(O,/obj/numbers/number2/))
O.icon_state = num2
if(istype(O,/obj/numbers/number3/))
O.icon_state = num3
if(istype(O,/obj/numbers/number4/))
O.icon_state = num4
usr << "[num1], [num2], [num3], [num4]"

users hp is 10. It does not change the icon states of O, it displays "1,0,," in the text window, and when i do "in world" instead of oview or view, it works. And the objects are only about 5 tiles away.

Please give me some help! :]

-Rcet
If the number objects you're altering aren't on the map, but have a screen_loc, they won't ever be included in oview(). The way to deal with them would be to loop through client.screen instead.

Beyond that, you shouldn't be using usr in this proc at all. Use src.

Lummox JR
In response to Lummox JR
The objects are on the map, im not using the HUD system. They are just placed on the map, using the map editor.


-Rcet