Quote:
Originally Posted by Huppy
I almost forgot about another question I had regarding this follow thing and wondering if an idea I had was possible.
For example, NPC starts following player, but then the player is moving too fast, creating a big distance between them.
Is there a way to set an "sfollow" when a certain distance happens ? Like if the player gets too far away, the NPC quits ?
|
You could set a timer when you initiate the follow, then use an event timer like:
Code:
sub EVENT_TIMER
{
if ($npc->CalculateDistance($entity_list->GetClientByCharID($npc->GetEntityVariable("master"))->GetX(),
$entity_list->GetClientByCharID($npc->GetEntityVariable("master"))->GetY(),
$entity_list->GetClientByCharID($npc->GetEntityVariable("master"))->GetZ()) > 20)
{
quest::sfollow();
}
}
This assumes you replaced $entity in the code earlier posted with $npc.