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 04-19-2010, 05:21 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Quote:
Originally Posted by Shiny151 View Post
So Trev, does this plugin work on any zone with mobs that already have designated paths? What about NPCs that are supposed to be static?
This plugin only works on NPCs you specifically set it on in the quest script for them as I mentioned in the first post with an example. So, if you don't want them to use random roaming, just don't add it to their quest file. That goes for non-roaming NPCs and NPCs with pathing that you don't want them to be moving other than what they may already be set for.

If you just try it out using the example I posted, it should be pretty easy to see what is going on and how to use it.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 07-17-2010, 05:07 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Here is my latest modifications to these path tools. The main change is that RandomRoam now allows for an optional Z variance setting as well as an optional LoS mob size setting.

Code:
#NOTE: These functions require the globals.pl file for use of the val() plugin

#Usage: plugin::RandomRoam(MaxXVariance, MaxYVariance, MaxZVariance, LoSMobSize);
# MaxXVariance - Sets the max X variance to travel 
# MaxYVariance - Sets the max Y variance to travel 
# MaxZVariance - Sets the max Z variance to travel.  This field is optional and default is 15.
# LoSMobSize - Sets the size of the mob LoS check.  This field is optional and default is 5.
# The LoS check basically looks from your NPC to an imaginary NPC of the LoSMobSize size to see if LoS exists

sub RandomRoam {

	my $npc = plugin::val('$npc');
	my $MaxXVariance = $_[0];
	my $MaxYVariance = $_[1];
	my $MaxZVariance = $_[2];
	my $LoSMobSize = $_[3];

	#Set the Max Z Variance to 15 if no 3rd argument is set
	if(!$MaxZVariance){
		$MaxZVariance = 15;
	}
	
	#Set the LoS Check Mob Size to 5 if no 4th argument is set
	if(!$LoSMobSize){
		$LoSMobSize = 5;
	}
	
	# Don't try to roam if already engaged in combat!
	if ($npc->IsEngaged() != 1) {

		#Get needed Locs
		my $CurX = $npc->GetX();
		my $CurY = $npc->GetY();
		#my $CurZ = $npc->GetZ();	#Not currently required by this plugin
		my $OrigX = $npc->GetSpawnPointX();
		my $OrigY = $npc->GetSpawnPointY();
		my $OrigZ = $npc->GetSpawnPointZ();
		my $GuardX = $npc->GetGuardPointX();
		my $GuardY = $npc->GetGuardPointY();

		if ($CurX == $GuardX && $CurY == $GuardY) {	#If the NPC has finished walking to the previous given Loc

			#Get a random X and Y within the set range
			my $RandomX = int(rand($MaxXVariance - 1)) + 1;
			my $RandomY = int(rand($MaxYVariance - 1)) + 1;
			my $PosX = $OrigX + $RandomX;
			my $PosY = $OrigY + $RandomY;
			my $NegX = $OrigX - $RandomX;
			my $NegY = $OrigY - $RandomY;
			my $NewX = quest::ChooseRandom($PosX, $NegX);
			my $NewY = quest::ChooseRandom($PosY, $NegY);
			
			#Check for LoS and Z issues before moving to the new Loc
			my $NewZ = $npc->FindGroundZ($NewX,$NewY, 5) + 1;	#Add 1 to the new Z to prevent hopping issue when they arrive
			if ($NewZ > -999999 && $OrigZ > ($NewZ - $MaxZVariance + 1) && $OrigZ < ($NewZ + $MaxZVariance - 1)) {
				my $LoS_Check = $npc->CheckLoSToLoc($NewX, $NewY, $NewZ, $LoSMobSize);
				#Check LoS to the new random Loc
				if ($LoS_Check) {
					quest::moveto($NewX, $NewY, $NewZ, -1, 1);
				}
			}
		}
	}
}

#Usage: plugin::StraightPath(MaxXVariance, MaxYVariance);

