|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Plugins & Mods Completed plugins for public use as well as modifications. |
04-19-2010, 01:37 PM
|
Hill Giant
|
|
Join Date: Jul 2009
Location: Indianapolis
Posts: 228
|
|
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?
|
04-19-2010, 04:32 PM
|
Fire Beetle
|
|
Join Date: Dec 2007
Posts: 8
|
|
Thanks Trevius, I'm only running v1048 so will have to update.
Thanks again
|
04-19-2010, 05:21 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Quote:
Originally Posted by Shiny151
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.
|
|
|
|
07-17-2010, 05:07 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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
|
|
|
|
|
|
|
07-26-2010, 06:59 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
I added a new plugin to the original post. It is CalcDestFromHeading and basically lets you calculate a destination X and Y based on a heading and distance. It is really nice for projectiles and also handy if you want to surround something with a circle of spawns or whatever.
Here is the description, but for the actual code, see the first post in this thread:
#Usage: my @DestArray = plugin::CalcDestFromHeading(Heading, Distance, [Mob, MaxZDiff]);
# This plugin calculates the destination X and Y loc based on heading and distance
# Heading is the heading you want to calculate destination X Y Z from
# Distance is the distance you want for the destination X and Y from the source
# Mob is an optional field to allow any mob to be set, but $npc is default
# MaxZDiff is the max height difference from the source mob's Z you want to calculate the destination from.
#
# The output array can be used as follows:
# my $DestX = $DestArray[0];
# my $DestY = $DestArray[1];
# my $DestZ = $DestArray[2];
|
|
|
|
03-24-2012, 09:40 PM
|
Dragon
|
|
Join Date: Dec 2007
Posts: 658
|
|
I copied the example quest given at the beginning of the thread directly, but I still cannot get the random roaming to work. I have the globals.pl and path_tools.pl in my plugins folder, and I've even tried renaming path_tools to randomroam and RandomRoam. I have my source code up to date and everything, so I'm really not sure why I cannot get this working. Anyone have any thoughts?
|
03-24-2012, 11:37 PM
|
Dragon
|
|
Join Date: Dec 2007
Posts: 658
|
|
Nevermind, I found the problem
|
07-17-2013, 04:54 PM
|
Discordant
|
|
Join Date: Dec 2005
Posts: 435
|
|
Anyone with a up to date server able to get this plugin to work?
|
07-17-2013, 07:24 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
We use it on PEQ in crescent reach cause Cavedude was too lazy to go make grids and it appears to still work.
|
07-17-2013, 09:21 PM
|
Discordant
|
|
Join Date: Dec 2005
Posts: 435
|
|
Quote:
Originally Posted by KLS
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.
|
07-18-2013, 10:38 PM
|
Hill Giant
|
|
Join Date: Jul 2004
Posts: 143
|
|
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.
|
07-19-2013, 12:39 AM
|
Discordant
|
|
Join Date: Dec 2005
Posts: 435
|
|
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.
|
|
|
|
07-19-2013, 03:52 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Keep in mind that for this plugin to work, you need to have LoS working in the zone! I suspect this is the issue you guys are having with this plugin. This means that you need a map file for the zone, and many of the newer expansion zones don't have map files yet. You can create your own map files using Azone2 for every map up to current, I believe.
You can easily test if LoS is working in your zone by trying to cast a spell on a nearby NPC, or by using the "#los" command if you have access to that command (GMs do). If #los shows you do not have Line of Sight to an NPC you are standing right next to, then you are almost certainly missing the map file for that zone and will need to create one yourself. The zone won't be functional for playing in until you get a map file anyway, as you won't be able to cast detrimental spells in there on targets other than yourself. Also KoS mobs will not have LoS to be able to aggro on anyone as they should.
|
|
|
|
|
|
|
07-19-2013, 11:21 AM
|
|
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,071
|
|
As Trevius stated, if you don't have map files for that zone, the plugin will not work correctly because it uses LoS checks based on the map files.
If you want to create your own, azone.exe can be downloaded on the links in the menu to the left of the forums. You would generate a map file by command line and running it against one of your EverQuest client zone files and it will spit out a .map file.
Here is an example I just ran:
Code:
E:\Software\HoT EQEmu>Azone2.exe elddar
AZONE2: EQEmu .MAP file generator with placeable object support.
Attempting to load EQG elddar
Unable to open takish.tog
There are 3502716 vertices and 1167572 faces.
EQG V4 Placeable Zone Support
ObjectGroupCount = 728
azone.ini not found in current directory. Including default models.
After processing placeable objects, there are 7397901 vertices and 2465967 faces.
Bounding box: -1937.14 < x < 2240.00, -2288.77 < y < 2271.11
Building quadtree.
Done building quad tree...
Match counters: 15263979 easy in, 44575009 easy out, 26248 hard in, 0 hard out.
Writing map file.
Map header: Version: 0x01000000. 2465967 faces, 4435 nodes, 2768624 facelists
Done writing map (132.96MB).
Should result in a .map file that as stated above is 132.96MB titled 'elddar.map'
|
|
|
|
07-19-2013, 12:38 PM
|
Discordant
|
|
Join Date: Dec 2005
Posts: 435
|
|
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"
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 01:23 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|