View Single Post
  #3  
Old 02-23-2021, 09:26 PM
Huppy's Avatar
Huppy
Demi-God
 
Join Date: Oct 2010
Posts: 1,333
Default

Since this post got necro'd and the OP never got a reply back then, figure I would throw in a old simple script I used to use for an NPC to summon and rez. In this example, the npc asks for an emerald, but that item can be changed to one's preferences. Just place this in a file named after the npc you created npcname.pl and put it in the appropriate quests/zone folder.

Don't forget to #reloadquest after it's all setup.

Code:
sub EVENT_SPAWN {
   $x = $npc->GetX();
   $y = $npc->GetY();
   quest::set_proximity($x - 500, $x + 500, $y - 500, $y + 500);
}

sub EVENT_SAY {
  my $saylink1 = quest::saylink("REZ");
  if (($text=~/hail/i) && ($ulevel<99)) {
	$client->Message(315,"Hello $name, Bring me an Emerald and I can gather your pathetic bones for you. I can also give you a [$saylink1] if you wish.");
  }
  if (($text=~/rez/i) && ($ulevel<99)) {
	  my $charid = $client->GetID();
	  if($text=~/rez/i) {
            my $corpse = $entity_list->GetCorpseByOwner($client);
            $client->Message(315,'Ok, Stand by '.$corpse->GetOwnerName().' I am rezzing your corpse.');
            $corpse_id = $corpse->GetID();
            $npc->CastSpell(1524,$corpse_id);
      }
  }
}

sub EVENT_ITEM {
$failure = "Sorry $name I can not help you.";


	if(plugin::check_handin(\%itemcount, 10029 => 1))
	{
		if ($ulevel<86)
		{
			EVENT_SUMMON();
		}
		else
		{
			quest::say($failure);
			quest::summonitem(10029);
		}
	}
}

sub EVENT_SUMMON {
$charid = $client->CharacterID();
$count = $client->GetCorpseCount();
$x = $client->GetX();
$y = $client->GetY();
$z = $client->GetZ();
	
	if($count > 0)
	{
    		quest::summonallplayercorpses($charid,$x,$y,$z,0);
			$client->Message(315,"There is the bones you left behind $name . See you again sometime.");
	}
	
	else {
			$client->Message(315,"You have no corpses $name, take this back.");
			quest::summonitem(10029);
	}
}
__________________
Hanging out at Antonica.World
Reply With Quote