Rename()
var/hehe = input(usr,"What will you call this pokemon?")as text
var/mob/M = src.Capture
if(!M.client)
for(var/mob/O in src.contents)
O.name = hehe
src.name = "Pokeball [hehe]"
Problem description:It doesn't ask me to rename the pokemon.
Code:
mob
proc
updateHealth()
var/percent=round(src.hp/src.maxhp*100,5)
if(percent>100) percent=100
if(percent<0) percent=0
if(src.client.screen)//the check doesn't work
for(var/obj/hudMeters/o in src.client.screen)
o.icon_state=num2text(percent)
spawn(10)
src.updateHealth()
Problem description:When i send the pokemon out or in the pokeball i get a runtime error:
runtime error: Cannot read null.screen
proc name: updateHealth (/mob/proc/updateHealth)
source file: Hpbar.dm,8
usr: the dgf (/mob/player)
src: Wild Chikorita (/mob/enemy/Chikorita)
call stack:
Wild Chikorita (/mob/enemy/Chikorita): updateHealth()
Wild Chikorita (/mob/enemy/Chikorita): updateHealth()
2) You should check if the "src.client" exists, not "src.client.screen".