Hey guys.
I'm trying to make a lifetap proc that does 25% of a target's current HP with a maximum of 500. The problem I'm running into is it seems like the actual script is correct but it's not executing for some reason.
Here's what I did. I copied and existing lifetap spell, and took out the damage, so it is a blank spell. The ID of this blank spell is 8558. I then created a file called 8558 and put it in my global\spells folder. I've done a server restart and countless #reloadqst's and I can spam cast this all day on things and it still doesn't work. Here's the script.
Please note, this is my first attempt to do anything that I deem as non-simple so hopefully you guys wont tear it apart too hard :P
I uploaded a picture as well because the code thing messes up spacing.
Code:
sub EVENT_SPELL_EFFECT_CLIENT {
my $client = $entity_list->GetClientByID($caster_id);
my $ClientTarget = $Client->GetTarget();
if($ClientTarget->IsNPC()) {
TESTLIFETAP();
}
}
sub TESTLIFETAP {
my $client = $entity_list->GetClientByID($caster_id);
my $ClientTarget = $Client->GetTarget();
my $TargetsCurrentHP = $ClientTarget->GetHP();
my $Targets25pctCurrentHP = ($TargetsCurrentHP * 0.25);
if($TargetsCurrentHP >= 500) {
$ClientTarget->SetHP($TargetsCurrentHP - 500);
$client->Emote("hit $ClientTarget for ".($TargetsCurrentHP - 500)." points of non-melee damage.");
}
elsif($TargetsCurrentHP < 500) {
$ClientTarget->SetHP($TargetsCurrentHP - $Targets25pctCurrentHP);
$client->Emote("hit $ClientTarget for ".($TargetsCurrentHP - $Targets25pctCurrentHP)." points of non-melee damage.");
}
}
my $client = $entity_list->GetClientByID($caster_id);
my $ClientTarget = $Client->GetTarget();
if($TargetsCurrentHP >= 500) {
$ClientTarget->SetHP($TargetsCurrentHP - 500);
$client->Emote("hit $ClientTarget for ".($TargetsCurrentHP - 500)." points of non-melee damage.");
}
elsif($TargetsCurrentHP < 500) {
$ClientTarget->SetHP($TargetsCurrentHP - $Targets25pctCurrentHP);
$client->Emote("hit $ClientTarget for ".($TargetsCurrentHP - $Targets25pctCurrentHP)." points of non-melee damage.");
}
}