View Single Post
  #7  
Old 08-05-2009, 07:26 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

EVENT_SPAWN can sometimes be a bit flaky, because it is occurring while somethings are still being set on the spawn itself. For instance, EVENT_SPAWN cannot get the entity ID of the NPC that is being spawned, because it hasn't fully been set yet. At least that is my experience with it.

So, to get around possible issues with that, you could just use a timer like this for your spawned NPCs:

Code:
sub EVENT_SPAWN {
  quest::settimer("follow", 1);
}

sub EVENT_TIMER{
  if ($timer eq "follow"){
    my $OpponentID = 1411;
    my $getmobbynpctype = $entity_list->GetMobByNpcTypeID($OpponentID);
    my $follow_target = $getmobbynpctype->GetID();
    quest::follow($follow_target);
    quest::stoptimer("follow");
  }
}
Let me know if that works for you.

Also, if you are running the latest source code, you can play with the new follow distance setting to adjust how far/close they follow the NPC. Here is an example:

Code:
quest::follow($follow_target, 25);
The default distance is 10, so this would make them follow a bit further away. Not sure if you need this or not for what you are doing, but it definitely helps make the event I am currently working on much better looking
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote