Custom Unit HP Bar System

luizragna

New member
Messages
114
Points
0
Location
In their hearts
Emulator
Hello guys, i'm making a custom hp bar system for mob units.

The command show the HP of the mob for all players in the map.

I am using the cutin command, the problem is that I do not think so many files are necessary. In the case 1 image for each percentage of hp I would like your opnion and help to improve this system and make it lighter.

Test yourselves :).

HP Bar System:

payon,147,229,4 script Test#HPbar 1_F_MARIA,{

if (.HP_Bar == 0)
{
.HP_Bar = 1;
.mobGID = monster ("payon",148,226,"[T] HP Test",POPORING,1,strnpcinfo(0)+"::OnDie");
setunitdata .mobGID,UDT_MAXHP,4000;
setunitdata .mobGID,UDT_HP,4000;
.@count = getunits(BL_PC, .@units, false, "payon");
for (.@i = 0; .@i < .@count; .@i++)
addtimer(0,strnpcinfo(0)+"::OnHPBar", .@units[.@i]);
}
end;

OnDie:
.HP_Bar = 0;
end;

OnHPBar:
.U_MAXHP = getunitdata (.mobGID,UDT_MAXHP);
while (.HP_Bar != 0)
{
.U_HP = getunitdata (.mobGID,UDT_HP);
.P_HP = (.U_HP*100)/.U_MAXHP;

cutin(""+.P_HP+"", 1);

sleep2 100;
}
cutin("0", 1);
sleep2 5000; //Delay to hide HP Bar
cutin("", 255);
end;

}




screenHercules021.jpg

screenHercules022.jpg

screenHercules023.jpg

screenHercules024.jpg

screenHercules025.jpg

screenHercules026.jpg

Print.png

Donwload of the data folder files: View attachment HP Bar System (2018-06-26).rar

 
Last edited by a moderator:
Very nice, but I think it would be annoying to do that for every single mob?

Could be a nice feature for Boss mobs though. 

 
There is a small problem some clients cant display it if inside a folder inside /illust

But works good if  directly inside /illust

My client won't

ex:  /illust/hpbar/0.bmp [won't work]

ex: /illust/0_hpbar.bmp [Works]

 
There is a small problem some clients cant display it if inside a folder inside /illust

But works good if  directly inside /illust

My client won't

ex:  /illust/hpbar/0.bmp [won't work]

ex: /illust/0_hpbar.bmp [Works]
Yes, the illust folder don't like subfolders

I improved the topic to avoid problems

 
Last edited by a moderator:
Strange, does some error appear somewhere?
Loading NPC file: npc/cities/limitless.txt[K [1m[31m[Error][0m: [?5h                                                                                                                                                                                                                                                                                                                                                                                                                                          [?5lscript error in file 'npc/cities/limitless.txt' line 204 column 4

    parse_line: expect command, missing function name or calling undeclared function
   201:         {
   202:                 .HP_Bar = 1;
   203:                 .mobGID = monster ("payon",148,226,"[T] HP Test",POPORING,1,strnpcinfo(0)+"::OnDie");
*  204:                         [1m[31ms[0metunitdata .mobGID,UDT_MAXHP,4000;
        [1m[36m~~~~~~~~~~~~~~~~~~~~~~~~[0m[1m[32m^[0m
   205:                         setunitdata .mobGID,UDT_HP,4000;
   206:                 .@count = getunits(BL_PC, .@units, false, "payon");
   207:                 for (.@i = 0; .@i < .@count; .@i++)
 
Last edited by a moderator:
Update your Hercules?

 
Back
Top