Log in

View Full Version : Quest based on class


Kingmen30264
08-17-2011, 03:59 AM
I am trying to make a custom quest that allows ONE NPC to give out the proper class reward with a single item turn in (For now).

Right now when I do the turn in, it ONLY works for the first line (Beastlord).


Here is what I have:



#####
#NPC: Epic Test
#Author: Warlore
#####

sub EVENT_SAY
{

my $Epic = quest::saylink("Epic");

if($text=~/hail/i)
{
plugin::Whisper("Hello there $name. You have caught me at somewhat of a bad time. I am just finishing this item that I beleive will be [$Epic].");
}
elsif($text=~/Epic/i)
{
plugin::Whisper("Yes, Epic. All I need from you right now is a rusty dagger!");
}
}

sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Beastlord")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(57054);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Bard")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(77640);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Cleric")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(20076);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Warrior")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(60332);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Shadowknight")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(48136);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Magician")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(19839);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Druid")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(62880);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Paladin")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(48147);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Enchanter")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(52962);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Monk")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(67742);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Berserker")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(18609);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Rogue")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(52348);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Necromancer")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(64067);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Ranger")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(62649);
}
elsif(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Shaman")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(57405);
}
else(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Wizard")
{
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::summonitem(16576);
}
}



When I first tested this, I composed ONLY the first line and when it worked, I simply copied and pasted the line just changing the class specified.



if(plugin::check_handin(\%itemcount, 7007 => 1) && $class eq "Beastlord")



Any and all help with this would be great. Thank you in advance.

trevius
08-17-2011, 05:26 AM
This should work for you and is a bit cleaner and easier to manage:

sub EVENT_ITEM {

# Class => Reward,
my %Reward = (
"Warrior" => 60332,
"Rogue" => 52348,
"Monk" => 67742,
"Berserker" => 18609,
"Shadowknight" => 48136,
"Paladin" => 48147,
"Ranger" => 62649,
"Bard" => 77640,
"Beastlord" => 57054,
"Cleric" => 20076,
"Druid" => 62880,
"Shaman" => 57405,
"Wizard" => 16576,
"Magician" => 19839,
"Enchanter" => 52962,
"Necromancer" => 64067
);
if($Reward{$class})
{
my $RewardID = $Reward{$class}; # Reward

if (plugin::check_handin(\%itemcount, 7007 => 1))
{
quest::summonitem($RewardID);
plugin::Whisper("Thank you for your hard work $name. Enjoy your new weapon!");
quest::exp(1000);
quest::ding();
}
else
{
quest::say("Sorry, $name, but I have no use for that.");
}
}

plugin::return_items(\%itemcount);

}

Kingmen30264
08-17-2011, 05:29 AM
Very nice. I will use this. (I am still trying to learn Perl, so all this helps me learn.)

Thank you :)