Merry Christmas, this works 100%, if the NPC is at 1 health it will hit for 0, keep that in mind.
I fixed your issue, shouting the target doesn't return the target's name, also, re-defining things is unnecessary the way you did it.
Also, I put in 'int' in order to keep you from hitting for decimals and keep the health from becoming decimals.
Code:
sub EVENT_SPELL_EFFECT_CLIENT
{
my $client = $entity_list->GetClientByID($caster_id);
if($client->GetTarget()->IsNPC())
{
TESTLIFETAP();
}
}
sub TESTLIFETAP
{
my $client = $entity_list->GetClientByID($caster_id);
if($client->GetTarget()->GetHP() >= 500)
{
$client->GetTarget()->SetHP(int($client->GetTarget()->GetHP() - 500));
$client->Emote("hit " . $client->GetTarget()->GetCleanName() . " for " . int($client->GetTarget()->GetHP() - 500) . " points of non-melee damage.");
}
elsif($client->GetTarget()->GetHP() < 500)
{
$client->GetTarget()->SetHP(int($client->GetTarget()->GetHP() - ($client->GetTarget()->GetHP() * .25)));
$client->Emote("hit " . $client->GetTarget()->GetCleanName() . " for " . int($client->GetTarget()->GetHP() - ($client->GetTarget()->GetHP() * .25)) . " points of non-melee damage.");
}
}