Thread: perplexed
View Single Post
  #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