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-12-2008, 11:02 AM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default My first attempt at a "watcher" script

Here's what I've come up with. Any help in this would be greatly appreciated.

Background: Player finds item, and item gives him pvp status until he can take the item safely to his kingdom. Each time player zones, certain npcs look for him in an attempt to get the item (via an aggro object in player.pl). If one of those npcs catches up with him and kills him, the following script is triggered:

Code:
#Slayer pl
sub EVENT_SLAY
	{
	if(plugin::check_hasitem($client, 13732)) #slayer looks for item#
		{
		quest::setglobal("kingdomfaction", 4, 7, "F"); #gives kingdom faction to kingdom 4#
		$client->NukeItem(13732);#slayer takes item#
		$client->SetPVP(0); #removes pvp status from itembearer# 

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

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

		quest::setglobal("king", 4, 7, "F"); #sets global for watcher#
		quest::spawn2(999247,0,0,$x+5,$y+5,$z,$h); 
		#Lord over the kingdom of the slayer is spawned at the loc of the player corpse#
		}
	}
At this point the player zones due to death, making it likely that the zone will be empty of PCs; hence, the watcher:

Code:
#Watcher pl -- watcher is on a 2-point stationary grid with a 5-sec delay
SUB EVENT_WAYPOINT
	{
	if (defined($qglobals{king}))
			{	
			if ($qglobals{king} == 4) 
				{
				quest::signal(999247,1); #signals Lord spawned in slayer script#	
				}
			}
	}
The watcher, in theory, should keep pinging the global until the watcher signals the spawned Lord of the slayer once the player arrives back in the zone. The Lord script is below:

Code:
#Lord pl -- spawned in slayer script
 and signaled by watcher 

sub EVENT_SIGNAL	
	{
	quest::settimer("kneel",10);
	quest::setsky(14); #sky is changed
	quest::selfcast(3430); #bright light surrounds the Lord of slayer
	}


sub EVENT_TIMER
	{
	if(timer eq "kneel")
		{
		$npc->SetAppearance(4);	#Lord of slayer kneels next to corpse#			
		quest::shout("Ah, so there you are");
		quest::settimer("shout",10);
		}

	if(timer eq "shout")
		{
		$npc->SetAppearance(0); #Lord of slayer stands#
		quest::shout2("My servants, hear me and rejoice! For my power and cruelty have returned to me. I now reign supreme. Join me, my minions, and together we shall destroy our enemies!");
		quest::settimer("depop",10);
		}

	if(timer eq "depop")
		{
		quest::setsky(1); #returns sky to normal
		quest::delglobal("king"); #king global set by slayer seleted
		quest::depop(); #Lord of slayer disappears
		}
	}
I have tried this out, and once I am killed and zone back into the zone the Lord is standing there by my corpse but does nothing more. What am I doing wrong?
Reply With Quote
  #2  
Old 09-12-2008, 12:01 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

Just to avoid wasting anyone's time, I've already caught SUB EVENT_WAYPOINT and changed it to sub EVENT_WAYPOINT.

I also placed . . .

"quest::delglobal("king");"

just above the "quest::setglobal("king", 4, 7, "F");" in the Slayer script.

The script is still not working.
Reply With Quote
  #3  
Old 09-12-2008, 12:07 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

Did you check for typos? again, this will help.
Reply With Quote
  #4  
Old 09-12-2008, 12:29 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

Might want to change timer to $timer
Reply With Quote
  #5  
Old 09-12-2008, 12:33 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

Quote:
Originally Posted by joligario View Post
Might want to change timer to $timer
Yea, good idea, hehe! I didn't see that one.
Reply With Quote
  #6  
Old 09-12-2008, 12:45 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

Quote:
Originally Posted by joligario View Post
Might want to change timer to $timer
GAH! How could I have missed that? I'll try the script again and see if it works. Does the watcher script look okay to you, Angelox?
Reply With Quote
  #7  
Old 09-12-2008, 12:49 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

