ID:139396
 
Code:
mob
proc
UpdateHP1()
if(src.Pokemons)
var/HP
var/mob/M
HP=round(M.HP/M.MaxHP*100)/10
if(src.Pokemons.len==1)
M=src
for(var/obj/HUD/HPBar/HP1/o in src.client.screen)
o.icon_state=num2text(HP)
spawn(10)
src.UpdateHP1()
UpdateFH1()
if(src.Pokemons)
var/mob/M
if(src.Pokemons.len==1)
M=src
var/obj/HUD/FaceHolder1/FH1
FH1=new(M.icon,M.icon_state)
src.client.screen+=FH1
spawn(10)
src.UpdateFH1()
Update()
src.UpdateFH1()
src.UpdateHP1()


Problem description:

This don't update HP Bar or put icon_state of pokemon on HUD
Try using a Bar control, included in the new interface system integrated with BYOND 4.0.

Here is an example of how to update the value of a Bar control.

winset(src,"default.bar1","value=[round(src.hp / src.mhp * 100,1)]")


As for the Pokemon problem. Their is also a way to fix this with the interface. By using label's.
Let's say you created a label called "label1".

var
icon
pokeicon = new(icon='pokemon.dmi',icon_state="pokestate")

//Once you update or whatever. Use this to display the pokemon on the label.

var/F = fcopy_rsc(pokeicon)
winset(usr,"default.label1","image=\ref[F]")


Hope this helped ya.

PS: Don't forget to switch the "usr" in winset to a "src" if it's included into a procedure (proc).
In response to Gizhy
I asked How to get where pokemon is located in list
In response to Hassanjalil
Check out the list.Find() function.