runtime error: Cannot read null.screen
proc name: updateHealth (/mob/proc/updateHealth)
usr: Agrey123 (/mob/Game)
src: Agrey123 (/mob/Game)
call stack:
Agrey123 (/mob/Game): updateHealth()
Agrey123 (/mob/Game): updateHealth()
mob
proc
updateHealth()
var/percent=round(src.Health/src.Mhealth*100,10)
if(percent>100) percent=100
if(percent<0) percent=0
for(var/obj/hudMeters/o in src.client.screen)
o.icon_state=num2text(percent)
spawn(10)
src.updateHealth()
verb
add()
src.Health+=rand(5,15)
src<<"[src.Health]/[src.Mhealth]"
sub()
src.Health-=rand(5,15)
src<<"[src.Health]/[src.Mhealth]"
Game/Login()
new/obj/hudMeters/health_01(src.client)
new/obj/hudMeters/health_02(src.client)
src.updateHealth()
usr.loc=locate(1,1,1)
var/mob/new_mob
new_mob = new/mob/character()
src.client.mob = new_mob
var/obj/Zampakto/R = new/obj/Zampakto
R.loc=usr
Problem description:
Any solutions :(
In this case, you have a for loop which loops through src.client.screen. This is all fine and dandy -- except in your case there is no client.
You're also using a bad habit here: instead of calling the proc over and over, you might as well use a while loop.
-- Data