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

09-12-2008, 11:02 AM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
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?
|
 |
|
 |

09-12-2008, 12:01 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
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.
|

09-12-2008, 12:07 PM
|
AX Classic Developer
|
|
Join Date: May 2006
Location: filler
Posts: 2,049
|
|
Did you check for typos? again, this will help.
|

09-12-2008, 12:29 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
Might want to change timer to $timer
|

09-12-2008, 12:33 PM
|
AX Classic Developer
|
|
Join Date: May 2006
Location: filler
Posts: 2,049
|
|
Quote:
Originally Posted by joligario
Might want to change timer to $timer
|
Yea, good idea, hehe! I didn't see that one.
|

09-12-2008, 12:43 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
The syntax of all three scripts checks out "ok"
|

09-12-2008, 12:45 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Quote:
Originally Posted by joligario
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?
|

09-12-2008, 12:49 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Script still does not work :(
|
 |
|
 |

09-12-2008, 12:52 PM
|
AX Classic Developer
|
|
Join Date: May 2006
Location: filler
Posts: 2,049
|
|
Quote:
Originally Posted by Neiv
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.
|
 |
|
 |

09-12-2008, 01:38 PM
|
AX Classic Developer
|
|
Join Date: May 2006
Location: filler
Posts: 2,049
|
|
I don't understand this;
Code:
if (defined($qglobals{king}))
and also, I try to make my globals as short as possible;
kingdomfaction = king1
you have to follow sequence to set a global;
Code:
quest::delglobal("king1");
quest::setglobal("king1",3,7,"F");
$king1=undef;}
And I don't know how this;
Code:
if (defined($qglobals{king}))
is related.
|
 |
|
 |

09-12-2008, 01:39 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Okay, I've narrowed down the problem to the watcher script. I sandwiched the "setglobal" in the slayer script between two shouts, like this:
Code:
quest::delglobal("king");
quest::shout("global deleted, resetting global");
quest::setglobal("king", 4, 7, "F");
quest::spawn2(999247,0,0,$x+5,$y+5,$z,$h);
quest::shout("king spawned, handing off to watcher");
I can see both shouts in the chat box as I zone due to death, so that tells me the global is setting. Plus, the fact that the king actually npc spawns in the spawn2 function tells me it's making it through.
I also added some shouts to the watcher script, like this:
Code:
sub EVENT_WAYPOINT
{
quest::shout("start WAY POINT");
if (defined($qglobals{king}))
{
if ($qglobals{king} == 4)
{
quest::shout("start signal");
quest::signal(999247);
quest::shout("signal completed");
}
}
}
The first watcher shout ("start WAY POINT") repeats every five seconds, but never proceeds to the second or third shouts. That tells me something is amiss in one of the two $qglobals lines. Any thoughts?
|
 |
|
 |

09-12-2008, 01:56 PM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
Is your watcher set to have access to qglobals in the npc_types table?
|
 |
|
 |

09-12-2008, 02:11 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Quote:
Originally Posted by AndMetal
Is your watcher set to have access to qglobals in the npc_types table?
|
I didn't bother changing that flag since my other global works fine without it. In my kingdom global, the king sets a global for a kingdom buff and that works fine; and another npc deletes that global when the kingdom has been defeated, and that works fine. Are you saying the access needs to be turned on only on an npc that is checking a global? I went ahead and tuned it on for all npcs involved just in case.
In the meantime . . .
I have been playing with the watcher script and changed it from this:
Code:
sub EVENT_WAYPOINT
{
quest::shout("start WAY POINT");
if (defined($qglobals{king}))
{
if ($qglobals{king} == 4)
{
quest::shout("start signal");
quest::signal(999247);
quest::shout("signal completed");
}
}
}
. . . to this:
Code:
sub EVENT_WAYPOINT
{
quest::shout("start WAY POINT");
if (defined($qglobals{king} == 4))
{
quest::shout("start signal");
quest::signal(999247);
quest::shout("signal completed");
}
}
All the shouts are now displaying as they should, but the spawned king still is not doing what he needs to do. I'm going to start playing with him, but does the revised slayer script look right?
|
 |
|
 |

09-12-2008, 02:16 PM
|
AX Classic Developer
|
|
Join Date: May 2006
Location: filler
Posts: 2,049
|
|
No it only looks like it's working, but it's not - set the flag
|

09-12-2008, 03:05 PM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
Just to clarify, the flags allows that particular NPC to view the globals. This is so they don't have to exported for every single NPC (which, as you can imagine, can be VERY resource intensive). Anyone can set a global, even without the flag set in npc_types. That's why you can set it in the player.pl file (which coincidentally has the globals accessable automatically), but can't read it in the watcher script.
This caused me a lot of headache with the PoJ Trial of Execution when it was first changed, but once I figured it out, it was easy enough to fix.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 09:57 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |