Below is the updated trader quest. I moved the saylink to the item section.
Still existing issues: Whenever I hand the platinum to the trader I get the failed turn in message even though the turn in is successful (and I get the global).
Once I have hateblade==1 flag, I'm getting 4 messages when I hail the trader. The messages for hateblade==0 and the messages for hateblade==1. Why is this? I've tried using !defined, hateblade==undef, and hateblade==0. No matter which I use my warrior is sitll getting 4 messages.
I have a shaman standing nearby who is only receiving the first message (which is perfect).
Code:
###Description: Quest NPC for the Hateblade Quest
###Created By: Specialty & Gnomicide of Clumsy's World.
###NPC: Maldan the Trader
###Zone: East Commons
#######################################
#### Saylinks ####
#######################################
sub EVENT_SAY
{
my $deal = quest::saylink("deal", 1);
my $coin = quest::saylink("coin", 1);
my $estate = quest::saylink("Estate", 1);
my $inny = quest::saylink("Innoruuk", 1);
my $bladesmith = quest::saylink("bladesmith", 1);
#######################################
#### Quest Dialogue ####
#######################################
if($text=~/hail/i && $globals{"hateblade"} == 0)
{
plugin::Whisper("Where have all the traders gone?");
if($class eq "Warrior")
{
plugin::Whisper("Hello fellow Warrior, I may have a splendid [$deal] for you!");
}
}
if($text=~/hail/i && $qglobals{"hateblade"} == 1)
{
plugin::Whisper("I said it was splendid; I did not say it was useful!");
quest::doanim(54);
plugin::Whisper("It truly IS one of a kind... literally; however, I hear it may be of more use when forged with a rare sword from the old [$estate].");
}
if($text=~/hail/i && $globals{"hateblade"} == 2)
{
plugin::Whisper("Did you fashion the blade? Let me see it!");
}
if($text=~/hail/i && $globals{"hateblade"} == 3)
{
plugin::Whisper("Seek out Tirapulin V'Thex, the master bladesmith.");
}
if($text=~/hail/i && $globals{"hateblade"} == 4)
{
plugin::Whisper("You have returned! Let me see the blade!");
}
if($text=~/hail/i && $globals{"hateblade"} == 5)
{
plugin::Whisper("Ever have the strangest feeling of dejavu?");
}
if($text=~/hail/i && $globals{"hateblade"} == 6)
{
plugin::Whisper("Ever have the strangest feeling of dejavu?");
}
if($text=~/hail/i && $globals{"hateblade"} == 7)
{
plugin::Whisper("Ever have the strangest feeling of dejavu?");
}
if($text=~/deal/i && $class eq "Warrior")
{
plugin::Whisper("If you have the [$coin], I may be able to provide you with a splendid blade!");
}
if($text=~/coin/i && $class eq "Warrior")
{
plugin::Whisper("For a measly 250 platinum pieces, I will provide you with a blade no warrior has seen the likes of!");
}
if($text=~/estate/i && $globals{"hateblade"} == 1)
{
plugin::Whisper("Unrest of course. Here, take these notes. Now leave me alone.");
quest::summonitem(2669);
quest::setglobal("hateblade", 2, 5, "F");
}
if($text=~/innoruuk/i && $globals{"hateblade"} == 2)
{
plugin::Whisper("That is right, Innoruuk himself gave a blade to King Thex of the Tier'Dal, that has resemblance to that of which you hold. Perhaps a maaster Tier'Dal [$bladesmith] may assist you further.");
}
if($text=~/bladesmith/i && $globals{"hateblade"} == 2)
{
plugin::Whisper("Seek out Tirapulin V'Thex in the Bazaar. I imagine he has migrated his wares there like every other trader.");
quest::setglobal("hateblade", 3, 5, "F");
}
}
#######################################
#### Turn-Ins ####
#######################################
sub EVENT_ITEM
{
my $inny = quest::saylink("Innoruuk", 1);
if($platinum==250 && $class eq "Warrior")
{
quest::summonitem(2667);
quest::setglobal("hateblade", 1, 5, "F");
}
if(plugin::check_handin(\%itemcount, 2666=>1) && $qglobals{"hateblade"} == 2)
{
plugin::Whisper("I told you it was a blade no warrior had seen the likes of! Legend tells it may be a shard of King Thex's royal blade! Perhaps it was forged by [$inny] himself.");
quest::summonitem(2666);
}
if(plugin::check_handin(\%itemcount, 2668=>1) && $qglobals{"hateblade"} == 4)
{
plugin::Whisper("It's mine! Finally! At last my King will have his Hateblade returned to him once and for all!");
quest::emote("runs towards Nektulos Forest");
quest::setglobal("hateblade", 5, 5, "F");
$npc->MoveTo(837, 1281, -17, 128, 0);
quest::settimer("depop", 30);
}
else
{
plugin::return_items(\%itemcount);
plugin::Whisper("It looks like you forgot something.");
}
}
#######################################
#### Despawn Timer ####
#######################################
sub EVENT_TIMER
{
if ($timer eq "depop")
{
quest::depop();
quest::stoptimer("depop");
}
}