View Single Post
  #2  
Old 07-27-2009, 06:46 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

In this thread, Justsomeguy shows how to use quest::moveto and save the new WP after each move fairly easily:

http://www.eqemulator.net/forums/sho...329#post175329


As long as you have this in your script, it will save every WP it gets to as long as the NPC isn't already using a grid:

Code:
sub EVENT_WAYPOINT {

  $npc->SaveGuardSpot(0);

}
If your NPC is already on a grid, you can just have them do a quest::stop() to make them leave the grid, and you can add a $npc->SaveGuardSpot(0) in after the stop so it will stay at it's current position. Then, if you want to have say messages trigger at certain WPs, you can just use variable settings after you do your moveto command and then set the say message to happen when EVENT_WAYPOINT is triggered if that certain variable is currently set. Something like this:

Code:
my $Destination = "None";

sub EVENT_SAY {

	if ($text=~/hail/i) {
		quest::say("I can [move] if I am in your way.");
	}

	if ($text=~/move/i) {
		#Moves and sets a variable for the waypoint
		quest::say("Very well.");
		quest::moveto(100, 200, 300);
		$Destination = "RoomB"; #Naming this makes it easy to know which point you are dealing with if you have many.
		quest::stop(); #only required if the NPC is already on a grid
	}
}

sub EVENT_WAYPOINT {

$npc->SaveGuardSpot(0);	#this is so npcs don't not walk to waypoint and return immediately

	if($Destination eq "RoomB") {	#NPC Has Moved
		quest::say("That move went well enough.");
	}
}
This way isn't too overly complex and you don't need to use timers for say messages unless you want the NPC to say something sometime after it arrives at it's destination.

I do agree that the stop option should definitely be added to the moveto quest command. It would have saved me a bit of work on a script I am currently working on that has quite a bit of moving around in it. Heading probably wouldn't be a bad thing to have as an option either. I might try to look into adding these features if I get some time soon. For now, the above method works pretty well.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote