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;
}
Donwload of the data folder files: HP Bar System (2018-06-26).rar