Loading...   


sub CheckDist{
	$npc = plugin::val('$npc');
	$ent = $_[0];
	$dist = $_[1];
	if((abs($ent->GetX() - $npc->GetX()) <= $dist) && (abs($ent->GetY() - $npc->GetY()) <= $dist)){ return 1; } else{ return; }
}


### Code

my $n = $entity_list->GetNPCByNPCTypeID(10000); # Grab the entity variable by NPC ID
if(plugin::CheckDist($n, 50)){ #::: Check if NPC is within 50 units
	quest::shout("Hey " . $n->GetCleanName() . " wassup!");
}
else{
	quest::shout("Hey " . $n->GetCleanName() . " get over here yo!");
}

Raw Paste Data