Thanks so much! That did the trick. I completely missed the plugins:
plugin::CheckDist(entity, distance);
plugin::CheckDistBetween2Ents(entity1, entity2, distance);
The code for the spawned adds now works as intended:
Code:
sub EVENT_AGGRO {
quest::shout("$name!!!"); #Shouts the name of the player that better start running
quest::settimer("distance", 1);
}
sub EVENT_TIMER {
if ($timer eq "distance") {
my $target = $npc->GetTarget();
if(plugin::CheckDist($target, 21)) {
$npc->SpellFinished(732, $target,0); #cast Ice Comet on target if it is within 21 units of distance
quest::depop();
}
}
}