sub EVENT_SPAWN - Check for clients around npc. Need some help please.
I have an idea on how to buff temporary (swarm) pets based on the user's charisma but it requires that npc to check for the player with a certain item in their inventory && their charisma value.
Just an example below. This quest goes in the folder where that npc resides either templates or the zone folder with its name.pl
sub EVENT_SPAWN
{
my $x;
my $y;
my $z;
my $h;
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
$h = $npc->GetHeading();
quest::set_proximity( $x-6,$x+6,$y-6,$y+6,$z-6,$z+6);
}
sub EVENT_???? (ENTER/EXIT WORK BUT ARE INCONVENIENT)
{
$cha = $client->GetCHA();
my $npcid = $npc->GetID();
if ($cha >= 50 && $cha <= 99 && $hasitem{1384})
{
quest::say("Test");
$npc->CastSpell(777,$npcid);
}
The example above works on proximity tests (EVENT_ENTER/EXIT) but it's annoying as hell since you have to move towards and away from the mob. So, my question to anybody reading this: How would you make an NPC check for the client and these conditions as soon as it's spawned only using sub EVENT_SPAWN?
|