|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Q&A This is the quest support section |
09-12-2008, 03:14 PM
|
AX Classic Developer
|
|
Join Date: May 2006
Location: filler
Posts: 2,049
|
|
I would have mine working 'half-assed' when I forget to set that- it would do things like make the global, but not change it.
|
09-13-2008, 05:04 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
Okay, appreciate the tip on setting the qglobal flag on the npcs. Things are almost working correctly. I'm currently having an issue with the watcher. The signal script on the watcher triggers a settimer on the spawned npc. That timer has three parts to it so that the npc kneels to simulate "looting" the item (actually stripped from the client by the slayer), then stands to make an announcement to the server that he is now ruling the world, then depops. The problem is, the watcher keeps tripping the timer and restarting it before the npc is able to depop. How do I get the signal to stop?
|
|
|
|
09-13-2008, 08:08 PM
|
|
Developer
|
|
Join Date: Mar 2003
Posts: 1,497
|
|
When using quest::settimer(id,time), as soon as it hits 0, it will start over and repeat itself. Make sure you are using quest::stoptimer(id).
Another idea (not sure if it will work; you will need to test)... you might be able to have him signal himself. For example, looks like the NPCID is 999247. To start the sequence, I would have the watcher signal the Lord:
Code:
#Watcher.pl ()
sub EVENT_WAYPOINT {
if (defined($qglobals{king})) {
if ($qglobals{king} == 4) {
quest::signalwith(999247,1,1); #Signal 1 to Lord
}
}
}
Then I would have the lord do this:
Code:
#Lord.pl (999247)
sub EVENT_SIGNAL {
if ($signal == 1) { #Sequence started
quest::setsky(14); #Change sky
quest::selfcast(3430); #Light of Nife
quest::signalwith(999247,2,10); #Tell Lord to kneel
}
if ($signal == 2) { #Kneel
$npc->SetAppearance(4); #Kneeling appearance
quest::shout("Ah, so there you are");
quest::signalwith(999247,3,10); #Tell Lord to shout
}
if ($signal == 3) { #Shout
$npc->SetAppearance(0); #Standing appearance
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::signalwith(999247,4,10); #Tell Lord to depop
}
if ($signal == 4) { #Depop
quest::setsky(1); #Change sky to normal
quest::delglobal("king"); #Delete global
$king = undef;
quest::depop(); #Depop
}
}
Once again, you will have to test. I am not sure if the scripting will efficiently allow to signal itself. If not, have the watcher send the signals with 10 second additions.
|
|
|
|
09-14-2008, 12:03 AM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
I will try this, thanks. One point though. I have a stoptimer on all the timers, so I don't think that's the problem. The shout and emote statements are being repeated, and I have to think that's due to the EVENT_WAYPOINT, which triggers each time the npc leaves a waypoint (in this case, every 7 seconds--I tried adjusting it to 10 seconds, but the npc stalls out for some reason). Which is also why I'm dubious about adding seconds to the timer function of the watcher (whether in a timer or a signalwith function). If the watcher re-signals the Lord each time he leave a waypoint, and if the pause time of the waypoint movement is set to 7, then it seems to me that the waypoint movement of the watcher will override any longer duration of time I set in a timer on the Lord. Feel free to correct me on this if I'm wrong.
I'll try the signalwith function and see if I get different results. Thanks again.
|
|
|
|
09-14-2008, 12:51 AM
|
|
Developer
|
|
Join Date: Mar 2003
Posts: 1,497
|
|
Quote:
Originally Posted by Neiv
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.
|
|
|
|
|
|
|
09-14-2008, 09:18 AM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
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.
|
|
|
|
|
|
|
09-14-2008, 09:42 AM
|
|
Developer
|
|
Join Date: Mar 2003
Posts: 1,497
|
|
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();
}
}
|
|
|
|
09-14-2008, 10:34 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
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.
|
09-15-2008, 02:08 AM
|
|
Developer
|
|
Join Date: Mar 2003
Posts: 1,497
|
|
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.
|
09-17-2008, 08:41 PM
|
Hill Giant
|
|
Join Date: May 2008
Location: Colorado
Posts: 238
|
|
That did it. Works like a charm now. Thanks!
|
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 03:10 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|