Script still does not work :(
Reply With Quote
  #8  
Old 09-12-2008, 12:52 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

Quote:
Originally Posted by Neiv View Post
GAH! How could I have missed that? I'll try the script again and see if it works. Does the watcher script look okay to you, Angelox?
Looks good, but you never know tell you try; put a lot of quest shouts in there so you know where it gets hung up, my buddy Qadar came up with this type de-bugger which I think is very cool (notice the quest global variable $debugpl2);
Code:
sub EVENT_WAYPOINT {
## In Butcher > Oot ########################### In Butcher > Oot ###########
if (($skiffa==0.5) && ($skiffa < 40)){
 if($debugpl2==1){quest::shout ("Zoneing in From the timorous, setting 1");}
 quest::delglobal("skiffa");
 quest::setglobal("skiffa",1,7,"F");
 $skiffa=undef;}
elsif (($skiffa==1) && ($skiffa < 40)){
 if($debugpl2==1) {quest::shout ("setting 2");}
 quest::delglobal("skiffa");
 quest::setglobal("skiffa",2,7,"F");
 $skiffa=undef;}
elsif (($skiffa==2) && ($skiffa < 40)){
 if($debugpl2==1) {quest::shout ("setting 3");}
 quest::delglobal("skiffa");
 quest::setglobal("skiffa",3,7,"F");
 $skiffa=undef;}
elsif (($skiffa==3) && ($skiffa < 40)){
 if($debugpl2==1) {quest::shout ("setting 4");}
 quest::delglobal("skiffa");
------------Snipped--------------
set global '$debugpl2' to 1 and it shouts, set to 0 and it doesn't. So now you can track and debug anywhere your script gets hung up.
Reply With Quote
  #9  
Old 09-12-2008, 12:43 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

The syntax of all three scripts checks out "ok"
Reply With Quote
  #10  
Old 09-14-2008, 12:51 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

Quote:
Originally Posted by Neiv View Post
Here's what I've come up with. Any help in this would be greatly appreciated.

Background: Player finds item, and item gives him pvp status until he can take the item safely to his kingdom. Each time player zones, certain npcs look for him in an attempt to get the item (via an aggro object in player.pl). If one of those npcs catches up with him and kills him, the following script is triggered:

Code:
#Slayer pl
sub EVENT_SLAY
	{
	if(plugin::check_hasitem($client, 13732)) #slayer looks for item#
		{
		quest::setglobal("kingdomfaction", 4, 7, "F"); #gives kingdom faction to kingdom 4#
		$client->NukeItem(13732);#slayer takes item#
		$client->SetPVP(0); #removes pvp status from itembearer# 

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

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

		quest::setglobal("king", 4, 7, "F"); #sets global for watcher#
		quest::spawn2(999247,0,0,$x+5,$y+5,$z,$h); 
		#Lord over the kingdom of the slayer is spawned at the loc of the player corpse#
		}
	}
At this point the player zones due to death, making it likely that the zone will be empty of PCs; hence, the watcher:

Code:
#Watcher pl -- watcher is on a 2-point stationary grid with a 5-sec delay
SUB EVENT_WAYPOINT
	{
	if (defined($qglobals{king}))
			{	
			if ($qglobals{king} == 4) 
				{
				quest::signal(999247,1); #signals Lord spawned in slayer script#	
				}
			}
	}
The watcher, in theory, should keep pinging the global until the watcher signals the spawned Lord of the slayer once the player arrives back in the zone. The Lord script is below:

Code:
#Lord pl -- spawned in slayer script
 and signaled by watcher 

sub EVENT_SIGNAL	
	{
	quest::settimer("kneel",10);
	quest::setsky(14); #sky is changed
	quest::selfcast(3430); #bright light surrounds the Lord of slayer
	}


sub EVENT_TIMER
	{
	if(timer eq "kneel")
		{
		$npc->SetAppearance(4);	#Lord of slayer kneels next to corpse#			
		quest::shout("Ah, so there you are");
		quest::settimer("shout",10);
		}

	if(timer eq "shout")
		{
		$npc->SetAppearance(0); #Lord of slayer stands#
		quest::shout2("My servants, hear me and rejoice! For my power and cruelty have returned to me. I now reign supreme. Join me, my minions, and together we shall destroy our enemies!");
		quest::settimer("depop",10);
		}

	if(timer eq "depop")
		{
		quest::setsky(1); #returns sky to normal
		quest::delglobal("king"); #king global set by slayer seleted
		quest::depop(); #Lord of slayer disappears
		}
	}
I have tried this out, and once I am killed and zone back into the zone the Lord is standing there by my corpse but does nothing more. What am I doing wrong?
Ok, this is what I was going with. I don't see any stoptimer here so that is why I was checking. If you have more code to it, maybe posting your updated code might show us what problem you are having.
Reply With Quote
  #11  
Old 09-14-2008, 09:18 AM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

Yeah, sorry about that. I have modified this several times since I posted. Here is the Lord script with the stoptimers:

Code:
sub EVENT_SIGNAL	
	{
	quest::settimer("kneel",3);
	quest::setsky(0);
	quest::selfcast(3430);
	}

sub EVENT_TIMER
	{
	if($timer eq "kneel")
		{
		$npc->SetAppearance(4);
		quest::shout("Ah, there you are!");	
		quest::settimer("shout",3);	
		}
	if($timer eq "shout")
		{
		quest::stoptimer("kneel");
		$npc->SetAppearance(0);
		quest::shout2("My servants, hear me and rejoice! For my power and cruelty have returned to me. I now reign supreme. Join me, my minions, and together we shall destroy our enemies!");
                quest::settimer("depop",3);
		}		
if($timer eq "depop")
		{
		quest::stoptimer("shout");
		quest::setsky(1);
		quest::delglobal("king");
		quest::emote("fades into shadow");		
		quest::depop();
		}
	}
I have also tried putting the stoptimer at the end of each timer block rather than at the beginning of the next timer, but the problem persists. My latest version of the script is this:

Code:
sub EVENT_SIGNAL	
	{
	quest::settimer("kneel",3);
	quest::setsky(0);
	quest::selfcast(3430);
	}

sub EVENT_TIMER
	{
	if($timer eq "kneel")
		{
		$npc->SetAppearance(4);
		quest::shout("Ah, there you are!");	
		quest::settimer("shout",3);	
		}
	if($timer eq "shout")
		{
		quest::stoptimer("kneel");
		$npc->SetAppearance(0);
		quest::shout2("My servants, hear me and rejoice! For my power and cruelty have returned to me. I now reign supreme. Join me, my minions, and together we shall destroy our enemies!");
		quest::stoptimer("shout");
		quest::setsky(1);
		quest::delglobal("king");
		quest::emote("fades into shadow");		
		quest::depop();
		}
	}
This version seems to work since the Lord is nowhere in sight once I zone back in (I am bound at the same point in the zone where I am killed so I can check movement once back in), but by the time I zone back in, the Lord has poofed. I'd really like to fix this so that I can actually see the Lord's movements without the watcher restarting the signal script each time he leaves a waypoint.
Reply With Quote
  #12  
Old 09-14-2008, 09:42 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

Ok, I see. You could add a variable that doesn't allow him to continuously react to signals. And with your stoptimers, you should stop them as soon as the trigger hits. Take a look at this example:

Code:
my $started;

sub EVENT_SPAWN {
  $started = 0;
}

sub EVENT_SIGNAL {
  if ($started == 0) {
    $started = 1;
    quest::setsky(0);
    quest::selfcast(3430);
    quest::settimer("kneel",3);
  }
}

sub EVENT_TIMER	{
  if($timer eq "kneel") {
    quest::stoptimer("kneel");
    $npc->SetAppearance(4);
    quest::shout("Ah, there you are!");
    quest::settimer("shout",3);
  }
  if($timer eq "shout") {
    quest::stoptimer("shout");
    $npc->SetAppearance(0);
    quest::shout2("My servants, hear me and rejoice! For my power and cruelty have returned to me. I now reign supreme. Join me, my minions, and together we shall destroy our enemies!");
    quest::settimer("depop",3);
  }
  if($timer eq "depop") {
    quest::stoptimer("depop");
    quest::setsky(1);
    quest::delglobal("king");
    quest::emote("fades into shadow");
    quest::depop();
  }
}
Reply With Quote
  #13  
Old 09-14-2008, 10:34 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

Code:
my $started;

sub EVENT_SPAWN {
  $started = 0;
}

sub EVENT_SIGNAL {
  if ($started == 0) {
    $started = 1;
This code is crashing the zone. I looked at the QuestObjects page and didn't see anything like it there.
Reply With Quote
  #14  
Old 09-15-2008, 02:08 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

I've never used a my outside of a sub before, just saw that used in another file. Maybe put it inside the spawn? Not sure if that will change the scope of it though, which will negate what I was doing...

Or try my $started = 0;

That's the only thing I could think of that would be wrong here.
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 10:16 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3