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

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

Reply
 
Thread Tools Display Modes
  #1  
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
  #2  
Old 12-07-2010, 01:26 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

I'm not opposed to simplifying anything at all, the only thing that has me concerned about completely replacing my function is if someone wanted to create a whole new leash point in the middle of a fight. I thought about using spawn or guard points before but thought this would be more flexible.

Could probably put them both in, and when I get to making a big cheat sheet of all the functions I could explain it in there.

Oh, and when anyone gets a chance to test this let me know.
Reply With Quote
Reply

Thread Tools
Display Modes

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:29 PM.


 

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