Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Plugins & Mods

Quests::Plugins & Mods Completed plugins for public use as well as modifications.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-07-2010, 04:41 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

You have been submitting plugins like crazy, lol! Gotta love plugins

BTW, you should be able to use guard points for leashing, so you don't need the SetLeashMob plugin at all and can just handle leashing by checking dist from the guardpoints. Also, an IsEngaged check probably wouldn't hurt either.


Here is a simple rewrite (untested!):
Code:
#Usage: plugin::Leash(LeashDist, NoEngageCheck=0);
#Example: plugin::Leash(100);
# This script will check the distance from the NPC's current guard point (spawn or waypoints).
# If they are further away from that point than the specified distance, it returns them to their guard point.
# LeashDist is the max distance an NPC can be before they get leashed back by this plugin
# NoEngageCheck is an optional field which disables the IsEngaged() check as a requirement before leashing (set to 1 to enable)
# The Plugin also returns 1 if the NPC gets leashed and 0 if not.

sub Leash{
	my $npc = plugin::val('$npc');
	my $LeashDist = $_[0];
	my $NoEngageCheck = $_[1];
	# Don't bother further checks if NPC isn't engaged unless the check is disabled
	if ($npc->IsEngaged() == 1 || $NoEngageCheck)
	{
		my $GuardX = $npc->GetGuardPointX();
		my $GuardY = $npc->GetGuardPointY();
		my $GuardZ = $npc->GetGuardPointZ();
		my $CurDist = $npc->CalculateDistance($GuardX, $GuardY, $GuardZ);
		if ($CurDist > $LeashDist)
		{
			# Get their current heading, since there is currently no way to get Guard Heading (yet)
			my $CurH = $npc->GetHeading();
			# Return them to their Guard Point
			$npc->GMMove($GuardX, $GuardY, $GuardZ, $CurH);
			# Wipe the NPC's hate list as well
			$npc->WipeHateList();
			return 1;
		}
	}
	return 0;
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 12-07-2010 at 04:48 AM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 07:24 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3