sub StraightPath {
	
	my $npc = plugin::val('$npc');
	my $MaxXVariance = $_[0];
	my $MaxYVariance = $_[1];
	
	# Don't try to roam if already engaged in combat!
	if ($npc->IsEngaged() != 1) {	

		#Get needed Locs
		my $CurX = $npc->GetX();
		my $CurY = $npc->GetY();
		#my $CurZ = $npc->GetZ();	#Not currently required by this plugin
		my $OrigX = $npc->GetSpawnPointX();
		my $OrigY = $npc->GetSpawnPointY();
		my $OrigZ = $npc->GetSpawnPointZ();
		my $GuardX = $npc->GetGuardPointX();
		my $GuardY = $npc->GetGuardPointY();

		if ($CurX == $GuardX && $CurY == $GuardY) {	#If the NPC has finished walking to the previous given Loc

			#Get a random X and Y within the set range
			my $RandomX = int(rand($MaxXVariance - 1)) + 1;
			my $RandomY = int(rand($MaxYVariance - 1)) + 1;
			my $PosX = $OrigX + $RandomX;
			my $PosY = $OrigY + $RandomY;
			my $NegX = $OrigX - $RandomX;
			my $NegY = $OrigY - $RandomY;
			my $NewX = quest::ChooseRandom($PosX, $NegX, $OrigX, $OrigX);
			
			if ($NewX == $OrigX) {	# If we are using the orignal X, then chose a random Y to go to
				if ($CurX == $OrigX) {	# If they are moving on the same Axis they are currently on
					my $NewY = quest::ChooseRandom($PosY, $NegY);
					#Check for LoS and Z issues before moving to the new Loc
					my $NewZ = $npc->FindGroundZ($NewX, $NewY, 5) + 1;	#Add 1 to the new Z to prevent hopping issue when they arrive
					if ($NewZ > -999999 && $OrigZ > ($NewZ - 16) && $OrigZ < ($NewZ + 14)) {
						if ($NewY > $OrigY) {	# Checking which direction we are moving in
							# Adjust the LoS Check to check further than how far we are traveling so we stay away from walls
							my $LoS_Check = $npc->CheckLoSToLoc($NewX, $NewY + 2, $NewZ, 5);
							#Check LoS to the new random Loc
							if ($LoS_Check) {
								quest::moveto($NewX, $NewY, $NewZ, -1, 1);
							}
						}
						else {
							# Adjust the LoS Check to check further than how far we are traveling so we stay away from walls
							my $LoS_Check = $npc->CheckLoSToLoc($NewX, $NewY - 2, $NewZ, 5);
							#Check LoS to the new random Loc
							if ($LoS_Check) {
								quest::moveto($NewX, $NewY, $NewZ, -1, 1);
							}
						}
					}
				}
				else {	# If not moving on the same Axis they are already on, just return them to their Spawn Point
					quest::moveto($OrigX, $OrigY, $OrigZ, -1, 1);
				}
			}
			else {	# If we are not using the orignal X, then use the original Y instead
				if ($CurY == $OrigY) {	# If they are moving on the same Axis they are currently on
					#Check for LoS and Z issues before moving to the new Loc
					my $NewZ = $npc->FindGroundZ($NewX, $OrigY, 5) + 1;	#Add 1 to the new Z to prevent hopping issue when they arrive
					if ($NewZ > -999999 && $OrigZ > ($NewZ - 16) && $OrigZ < ($NewZ + 14)) {
						if ($NewX > $OrigX) {	# Checking which direction we are moving in
							# Adjust the LoS Check to check further than how far we are traveling so we stay away from walls
							my $LoS_Check = $npc->CheckLoSToLoc($NewX + 2, $OrigY, $NewZ, 5);
							#Check LoS to the new random Loc
							if ($LoS_Check) {
								quest::moveto($NewX, $OrigY, $NewZ, -1, 1);
							}
						}
						else {
							# Adjust the LoS Check to check further than how far we are traveling so we stay away from walls						
							my $LoS_Check = $npc->CheckLoSToLoc($NewX - 2, $OrigY, $NewZ, 5);
							#Check LoS to the new random Loc
							if ($LoS_Check) {

								quest::moveto($NewX, $OrigY, $NewZ, -1, 1);
							}
						}
					}
				}
				else {	# If not moving on the same Axis they are already on, just return them to their Spawn Point
					quest::moveto($OrigX, $OrigY, $OrigZ, -1, 1);
				}
			}
		}
	}
}


#Usage: plugin::RandomSwim(MaxXVariance, MaxYVariance, WaterSurfaceZ);

