ErikSigvard
01-04-2019, 04:14 PM
Need some assistance with this, pretty please.
I've created an NPC in the guild lobby who I would like to offer rezzes for plat. The problem I'm running into is how to get them to target the corpse and cast the rez spell. Everything else works just fine.
Has anyone done this and is willing to offer up a sample of their quest code?
Huppy
02-23-2021, 09:26 PM
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. ;)
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);
}
}
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.