EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   my $hp? (https://www.eqemulator.org/forums/showthread.php?t=26254)

Neiv 09-21-2008 04:21 PM

my $hp?
 
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:

Code:

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:

Code:

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 : )


All times are GMT -4. The time now is 05:13 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.