I'm trying this script I found in herc, it's an hp system for monster, the script below is a test on a monster Poporing, but my intention is to let only all mvps appear on that bar when they attack them.
Screenshots
Error
script error on npc/custom/hpbar.txt line 9
parse_callfunc: expected ')' to close argument list
4 : {
5 : .HP_Bar = 1;
6 : .mobGID = monster ("payon",148,226,"[T] HP Test",POPORING,1,strnpcinfo(0)+"::OnDie");
7 : setunitdata .mobGID,UDT_MAXHP,4000;
8 : setunitdata .mobGID,UDT_HP,4000;
* 9 : .@count = getunits(BL_PC, .@units',' false, "payon");
10 : for (.@i = 0; .@i < .@count; .@i++)
11 : addtimer(0,strnpcinfo(0)+"::OnHPBar", .@units[.@i]);
12 : }
13 : end;
14 :
Script
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_hpbar", 1);
sleep2 5000; //Delay to hide HP Bar
cutin("", 255);
end;
}