ID:264224
 
Code:
obj
HP
icon='hpHUD.dmi'
layer=15
screen_loc="1,1"
New(mob/Player)
..()
var/a = round((Player.hp*100)/Player.mhp,10)
icon_state="[a]"


mob
proc
UpdateHP()
if(hp < 0) hp = 0
if(hp > mhp) hp = mhp
for(var/obj/HP/A in client.screen)
var/x = round((hp*100)/mhp,10)
A.icon_state = "[x]"


Problem description:Ok, when i login to my game the HP obj appears in my inventory. Why? and how do i fix it.

I think the "New(mob/Player)" has something to do with it. Just keep those parentheses empty.
try using num2text :\
That's because you're using the player mob as the first argument in new() - if you look it up, it dictates the location of the new atom. Therefore, the obj is created with the player as the location - inside him. To avoid this, either don't use the 1st argument to pass the mob, or pass a non-location value instead - the client of the player immediately comes to mind.