I have a quick and dirty interim way to implement this.
In Mob::CreateHPPacket(), mob.cpp, about line 688:
Code:
else
{
if(IsNPC() && IsEngaged())
parse->Event(EVENT_HP, GetNPCTypeID(), NULL, CastToNPC(), CastToMob());
ds->cur_hp=IsNPC()?(sint32)GetHPRatio():cur_hp;
ds->max_hp=100;
}
In PerlembParser::Event(), embparser.cpp, about line 184:
Code:
break;
}
case EVENT_HP: {
SendCommands(packagename.c_str(), "EVENT_HP", npcid,
npcmob, mob);
}
default: {
event_codes.h, add:
(imho would look better with enums in here)
You should now be able to make an EVENT_HP sub in your script. You can use the code Monrezz supplied to get access to mob HP, and possibly create another variable (ie: mobHPpercent). The problem with this implementation is that it is (possibly) invoked every time HP updates happen, which is very frequently -- however, I'll note that it didn't affect my load noticeably. I really can't see this being implemented in a way other than using a timer, and calling EVENT_HP sub on engaged mobs, so hopefully this won't be too far off.