Log in

View Full Version : GetLevel() of target in perl?


Bytebait
03-14-2021, 10:59 PM
How can I get the target of a NPC/MOB that isn't in combat, only targeted by the client? I see how to grab the entity on a hate list but not while out of combat.

I would like to make an item that 'warns' the player how deep into red an encounter is.

something like so. But I don't know what $targeted is.

sub EVENT_ITEM_CLICK{

$mob_level = $targeted->GetLevel();
$client->Message(15, "The mob is level " + $mob_level + " .");

}

Splose
03-15-2021, 01:30 AM
How can I get the target of a NPC/MOB that isn't in combat, only targeted by the client? I see how to grab the entity on a hate list but not while out of combat.

I would like to make an item that 'warns' the player how deep into red an encounter is.

something like so. But I don't know what $targeted is.

sub EVENT_ITEM_CLICK{

$mob_level = $targeted->GetLevel();
$client->Message(15, "The mob is level " + $mob_level + " .");

}



my $target = $client->GetTarget();
my $target_level = $target->GetLevel();


You also need to make sure that you have the item connected to a script.

Bytebait
03-15-2021, 01:28 PM
my $target = $client->GetTarget();
my $target_level = $target->GetLevel();


You also need to make sure that you have the item connected to a script.

Right on! That worked. Thank you.