View Single Post
  #3  
Old 12-11-2016, 03:58 PM
Loxo
Fire Beetle
 
Join Date: Jun 2012
Posts: 5
Default

Code:
sub EVENT_SPAWN
{
	$npc->SetAppearance(1);
	my $x = $npc->GetX();
	my $y = $npc->GetY();
	quest::set_proximity($x - 10, $x + 10, $y - 10, $y + 10);
	$x = undef;
	$y = undef;
}

sub EVENT_ENTER 
{
	my $x = $npc->GetX();
	my $y = $npc->GetY();
	$npc->DoAnim(64);
	quest::set_proximity($x - 75, $x + 75, $y - 75, $y + 75);
	quest::follow($userid);
	$x = undef;
	$y = undef;
}

sub EVENT_EXIT 
{
	my $x = $npc->GetX();
	my $y = $npc->GetY();
	quest::set_proximity($x - 10, $x + 10, $y - 10, $y + 10);
	quest::sfollow(); # if we weren't expecting to stop following here we would still use quest::stop(); before sitting.
	quest::doanim(26);
	quest::settimer("sittime", 5);
	$x = undef;
	$y = undef;
}

sub EVENT_TIMER
{
	if ($timer eq "sittime")
	{
		quest::stoptimer("sittime");
		$npc->SetAppearance(1);
	}
}
In Perl this seems to make the npc it's written for sit upon spawning, follow anyone that enters it's proximity, and sit back down and appear to remain seated indefinitely when someone exits. If you've altered the SendAppearance function or any related structs or functions you might need to restore them, I remember trying to alter them also to get this to work, but the stock install seems to work with this script.
Reply With Quote