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

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
|
 |
|
 |

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
|

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, 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"
|

07-19-2013, 02:02 PM
|
 |
Developer
|
|
Join Date: Dec 2012
Posts: 515
|
|
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
|

07-19-2013, 02:19 PM
|
Discordant
|
|
Join Date: Dec 2005
Posts: 435
|
|
Nate - I just pulled source and compiled azone and had no issues at all.
|
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 12:55 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |