Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2009, 01:14 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,505
Default

How about this:

Add the NPC to all zones using the spawn point at where it would enter the zone. In EVENT_SPAWN, have it check if the global is set to a number associated with the current zone. If it is not, then depop(). If it is, do a start() and when it reaches a specific x/y, have it stop(). Set the global for the next zone, and run a depop().

Other things to consider if using this method:
Designate 1 "start" zone. When that NPC spawns, have it set its own zone number in the global if the global does not exist. If killed, ensure the global is deleted in EVENT_DEATH. If a zone crashes, no big deal, because the global is already set for that specific zone, so it will just start over at the beginning of its path only in that zone.
Reply With Quote
  #2  
Old 08-01-2009, 01:40 PM
Dibalamin
Hill Giant
 
Join Date: Dec 2007
Posts: 182
Default

Or you can make it be random by using another set of globals.
__________________
Retired EMarr
Project1999 Developer
Reply With Quote
  #3  
Old 08-01-2009, 08:23 PM
neiv2
Hill Giant
 
Join Date: Mar 2009
Location: CO
Posts: 183
Default

Joli, I think you suggested having the global check and depop as part of the npc script; but wouldn't it be better placed in the watcher script, as follows?
Code:
sub EVENT_WAYPOINT
	{
	if (defined($qglobals{wanderer})) 
		{

		my $x;
		my $y;
		my $z;
		my $h;

		$x = $npc->GetX();
		$y = $npc->GetY();
		$z = $npc->GetZ();
		$h = $npc->GetHeading();		

		if ($qglobals{wanderer} == 1 && $EventStart == 0)
			{	
			$EventStart == 1;
			quest::spawn2(999228,0,0,$x+5,$y+5,$z,$h);
			}
		elsif ($qglobals{wanderer} != 1)
			{
			quest::depop(999228);
			}
		}
	}
Would this accomplish the same thing?
Reply With Quote
  #4  
Old 08-01-2009, 08:52 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,505
Default

Well, what I was suggesting does not require a "watcher". Basically, the NPC(s) would look at the 1 global and decide whether or not it should stay spawned. I'll give you an example in a few minutes.
Reply With Quote
  #5  
Old 08-01-2009, 09:50 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,505
Default My Example

Create an NPC (we'll say Wanderer) with whatever stats you want, but enable qglobals.
In spawn2 table, set a spawn at 100% at the zone-in location from the previous zones (each of which, we'll call 1, 2, and 3). For example, zone2 spawn point would be where Wanderer would have zoned in from zone1. Zone3 spawn would be from the zone line of zone2, and zone1 would be from the zone line of zone3.
Create waypoints (we'll say id of 100) in our zones. Use full pause and ensure that the last waypoint has a decent pause time for the x/y check.

All 3 script files will look almost identical. Items in red will be the difference between the files. The first one is the starting zone.

quests\1\Wanderer.pl
Code:
my $ZoneOutX = 1111;
my $ZoneOutY = 1111;

sub EVENT_SPAWN {
  if (!defined($qglobals{Wanderer}) {
    quest::setglobal("Wanderer",1,7,"F");
  }
  if (defined($qglobals{Wanderer}) && ($qglobals{Wanderer} == 1)) {
    quest::start(100);
  }
  else {
    depop();
  }
}

sub EVENT_DEATH {
  quest::delglobal("Wanderer");
}

sub EVENT_WAYPOINT {
  if (($x == $ZoneOutX) && ($y == $ZoneOutY)) {
    quest::stop();
    quest::setglobal("Wanderer",2,7,"F");
    quest::depop();
  }
}
quests\2\Wanderer.pl
Code:
my $ZoneOutX = 2222;
my $ZoneOutY = 2222;

sub EVENT_SPAWN {
  if (defined($qglobals{Wanderer}) && ($qglobals{Wanderer} == 2)) {
    quest::start(100);
  }
  else {
    depop();
  }
}

sub EVENT_DEATH {
  quest::delglobal("Wanderer");
}

sub EVENT_WAYPOINT {
  if (($x == $ZoneOutX) && ($y == $ZoneOutY)) {
    quest::stop();
    quest::setglobal("Wanderer",3,7,"F");
    quest::depop();
  }
}
quests\3\Wanderer.pl
Code:
my $ZoneOutX = 3333;
my $ZoneOutY = 3333;

sub EVENT_SPAWN {
  if (defined($qglobals{Wanderer}) && ($qglobals{Wanderer} == 3)) {
    quest::start(100);
  }
  else {
    depop();
  }
}

sub EVENT_DEATH {
  quest::delglobal("Wanderer");
}

sub EVENT_WAYPOINT {
  if (($x == $ZoneOutX) && ($y == $ZoneOutY)) {
    quest::stop();
    quest::setglobal("Wanderer",1,7,"F");
    quest::depop();
  }
}
Reply With Quote
  #6  
Old 08-02-2009, 09:55 PM
neiv2
Hill Giant
 
Join Date: Mar 2009
Location: CO
Posts: 183
Default

I've tested each part of this script, and this part of it is broken:

if (!defined($qglobals{Wanderer}) {
quest::setglobal("Wanderer",1,7,"F");
}

The rest of it works fine. Any reason this part doesn't work? Is the ! being used correctly?
Reply With Quote
  #7  
Old 08-02-2009, 10:05 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,505
Default

Yeah, I missed a close parenthesis.

Code:
if (!defined($qglobals{Wanderer})) {
That's what I get for writing code "on the fly" instead of testing it first.
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 01:29 AM.


 

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 - 2026, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3