Try below script:
payon,131,232,4 script Goddess Elia 624,{
OnTimer1600:
callfunc "regen", 1;
initnpctimer;
end;
OnInit:
initnpctimer;
end;
}
payon,128,232,4 script Bard Mikhael 647,{
OnTimer20000:
callfunc "regen", 0;
initnpctimer;
end;
OnInit:
initnpctimer;
end;
}
function script regen {
.@type = getarg(0, 0); // 0 - low | 1 - high
.@range = 20;
.@percent = !.@type ? 1 : 8;
getmapxy .@map$, .@x, .@y, BL_NPC, strnpcinfo(1);
specialeffect 514;
specialeffect 796;
specialeffect 800;
.@size = getareaunits(BL_PC, .@map$, (.@x - (.@range + 3)), .@y - .@range, (.@x + (.@range + 3)), .@y + .@range, .@aid);
if (.@size > 0) {
for (.@i = 0; .@i < .@size; .@i++) {
if (attachrid(.@aid[.@i])) {
if (Hp && (Hp != MaxHp)) {
specialeffect2 312;
percentheal .@percent, .@percent;
}
detachrid;
}
}
}
return;
}
Same result but I removed unnecessary executions