sub RandomSwim {

	my $npc = plugin::val('$npc');
	my $MaxXVariance = $_[0];
	my $MaxYVariance = $_[1];
	my $WaterSurfaceZ = $_[2];
	
	# Don't try to roam if already engaged in combat!
	if ($npc->IsEngaged() != 1) {

		#Get needed Locs
		my $CurX = $npc->GetX();
		my $CurY = $npc->GetY();
		#my $CurZ = $npc->GetZ();	#Not currently required by this plugin
		my $OrigX = $npc->GetSpawnPointX();
		my $OrigY = $npc->GetSpawnPointY();
		my $OrigZ = $npc->GetSpawnPointZ();
		my $GuardX = $npc->GetGuardPointX();
		my $GuardY = $npc->GetGuardPointY();

		if ($CurX == $GuardX && $CurY == $GuardY) {	#If the NPC has finished walking to the previous given Loc

			#Get a random X and Y within the set range
			my $RandomX = int(rand($MaxXVariance - 1)) + 1;
			my $RandomY = int(rand($MaxYVariance - 1)) + 1;
			my $PosX = $OrigX + $RandomX;
			my $PosY = $OrigY + $RandomY;
			my $NegX = $OrigX - $RandomX;
			my $NegY = $OrigY - $RandomY;
			my $NewX = quest::ChooseRandom($PosX, $NegX);
			my $NewY = quest::ChooseRandom($PosY, $NegY);
			
			#Check for LoS and Z issues before moving to the new Loc
			my $NewZ = $npc->FindGroundZ($NewX,$NewY, 5) + 1;	#Add 1 to the new Z to prevent hopping issue when they arrive
			if ($NewZ > -999999 && $NewZ < $WaterSurfaceZ) {
				my $SwimZ = plugin::RandomRange($NewZ, $WaterSurfaceZ);
				my $LoS_Check = $npc->CheckLoSToLoc($NewX, $NewY, $SwimZ, 5);
				#Check LoS to the new random Loc
				if ($LoS_Check) {
					#if($npc->GetFlyMode() != 1) {
					#	$npc->SetFlyMode(1);
					#}
					quest::moveto($NewX, $NewY, $SwimZ, -1, 1);
				}
			}
		}
	}
}

return 1;	#This line is required at the end of every plugin file in order to use it
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 04-19-2010, 04:32 PM
Meged
Fire Beetle
 
Join Date: Dec 2007
Posts: 8
Default

Thanks Trevius, I'm only running v1048 so will have to update.

Thanks again
Reply With Quote
  #4  
Old 03-24-2012, 11:37 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

Nevermind, I found the problem
Reply With Quote
  #5  
Old 07-17-2013, 04:54 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Anyone with a up to date server able to get this plugin to work?
Reply With Quote
  #6  
Old 07-17-2013, 07:24 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

We use it on PEQ in crescent reach cause Cavedude was too lazy to go make grids and it appears to still work.
Reply With Quote
  #7  
Old 07-17-2013, 09:21 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Quote:
Originally Posted by KLS View Post
We use it on PEQ in crescent reach cause Cavedude was too lazy to go make grids and it appears to still work.
Hmm not sure whats happening then. Does not work at all for me but I have not used it in some time so I have no clue why.
Roam box is terrible in zones where the Z varies and I hate making grids but guess thats the only thing left to do. /cry
Anyways thanks for letting me know its working as is on PEQ. Helps reaffirm that I noobed something up and should just try again until it works.
Reply With Quote
  #8  
Old 07-18-2013, 10:38 PM
Mariomario
Hill Giant
 
Join Date: Jul 2004
Posts: 143
Default

Ive had problems with this plugin myself. Mainly when I create a new quest folder for a zone that doesn't already have a folder created. I can zone into Crescent Reach and see the script working correctly on the bears, snakes, spiders etc from the original PEQ quests directly from the SVN. However when I copy the exact same script and move it into a newly created folder for say Elddar Forest, the plugin does not work even though it is working in Crescent Reach.

Other scripts work correctly in the newly created elddar folder, even other plugins, but not the randomroam for some strange reason. Even scripts from the global_player and global_npc work in the zone, just not this particular plugin, yet the plugin does work in other default zone folders that come with the SVN. Hopefully this narrows down the problem.
__________________
Wrath - Lead Admin and Owner of Enlightened Dark: Ascension

Enlightened Dark: Ascension
Reply With Quote
  #9  
Old 07-19-2013, 12:39 AM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Thanks for that feedback Mariomario, it may be the cause of my issue.
I am using zones that are not used yet on peq so I have to create their quest folder. Everything else I am doing is working except this plugin.
It's frustrating because I want to be lazy and not create nice pathing via grids.
Reply With Quote
  #10  
Old 07-19-2013, 12:38 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Oh man I had forgot about the LOS but I swear to god I already made the .map files for all these zones I am using. Oh well better just remake, but Trevius and Akkadius thanks for chiming in and clearing that up.
Server "10" -- wolf "-1"
Reply With Quote
  #11  
Old 07-19-2013, 02:02 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Hmm.. tried to do this.. and any time i ran Azone.exe with any zone that OBJ files it would always crash...

I moved out the OBJ file and then it would create the map file correctly
Reply With Quote
  #12  
Old 07-19-2013, 02:19 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Nate - I just pulled source and compiled azone and had no issues at all.
Reply With Quote
Reply


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 12:55 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