PDA

View Full Version : my $hp?


Neiv
09-21-2008, 04:21 PM
I am setting out bots that provide full heals to those who donate plat. I'm using Angelox's buff bot script, which I've modified to include healing only. The script includes a spawn event that sets a proximity. The script triggered by the ENTER event is as follows:

sub EVENT_ENTER
{
$npc->SetAppearance(1);
quest::say("Healer available. I'm inside the gate, near the causeway to the wall.");
}


I would like to make this script trigger only when a player enters the proximity whose health is below, say, 70%. The HP events and functions seem only to apply to npcs and mobs, not players. Nor could I find a quest object that would accomplish this. Is there a variable that would return my current HP in percentage to allow me to do this? Thanks.

trevius
09-21-2008, 04:34 PM
This is a modified version of something I use for a fun encounter I setup recently. It should work for you:

sub EVENT_ENTER {

my $player = $entity_list->GetClientByID($userid);
my $get_player = $player->CastToClient();
my $player_hps = $get_player->GetHPRatio();

if ($player_hps <= 70) {
$npc->SetAppearance(1);
quest::say("Healer available. I'm inside the gate, near the causeway to the wall.");
}
}

Neiv
09-21-2008, 05:38 PM
That works perfectly; thanks Trevius : )