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 09-23-2008, 02:39 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default Wandering NPC

Does anyone have a quest script that could act as the basis for an idea I have? I would like a certain key npc, who has a valuable item, to “wander” randomly from zone to zone such that players who are in need of this item could not predict where he will be next and much actively search for him. I assume this would entail a global quest that depops the npc from one zone (based on a timer) and simultaneously spawns him in another. I can envision many directions I could take in this, but I'm not confident they are the most efficient.
Reply With Quote
  #2  
Old 10-04-2008, 12:25 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

I seem to recall there is a mob who spawns in one of three or four zones, but never in two zones at once. Maybe I can use the code for this as a template for what I am trying to do. Does anyone know who this mob is? Thanks.
Reply With Quote
  #3  
Old 10-04-2008, 01:11 PM
ltflyr
Fire Beetle
 
Join Date: Oct 2003
Posts: 3
Default

I think you're talking about the Sleeper event. I know when he was awakened he would travel to other zones.
Reply With Quote
  #4  
Old 10-04-2008, 11:32 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

Okay, I think I have this working, but with one outstanding issue. Here's the code for the wanderer, placed in two different zones:

Code:
sub EVENT_SPAWN
	{
	quest::delglobal("wanderer");
	quest::shout("I'm in the zone now");
	quest::settimer("depop",300);
	}

sub EVENT_TIMER
	{
	if($timer eq "depop")
		{
		quest::shout("I'm leaving the zone now");
		quest::stoptimer("depop");
		quest::depop();
	
		quest::setglobal("wanderer", (quest::ChooseRandom(1, 2)), 7, "F");
		}
	}
Here's my watcher code that checks for the global, placed in one zone:

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)
			{	
			quest::spawn2(999228,0,0,$x+5,$y+5,$z,$h);
			}
		}
	}
And here is the watcher code placed in the other zone:

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} == 2)
			{	
			quest::spawn2(999228,0,0,$x+5,$y+5,$z,$h);
			}
		}
	}
The wanderer spawns in Zone A, then after 5 minutes depops and repops either in Zone A or Zone B. As you can see from the codes, the global sets a random number between 1 and 2. One Zone A's watcher looks for global setting 1, and Zone B's watcher looks for global setting 2. This works as far as it goes (when the wanderer depops from one Zone A I can find him in the Zone B, and vice versa). The problem is, when I find him in Zone B and then check his location in Zone A before the 5 minutes is up, I find he is also in Zone A (at his original spawn point before I introduced the "wandering" script).

His spawn limit is set to 1, so that's not the problem. I tried changing his spawn2 entry to 0% chance, but now he doesn;t spawn at all. I think the problem may be that Zone A is his original spawn zone (the loc where I find him is his original spawn point, not next to the Watcher like he should be); so I'm thinking if I remove him from Zone A it might work. But I wanted to get feedback on this first. Any better suggestions out there? What is the best command to remove him from the zone without removing him from the DB? Is it npcspawn remove?
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 04:00 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3