Thread: Load2 Points
View Single Post
  #2  
Old 03-19-2010, 03:20 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Nice, thanks for sharing that

Here is a script I made that you might find useful for moving around a zone like that. I just put it on a pet that I can summon from a clicky on my GM. It is really nice for when you are working on a zone and want to get to certain areas of the zone without having to do /target and /goto or whatever, but it should work for what you are doing with that script as well:

Code:
#GM Utility Script

sub EVENT_SPAWN {
	$x = $npc->GetX();
	$y = $npc->GetY();
	$z = $npc->GetZ();
	quest::set_proximity($x - 100, $x + 100, $y - 100, $y + 100, $z - 50, $z + 50);
	quest::settimer("setprox", 2);
}

sub EVENT_TIMER {

	if ($timer eq "setprox") {
		my $x = $npc->GetX();
		my $y = $npc->GetY();
		my $z = $npc->GetZ();
		quest::clear_proximity();
		quest::set_proximity($x - 100, $x + 100, $y - 100, $y + 100, $z - 50, $z + 50);
	}

}

#Hash of arrays to use for setting up GM location lists to easily get around a zone quickly
# Line Number => [ "<zoneshortname#>", "<loc name>", X, Y, Z ],
%CoordNames = (
	1 => [ "lopingplains1", "Steamfont Zone In", -3514, -1275, 720 ],
	2 => [ "lopingplains2", "Undead Area", 3230, 1310, 400 ],
	3 => [ "lopingplains3", "Goblin Camp", -3115, 975, 705 ],
	4 => [ "lopingplains4", "Bloodmoon Zone In", 96, -1700, 212 ],
	5 => [ "lopingplains5", "Beach Area", -1970, -2890, 39 ],
	6 => [ "lopingplains6", "Beach Cliff Camp", -2980, -1975, 268 ],
	7 => [ "lopingplains7", "Steed Camp", -2410, 2140, 320 ],
	8 => [ "lopingplains8", "Vampire Festival", 1660, 1020, 15 ],
	9 => [ "lopingplains9", "Frost Cave", 275, 485, -35 ],
	10 => [ "lopingplains10", "Secret Treehouse", 2785, 2340, 340 ],
	11 => [ "lopingplains11", "Old Mine", 2990, 275, 335 ],
	12 => [ "lopingplains12", "Gem Mine Top", -2835, -45, 558 ],
	13 => [ "lopingplains13", "Gem Mine Middle", -2685, 145, 375 ],
	14 => [ "lopingplains14", "Gem Mine Bottom", -2690, -720, 195 ],
	15 => [ "hillsofshade1", "Base Camp", -444, 470, 54 ],
	16 => [ "hillsofshade2", "Grave Yard", -1015, 865, 59 ],
	17 => [ "hillsofshade3", "Pirate Camp", -350, 1330, 27 ],
	18 => [ "hillsofshade4", "Docks", -515, 1730, 22 ],
	19 => [ "hillsofshade5", "Pirate Ship", 85, 2770, 36 ],
	20 => [ "hillsofshade6", "Takish Camp", 930, 1385, 44 ],
	21 => [ "hillsofshade7", "Spiroc Island", 820, 2111, 14 ],
	22 => [ "hillsofshade8", "Raviak Camp", 1910, 1210, 90 ],
	23 => [ "hillsofshade9", "Undead Camp", 2000, -30, 8 ],
	24 => [ "hillsofshade10", "Outside Undead Goblins", 1135, -295, 6 ],
	25 => [ "hillsofshade11", "Undead Goblin Boss", 550, -275, -105 ],
	26 => [ "hillsofshade12", "Mushrooms", -1590, -505, -580 ],
	27 => [ "stonehive1", "Zone In", -1282, 0, 43 ],
	28 => [ "stonehive2", "Maze Left", -925, -640, 45 ],
	29 => [ "stonehive3", "Maze Right", -803, 580, 39 ],
	30 => [ "stonehive4", "Balcony", 400, 0, 58 ],
	31 => [ "stonehive5", "Hive Floor 1", -128, 0, 40 ],
	32 => [ "stonehive6", "Hive Floor 2", -77, 0, 287 ],
	33 => [ "stonehive7", "Hive Floor 3", 92, 0, 392 ],
	34 => [ "stonehive8", "Hive Basement", -23, 29, -54 ],
);

# The $n below is the number currently being checked in the while loop
# $CoordNames{$n}[0]; is Coordinate name for the array and what the saylink will make you say.
# $CoordNames{$n}[1]; is whatever you want the location name to show as in the actual saylink.
# $CoordNames{$n}[2]; is the X coordinate
# $CoordNames{$n}[3]; is the Y coordinate
# $CoordNames{$n}[4]; is the Z coordinate


sub EVENT_PROXIMITY_SAY {
	
	$move = quest::saylink("move");
	
	if ($status > 20) {
	
		#Counts each row for the while
		my $count = 0;
		#Counts each element in the Array for the while
		my $n = 1;

		if($text=~/hail/i) {
			plugin::Whisper("Options: [$move]");
		}
		if($text=~/move/i) {
			#Check each line in the hash
			while ($CoordNames{$n}[0])
			{
				#If the first field of the hash array contains the zone short name
				if ($CoordNames{$n}[0] =~ lc($zonesn) && $CoordNames{$n}[0] ne lc($text))
				{
					$count++;	#Add to the counter for displaying line numbers in the whisper
					#Create the saylink
					$CoordNameLink = quest::saylink($CoordNames{$n}[0], 0, $CoordNames{$n}[1]);
					#List each of the possible options for the current zone
					plugin::Whisper("Move Option $count: $zoneln [$CoordNameLink]");
				}
				$n++;	
			}
		}
		
		if($text !~ /Hail/i && $text !~ /move/i) {
		
			#Check each line in the hash
			while ($CoordNames{$n}[0])
			{
				#If the text said is an exact match to the first field of the hash array
				if ($CoordNames{$n}[0] eq lc($text))
				{
					#Set variables for X, Y, Z and location name
					my $NewX = $CoordNames{$n}[2];
					my $NewY = $CoordNames{$n}[3];
					my $NewZ = $CoordNames{$n}[4];
					my $LocName = $CoordNames{$n}[1];
					plugin::Whisper("Moving us to $zoneln $NewX, $NewY, $NewZ - $LocName");
					#Move the Client and NPC to the new requested location
					quest::movepc($zoneid, $NewX, $NewY, $NewZ);
					$npc->GMMove($NewX, $NewY, $NewZ);
					quest::clear_proximity();
					quest::set_proximity($NewX - 100, $NewX + 100, $NewY - 100, $NewY + 100, $NewZ - 50, $NewZ + 50);
				}
				$n++;
			}
		}
	}
	
}
Most of all, it is a nice example of how to make use of a hash of arrays. They are really nice for having multiple things you want all tied together like that.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote