ID:149467
 
I just updated to 322 and now my code doesnt do the same thing as it used to. My images do not follow the player, my weapons no longer de-equip, and I have only been using for less than five minutes, so I do not know what else is not right. This is the code that I have noticed so far that does not work right. This is some of the code that does not work

mob/proc
if(istype(O,/obj/weapon))
if(O.loc=="Equipped")//allready equipped
contents+=new O.type
min_dam=0;max_dam=0
del(O)
else
right_hand=new O.type//equip
min_dam=O.min_dam;max_dam=O.max_dam
del(O)
When it is equipped the obj does not del and it does not make a new one in contents.

and another:


mob/proc/meter_update()
del(usr.hp_meter1)
del(usr.hp_meter2)
del(usr.hp_meter3)
del(usr.hp_meter4)
del(usr.hp_meter5)
del(usr.hp_meter6)
h_meter_1.dmi',locate(usr.x-5,usr.y-3,usr.z),"[round(usr.hp/ usr.maxhp*40)]",MOB_LAYER+2)
h_meter_2.dmi',locate(usr.x-4,usr.y-3,usr.z),"[round(usr.hp/ usr.maxhp*40)]",MOB_LAYER+2)
h_meter_3.dmi',locate(usr.x-5,usr.y-4,usr.z),"[round(usr.hp/ usr.maxhp*40)]",MOB_LAYER+2)
h_meter_4.dmi',locate(usr.x-4,usr.y-4,usr.z),"[round(usr.hp/ usr.maxhp*40)]",MOB_LAYER+2)
usr.hp_meter5=image('health_meter_5.dmi',locate(usr.x-5,usr. y-5,usr.z),"1",MOB_LAYER+2)
usr.hp_meter6=image('health_meter_5.dmi',locate(usr.x-4,usr. y-5,usr.z),"2",MOB_LAYER+2)
usr<<hp_meter1
usr<<hp_meter2
usr<<hp_meter3
usr<<hp_meter4
usr<<hp_meter5
usr<<hp_meter6

BTW, that is my on screen hp meter code, the hp meter is supposed to make the meter in the lower left corner, then it is supposed to follow the player in the lower left corner, but it stay in the spot it is made and does not follow the player.

If anyone can tell me why that works in the older versions but not in the newer version I would be most appreciative.</<hp_meter1></<hp_meter4>< ;/<hp_meter3></<hp_meter5>
</<hp_meter6></<hp_meter2>
I'm pretty certain that the fact that your code worked correctly before was due to a bug in BYOND that the latest version fixed. Attaching an image to an object or location should NOT follow the player, unless you attach it to the player's mob itself. In fact, several people complained about this bug. Unfortunately, you now have code that depends on the bug to work.

The way to fix it is to use obj.screen_loc and client.screen to make any on-screen objects (HUD). It's actually very flexible for this kind of thing.


In response to Skysaw
I did attach it to the player, the image's loc is the usr's coordinates minus a few to get it in the corner. Anyway, thank you for the help, I will look those things up.
In response to Loduwijk
Loduwijk wrote:
I did attach it to the player, the image's loc is the usr's coordinates minus a few to get it in the corner. Anyway, thank you for the help, I will look those things up.

No, you attached it to the player's location... completely different.

It's like the difference between saying

"I'm going to give you a dollar."

and

"I'm going to give a dollar to that rug you're standing on."
In response to Skysaw
Yes, you're right, thanks for pointing that out.