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-06-2010, 11:21 PM
neiv2
Hill Giant
 
Join Date: Mar 2009
Location: CO
Posts: 183
Default perplexed

I have been using the same global quest scripts for certain npcs since I figured out how to do them several years ago, But for some reason they are no longer working, and I am getting a lot of anomalies with their paired-down versions. One is for my wandering npc who travels from zone to zone; the other is for my global watcher npc who activates the spawn for the wanderer. The paired-down scripts are below:

Watcher Script (NPCID 999281 )
Code:
my $EventStart;

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

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

sub EVENT_SPAWN {
	$EventStart = 0;
	quest::depopall(999228);
	}

sub EVENT_WAYPOINT
	{
	if ($EventStart == 0)
		{
		$EventStart = 1;	
		quest::spawn2(999228,0,0,$x+1,$y+1,$z,$h);	
		quest::shout("Wanderer spawned");
		}
	}
Wanderer Script (NPCID 999228 )
Code:
sub EVENT_SPAWN
	{	
	quest::shout("Hi");
	}
I have necessarily abbreviated both scripts because the rest of each script should be irrelevant to this issue (I've commented out (##) all the other lines for testing purposes to mirror the abbreviations above). Here are the issues:

First of all, the Watcher script is supposed to spawn the Wanderer right next to the Watcher. Instead, the Wanderer spawns at the zone entrance point, which is quite a distance from the Watcher. Second, once the Wanderer spawns, he is supposed to shout "Hi." Instead, it is the Watcher that ends up shouting "Hi." The chat box in game displays the following text:
Quote:
You say '#reloadquest'
Clearing quest memory cache.
You say '#repop'
Zone depoped. Repoping now.
watcher shouts 'Wanderer spawned'
watcher shouts 'Hi'
I should mention that I have a grid with two waypoints for the Watcher, and both waypoints are set at a 5-second pause. Again, this is how I have always created them and they have always worked in the past. I should also mention that all NPCs involved have their gquest settings set to 1 in the DB. I cannot figure out why it is doing this. Any suggestions?
Reply With Quote
  #2  
Old 09-07-2010, 01:11 AM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

The problem with the mob spawning in the wrong location is because you are setting your variables when the script is initialized(ie on spawn) so when it hits the waypoint the variables remain the same. To fix that you need to do it like this:

Code:
my $EventStart = 0;

sub EVENT_SPAWN 
{
	$EventStart = 0;
	quest::depopall(999228);
}

sub EVENT_WAYPOINT
{
	if ($EventStart == 0)
	{
		$EventStart = 1;	
		my $x = $npc->GetX();
		my $y = $npc->GetY();
		my $z = $npc->GetZ();
		my $h = $npc->GetHeading();	
		quest::spawn2(999228,0,0,$x+1,$y+1,$z,$h);	
		quest::shout("Wanderer spawned");
	}
}
In regards to your other issue with the wrong text being shouted, since we can't see the full script the only thing we know for sure is that the computer isn't crazy, if that mob is shouting then its got to be in a script somewhere. Perhaps the file numbers are incorrect or you have 2 mobs with similar script, rest assured its user error.
Reply With Quote
  #3  
Old 09-07-2010, 05:44 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

Even then, those variables don't need to be overridden. Those variables are passed with the waypoint event.

BTW: You should specify EVENT_WAYPOINT_ARRIVE or EVENT_WAYPOINT_DEPART.
Reply With Quote
  #4  
Old 09-07-2010, 11:01 PM
neiv2
Hill Giant
 
Join Date: Mar 2009
Location: CO
Posts: 183
Default

Below is the complete script for each NPC. I backed-up the originals and removed all but the relevant script from each to do this testing. I also rewrote the Watcher script per Caryatis:

Watcher
Code:
## 999281, Watcher

my $EventStart = 0;

sub EVENT_SPAWN {
	$EventStart = 0;
	quest::depopall(999228);
	}

sub EVENT_WAYPOINT
	{
	if ($EventStart == 0)
		{
		$EventStart = 1;
		my $x = $npc->GetX();
		my $y = $npc->GetY();
		my $z = $npc->GetZ();
		my $h = $npc->GetHeading();	
		quest::spawn2(999228,0,0,$x+1,$y+1,$z,$h);	
		quest::shout("Wanderer spawned");
		}
	}
Wanderer
Quote:
##Wanderer, npcid 999228

sub EVENT_SPAWN
{
quest::shout("Hi");
}
Here is the in-game chatbox text:
Quote:
You say '#reloadquest'
Clearing quest memory cache.
You say '#repop'
Zone depoped. Repoping now.
watcher shouts 'Wanderer spawned'
watcher shouts 'Hi'
Now, when I remove the commented out script name at the top of each file . . .
Code:
my $EventStart = 0;

sub EVENT_SPAWN {
	$EventStart = 0;
	quest::depopall(999228);
	}

sub EVENT_WAYPOINT
	{
	if ($EventStart == 0)
		{
		$EventStart = 1;
		my $x = $npc->GetX();
		my $y = $npc->GetY();
		my $z = $npc->GetZ();
		my $h = $npc->GetHeading();	
		quest::spawn2(999228,0,0,$x+1,$y+1,$z,$h);	
		quest::shout("Wanderer spawned");
		}
	}
and . . .
Code:
sub EVENT_SPAWN
	{	
	quest::shout("Hi");
	}
. . . the resulting in-game chatbox text reads:
Quote:
You say '#reloadquest'
Clearing quest memory cache.
You say '#repop'
Zone depoped. Repoping now.
watcher shouts 'Wanderer spawned'
wanderer shouts 'Hi'
So the script works when the title lines are deleted but not when they are present.

By the way, both WAYPOINT_ARRIVE and WAYPOINT_DEPART (per joligario) break the script (I have an older version of the server code and it may not have the ability to do these functions).

The larger question is, why would a commented-out line impact the script? I am using Notepad++, and I have ensured there are no extra spaces in the commented-out line nor in the blank line below it. This has never been an issue before. Any ideas why it would respond this way?
Reply With Quote
  #5  
Old 09-11-2010, 08:35 PM
neiv2
Hill Giant
 
Join Date: Mar 2009
Location: CO
Posts: 183
Default

Okay, I resolved that particular issue by enclosing the header in pound signs, like so . . .

## 999281, Watcher ##

For some reason, this works whereas simply beginning the header line with pound signs does not . . .

## 999281, Watcher

I don't know whether this is a bug but if anyone else is experiencing broken scripts that should otherwise work fine, you may want to add pound signs on both sides of comments and titles.

Now the two scripts are working as they should I have noticed one other oddity; namely, that sometimes the Watcher script spawns the Wanderer when entering the zone and other times it requires that I do a #reloadquest command before it will work. the two scripts (in toto) are below:

Watcher
Code:
## 999281##
## West Karana##
## Grid 161 3 1##
## WP 161 5 1,2##

my $EventStart;

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

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

sub EVENT_SPAWN {
	my $EventStart;
	$EventStart = 0;
	quest::depopall(999228);
	}

sub EVENT_WAYPOINT
	{
	if ($EventStart == 0)
		{

		$EventStart = 1;
		my $x = $npc->GetX();
		my $y = $npc->GetY();
		my $z = $npc->GetZ();
		my $h = $npc->GetHeading();	
		quest::spawn2(999228,0,0,$x+5,$y+5,$z,$h);			
		}
	
	if (defined($qglobals{sauron}) && ($qglobals{sauron}) == 4)
		{	
		quest::signal(999247);
		}
	}
Wanderer
Code:
## Wanderer, npcid 999228##
## West Karana##
## Grid 106,3,1##
	
sub EVENT_SPAWN
	{
	my @EntryPhrases = (
        "Looking, looking, always looking.",
        "It must be around here somewhere.",
        "So far from home this is",
        "What new peril awaits me here?"
    );

	if (!defined($qglobals{wanderer}))
		{
		quest::setglobal("wanderer", 1, 7, "F");
		}
	if (defined($qglobals{wanderer}) && ($qglobals{wanderer} == 1))
		{
		quest::shout("$EntryPhrases[int(rand($#EntryPhrases+1))]");
		quest::start(188);
		}
	else
		{
		quest::depop();
		}
	}

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


sub EVENT_WAYPOINT
	{
	my @ExitPhrases = (
        "See? Here it is! This must be the passage!",
        "They stole it from me! They haven't seen the last of me",
        "I knew they were deceivers. I knew they lied."
    );
	
	if ($wp == 9)
		{
		quest::delglobal("wanderer");	
		quest::setglobal("wanderer", 2, 7, "F");
		quest::shout("$ExitPhrases[int(rand($#ExitPhrases+1))]");
		quest::depop();	
		}
	}
Now, everything in these scripts works just as it should. The Watcher is on a 2-waypoint stationary grid with a 5-second pause between waypoints. When I pop into the zone, the Watcher spawns (he is a dbspawn with an assigned grid), checks the Wanderer qglobal. If there is none, it sets it to 1 (which is assigned to this zone), then the Watcher spawns the Wanderer, who in turn shouts a random entry phrase and begins walking the grid number indicated in the Start command. When he reaches the designated waypoint he shouts a random exit phrase, depops, and sets the qglobal to "2", which is the next zone where he will pop.

As I said, everything works well except for the spawning of the Wanderer. Sometimes he spawns when I enter the zone in which the global is set and other time he does not, When he doesn't, I can simply do a #reloadquest command and a #depop, and all is well again (the Watcher spawns, then he spawns the Wanderer, and the Wanderer goes on his happy way along the grid to the designated waypoint, where he shouts an exit message, depops, and sets the qglobal to the next zone in the series).

My question is, why does the Watcher not spawn the Wanderer without my having to do a #reloadquest? How can I fix this?
Reply With Quote
  #6  
Old 09-11-2010, 11:23 PM
neiv2
Hill Giant
 
Join Date: Mar 2009
Location: CO
Posts: 183
Default

Just some information I left out. Sometimes when the Wanderer does not spawn, if I exit the game and restart the Emulator, then go back in, it'll work without #reloadquest (not always, and never if I just exit to the character select screen before going back in). Also, once I do a #reloadquest command and the Wanderer spawns, if I zone out before the Wanderer has had a chance to complete the grid, then enter the zone again, the script always works correctly (the Watcher spawns and in turn always spawns the Wanderer without fail) no matter how many times I zone out and zone back in. But once the Wanderer completes the grid, sets the qglobal to the next zone in the series, then depops, the problem starts all over again.
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 08:46 PM.


 

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