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?