PDA

View Full Version : Armor Quest for all Classes and Teleporter


trevius
01-16-2008, 07:08 PM
This is an armor quest for all classes. The quest will also teleport the player to a zone (crushbone in this example).


The player gets drops from a zone that are notes, molds, instructions, or whatever you want to name them. An example of the items I created for this quest are "Boot Instructions". Any class can turn in those boot instructions and get boots specific to their class, and the same goes for all of the other instructions for the rest of the armor set (7 total different pieces). All you need to do is create the 7 different custom note drops, and add them to the quest, and then either find pre-existing class specific armor sets or make your own custom ones and add them to the quest. It is pretty straight foward.

In the code below, I have PoH/PoF armor already in for the pure melee classes. So, you can try it out easily just by making your custom notes and plugging the ID into the check_handin. I have tested this quest and it works 100% on my server.

You will need to edit the npc text to reflect what you want/need.

#############
#Quest Name: An Armor Quest for all Classes and Teleporter
#Author: Trevius
#NPCs Involved: The quest giver NPC can have any name you want.
#Items Involved: 7 notes made custom, and any class specific armor sets.
#################
sub EVENT_SAY
{
if ($text =~/Hail/i)
{
quest::say ("Hey there, $name. I can send you to [crusbone] if ya want. That area is best suited for players of 1 to 20 season. And if you do head that way, please see if you can find any of their instructions for [armor] crafting. What say you?");
}
if ($text =~/armor/i)
{
quest::say ("Yes, it is said that some of the Orcs of Crushbone hold instructions for basic armor crafting. I think they sound perfect for a novice crafter such as myself. Would you like to hear more [rumors] about the instructions? ");
}
if ($text =~/rumors/i)
{
quest::say ("I hear the easier parts to make are kept by the common Orcs you will find there, but the harder leggings and chest instructions are only to be had by Emperor Crush himself, and his Ambassador.");
}
if ($text =~/crushbone/i)
{
quest::say ("Off ya go!");
quest::emote ("fumbles about trying to cast a spell. Let's hope you arrive where you were heading safely...");
quest::movepc(58, 158,-644,4);
}
}

sub EVENT_ITEM {
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowkight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Mage' || $class == 'Enchanter' || $class == 'Necromancer') {
if (plugin::check_handin(\%itemcount, 1319 => 1)) {
my %rewards = (
"Warrior" => 4917, "Rogue" => 4907, "Monk" => 1206, "Berserker" => 55607, "Shadowknight" => 9829, "Paladin" => 9829, "Ranger" => 9829, "Bard" => 9829, "Beastlord" => 9829, "Cleric" => 9829, "Druid" => 9829, "Shaman" => 9829, "Wizard" => 9829, "Mage" => 9829, "Enchanter" => 9829, "Necromancer" => 9829
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
if (plugin::check_handin(\%itemcount, 1323 => 1)) {
my %rewards = (
"Warrior" => 4915, "Rogue" => 4905, "Monk" => 1204, "Berserker" => 55605, "Shadowknight" => 9829, "Paladin" => 9829, "Ranger" => 9829, "Bard" => 9829, "Beastlord" => 9829, "Cleric" => 9829, "Druid" => 9829, "Shaman" => 9829, "Wizard" => 9829, "Mage" => 9829, "Enchanter" => 9829, "Necromancer" => 9829
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
if (plugin::check_handin(\%itemcount, 1353 => 1)) {
my %rewards = (
"Warrior" => 4913, "Rogue" => 4903, "Monk" => 1202, "Berserker" => 55603, "Shadowknight" => 9829, "Paladin" => 9829, "Ranger" => 9829, "Bard" => 9829, "Beastlord" => 9829, "Cleric" => 9829, "Druid" => 9829, "Shaman" => 9829, "Wizard" => 9829, "Mage" => 9829, "Enchanter" => 9829, "Necromancer" => 9829
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
if (plugin::check_handin(\%itemcount, 1372 => 1)) {
my %rewards = (
"Warrior" => 4911, "Rogue" => 4901, "Monk" => 1378, "Berserker" => 55601, "Shadowknight" => 9829, "Paladin" => 9829, "Ranger" => 9829, "Bard" => 9829, "Beastlord" => 9829, "Cleric" => 9829, "Druid" => 9829, "Shaman" => 9829, "Wizard" => 9829, "Mage" => 9829, "Enchanter" => 9829, "Necromancer" => 9829
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
if (plugin::check_handin(\%itemcount, 1373 => 1)) {
my %rewards = (
"Warrior" => 4914, "Rogue" => 4904, "Monk" => 1203, "Berserker" => 55604, "Shadowknight" => 9829, "Paladin" => 9829, "Ranger" => 9829, "Bard" => 9829, "Beastlord" => 9829, "Cleric" => 9829, "Druid" => 9829, "Shaman" => 9829, "Wizard" => 9829, "Mage" => 9829, "Enchanter" => 9829, "Necromancer" => 9829
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
if (plugin::check_handin(\%itemcount, 1375 => 1)) {
my %rewards = (
"Warrior" => 4916, "Rogue" => 4906, "Monk" => 1205, "Berserker" => 55606, "Shadowknight" => 9829, "Paladin" => 9829, "Ranger" => 9829, "Bard" => 9829, "Beastlord" => 9829, "Cleric" => 9829, "Druid" => 9829, "Shaman" => 9829, "Wizard" => 9829, "Mage" => 9829, "Enchanter" => 9829, "Necromancer" => 9829
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
if (plugin::check_handin(\%itemcount, 1377 => 1)) {
my %rewards = (
"Warrior" => 4912, "Rogue" => 4902, "Monk" => 1201, "Berserker" => 55602, "Shadowknight" => 9829, "Paladin" => 9829, "Ranger" => 9829, "Bard" => 9829, "Beastlord" => 9829, "Cleric" => 9829, "Druid" => 9829, "Shaman" => 9829, "Wizard" => 9829, "Mage" => 9829, "Enchanter" => 9829, "Necromancer" => 9829
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
else {
plugin::return_items(\%itemcount);
quest::say("I have no use for this item, $name. Take it back.");
}
}
}

ccody1025
06-27-2008, 05:30 AM
Hey Trev, Tried out this code tonight, making a server for me and a few friends to play on...I know the code works on your server, cause i have multiple toons 70+ on there, and never had any trouble. I tried editing the code to add in my own stuff, gear rewards and whatnot, but the guy just eats the turn ins. I am using Prathun in gloomingdeep as my armor guy. Here is a snippet of the code...


sub EVENT_ITEM {
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowkight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Mage' || $class == 'Enchanter' || $class == 'Necromancer') {
if (plugin::check_handin(\%itemcount, 1319 => 1)) {
my $rewards = (
"Warrior" => 31084, "Rogue" => 31028, "Monk" => 24440, "Berserker" => 55317, "Shadowknight" => 44113, "Paladin" => 31119, "Ranger" => 25363, "Bard" => 31133, "Beastlord" => 5353, "Cleric" => 31042, "Druid" => 31147, "Shaman" => 31105, "Wizard" => 25405, "Mage" => 25419, "Enchanter" => 25426, "Necromancer" => 31063
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}

Any advice ya can give would be greatly appreciated.

Aramid
06-27-2008, 05:34 AM
Try changing your my $rewards = to my %rewards =

joligario
06-27-2008, 10:09 AM
Does this code really work for all classes?

$class == 'Shadowkight'

ccody1025
06-27-2008, 10:58 AM
it was at %rewards to start, i didnt work, so i tried $, ended up with the same problem. The guy just eats the turn ins.

Does this code really work for all classes?

Quote:
$class == 'Shadowkight'

if it is the same code he used on his server...then yea...it worked for each class.

xxarthurxx
06-27-2008, 03:03 PM
you might want to try shadowknight...

Andrew80k
06-27-2008, 04:00 PM
Hey Trev, Tried out this code tonight, making a server for me and a few friends to play on...I know the code works on your server, cause i have multiple toons 70+ on there, and never had any trouble. I tried editing the code to add in my own stuff, gear rewards and whatnot, but the guy just eats the turn ins. I am using Prathun in gloomingdeep as my armor guy. Here is a snippet of the code...


sub EVENT_ITEM {
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowkight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Mage' || $class == 'Enchanter' || $class == 'Necromancer') {
if (plugin::check_handin(\%itemcount, 1319 => 1)) {
my $rewards = (
"Warrior" => 31084, "Rogue" => 31028, "Monk" => 24440, "Berserker" => 55317, "Shadowknight" => 44113, "Paladin" => 31119, "Ranger" => 25363, "Bard" => 31133, "Beastlord" => 5353, "Cleric" => 31042, "Druid" => 31147, "Shaman" => 31105, "Wizard" => 25405, "Mage" => 25419, "Enchanter" => 25426, "Necromancer" => 31063
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}

Any advice ya can give would be greatly appreciated.
couple things...some is just semantics...


$class == 'Shadowknight'


should really be

$class eq "Shadowknight"


Perl is nice and lets you get away with it, but the top one is an array of characters, while the bottom one is a string. Most of the time it won't matter as long as you do consistent types of conditionals along the way, but sometimes it does matter.

Next, you must use


my %rewards = ( "blah" => blah );


$rewards is scalar context, and using it this way will basically give you the count of the items in the array.

Just looking at your code though, if the above was % to start with, I don't see anything that sticks out as a problem and I'm not anywhere where I can test it right now. But you should stick this:


else {
plugin::return_items(\%itemcount);
quest::say("I have no use for this item, $name. Take it back.");
}


at the bottom of any of your sub EVENT_ITEM subroutines for any quest to keep them from eating items they were not meant to be given.

I would check your quest logs to see if they are any help. Try putting some debugging print steps in there to help you narrow down the issue. If you still haven't resolved it later I'll try it on my server.

ccody1025
06-27-2008, 04:54 PM
*smacks head on desk* Well, I figured out the problem. I am a noob to all of this, never did any coding past BASIC and a tiny bit of VB. I had the return_item code ya mentioned at the bottom of the quest, as i copied and pasted Trev's code, just changing what i wanted. I summoned a random item, and turned it in, but he said nothing, and didnt give it back, just ate it. Well i did some looking into the plugin::check_handin...and it appears I did not have the plugin. So it wasn't checking anything i handed it, just eating it. I added the code I found after searching on the boards to the plugin folder, and it now works =). Thank you all for your replies, and sorry to have just missed something that simple, lol.

I did not know the plugin::blah_blah was an actual plugin until i did a search for it, so everything seem to be working now =). Thank you all again.

trevius
06-27-2008, 11:14 PM
Ya, I should have posted the corrections to that quest after I made them sorry lol. There was another class typo too that most probably wouldn't notice at first:

$class == 'Mage'

Should have been

$class == 'Magician'

Here is the current version of the quest that I use that is fully functional:

#An Armor Quest For all classes
sub EVENT_SAY
{
if ($text =~/Hail/i)
{
quest::say ("Hey there, $name. I can send you to [crushbone] if ya want. That area is best suited for players of 1 to 20 season. You may even want to stay there until 25 if the harder zones are too much for you to handle at 20. And if you do head that way, please see if you can find any of their instructions for [armor] crafting. What say you?");
}
if ($text =~/armor/i)
{
quest::say ("Yes, it is said that some of the Orcs of Crushbone hold instructions for basic armor crafting. I think they sound perfect for a novice crafter such as myself. Would you like to hear more [rumors] about the instructions? ");
}
if ($text =~/rumors/i)
{
quest::say ("I hear the easier parts to make are kept by the common Orcs you will find there, but the harder leggings and chest instructions are only to be had by Emperor Crush himself, and his Ambassador. It is possible that the Shroom Slaves have stolen some instructions from the orcs as well.");
}
if ($text =~/crushbone/i)
{
quest::say ("Off ya go!");
$client->Message(6, "Morki Krush fumbles about trying to cast a spell. Let's hope you arrive where you were heading safely...");
quest::movepc(58, 158,-644,4);
}
}

sub EVENT_ITEM {
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') {
if (plugin::check_handin(\%itemcount, 1319 => 1)) {
my %rewards = (
"Warrior" => 4917, "Rogue" => 4907, "Monk" => 1206, "Berserker" => 55607, "Shadowknight" => 4847, "Paladin" => 4857, "Ranger" => 4897, "Bard" => 4867, "Beastlord" => 1206, "Cleric" => 4887, "Druid" => 3807, "Shaman" => 4877, "Wizard" => 1231, "Magician" => 1245, "Enchanter" => 1252, "Necromancer" => 1238
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Morki Krush works to make a piece of armor from the instructions you provided to him." );
quest::exp(450);
quest::say ("Here you go, $name.");
}
}
}
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') {
if (plugin::check_handin(\%itemcount, 1323 => 1)) {
my %rewards = (
"Warrior" => 4915, "Rogue" => 4905, "Monk" => 1204, "Berserker" => 55605, "Shadowknight" => 4845, "Paladin" => 4855, "Ranger" => 4895, "Bard" => 4865, "Beastlord" => 1204, "Cleric" => 4885, "Druid" => 3805, "Shaman" => 4875, "Wizard" => 1229, "Magician" => 1243, "Enchanter" => 1250, "Necromancer" => 1236
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Morki Krush works to make a piece of armor from the instructions you provided to him." );
quest::exp(450);
quest::say ("Here you go, $name.");
}
}
}
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') {
if (plugin::check_handin(\%itemcount, 1353 => 1)) {
my %rewards = (
"Warrior" => 4913, "Rogue" => 4903, "Monk" => 1202, "Berserker" => 55603, "Shadowknight" => 4843, "Paladin" => 4853, "Ranger" => 4893, "Bard" => 4863, "Beastlord" => 1202, "Cleric" => 4883, "Druid" => 3803, "Shaman" => 4873, "Wizard" => 1227, "Magician" => 1241, "Enchanter" => 1248, "Necromancer" => 1234
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Morki Krush works to make a piece of armor from the instructions you provided to him." );
quest::exp(450);
quest::say ("Here you go, $name.");
}
}
}
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') {
if (plugin::check_handin(\%itemcount, 1372 => 1)) {
my %rewards = (
"Warrior" => 4911, "Rogue" => 4901, "Monk" => 1378, "Berserker" => 55601, "Shadowknight" => 4841, "Paladin" => 4851, "Ranger" => 4891, "Bard" => 4861, "Beastlord" => 1378, "Cleric" => 4881, "Druid" => 3801, "Shaman" => 4871, "Wizard" => 1225, "Magician" => 1239, "Enchanter" => 1246, "Necromancer" => 1232
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Morki Krush works to make a piece of armor from the instructions you provided to him." );
quest::exp(450);
quest::say ("Here you go, $name.");
}
}

}
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') {
if (plugin::check_handin(\%itemcount, 1373 => 1)) {
my %rewards = (
"Warrior" => 4914, "Rogue" => 4904, "Monk" => 1203, "Berserker" => 55604, "Shadowknight" => 4844, "Paladin" => 4854, "Ranger" => 4894, "Bard" => 4864, "Beastlord" => 1203, "Cleric" => 4884, "Druid" => 3804, "Shaman" => 4874, "Wizard" => 1228, "Magician" => 1242, "Enchanter" => 1249, "Necromancer" => 1235
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Morki Krush works to make a piece of armor from the instructions you provided to him." );
quest::exp(450);
quest::say ("Here you go, $name.");
}
}
}
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') {
if (plugin::check_handin(\%itemcount, 1374 => 1)) {
my %rewards = (
"Warrior" => 4916, "Rogue" => 4906, "Monk" => 1205, "Berserker" => 55606, "Shadowknight" => 4846, "Paladin" => 4856, "Ranger" => 4896, "Bard" => 4866, "Beastlord" => 1205, "Cleric" => 4886, "Druid" => 3806, "Shaman" => 4876, "Wizard" => 1230, "Magician" => 1244, "Enchanter" => 1251, "Necromancer" => 1237
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Morki Krush works to make a piece of armor from the instructions you provided to him." );
quest::exp(450);
quest::say ("Here you go, $name.");
}
}
}
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') {
if (plugin::check_handin(\%itemcount, 1377 => 1)) {
my %rewards = (
"Warrior" => 4912, "Rogue" => 4902, "Monk" => 1201, "Berserker" => 55602, "Shadowknight" => 4842, "Paladin" => 4852, "Ranger" => 4892, "Bard" => 4862, "Beastlord" => 1201, "Cleric" => 4882, "Druid" => 3802, "Shaman" => 4872, "Wizard" => 1226, "Magician" => 1240, "Enchanter" => 1247, "Necromancer" => 1233
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Morki Krush works to make a piece of armor from the instructions you provided to him." );
quest::exp(450);
quest::say ("Here you go, $name.");
}
}
else {
plugin::return_items(\%itemcount);
}
}
}

This was one of my first quests though and I have learned alot about writing them since then. I am sure I could now go back and rewrite it to be MUCH shorter and work just as well. But, since it already works, there is the old saying "don't fix something that isn't broke", and I don't really need to waste time on it hehe. Other than maybe for the benefit of others wanting to use the quest as an example to learn/write from.

Striat
07-21-2008, 02:34 PM
Decided to take a shot at cleaning up things;p I'm not exactly proficient at auto generating complex hash/array combos. And there is definitely redundancy in my example that could be cleaned up. But, here is an alternative method that may be easier for the average joe to pick up and change/add things that he wants with little quest scripting experience.

#############
#Quest Name: An Armor Quest for all Classes and Teleporter
#Author: Trevius
#NPCs Involved: The quest giver NPC can have any name you want.
#Items Involved: 7 notes made custom, and any class specific armor sets.
#################

my %itemturnins = ( #Hash of Hashes. rewarditem is the reward given. rewardmessage is the message given for each item turn in.
"Bard" => { 1321=> { type => "boots", reward => 55607 }, 1323 => { type => "Greaves", reward => 55605 }, 1353 => { type => "boots", reward => 55603 }, 1372 => { type => "boots", reward => 55601 }, 1373 => { type => "boots", reward => 55604 }, 1375 => { type => "boots", reward => 55606 }, 1377 => { type => "boots", reward => 55602 } },
"Beastlord" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Berserker" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Cleric" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Druid" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Enchanter" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Magician" => { 1321=> { type => "boots", reward => 9829 }, 9830 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Monk" => { 1321=> { type => "boots", reward => 1206 }, 1323 => { type => "Greaves", reward => 1204 }, 1353 => { type => "boots", reward => 1202 }, 1372 => { type => "boots", reward => 1378 }, 1373 => { type => "boots", reward => 1203 }, 1375 => { type => "boots", reward => 1205 }, 1377 => { type => "boots", reward => 1201 } },
"Necromancer" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Paladin" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Ranger" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Rogue" => { 1321=> { type => "boots", reward => 4907 }, 1323 => { type => "Greaves", reward => 4905 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Shadowknight" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Shaman" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 4903 }, 1372 => { type => "boots", reward => 4901 }, 1373 => { type => "boots", reward => 4904 }, 1375 => { type => "boots", reward => 4906 }, 1377 => { type => "boots", reward => 4902 } },
"Wizard" => { 1321=> { type => "boots", reward => 9829 }, 1323 => { type => "Greaves", reward => 9829 }, 1353 => { type => "boots", reward => 9829 }, 1372 => { type => "boots", reward => 9829 }, 1373 => { type => "boots", reward => 9829 }, 1375 => { type => "boots", reward => 9829 }, 1377 => { type => "boots", reward => 9829 } },
"Warrior" => { 1321=> { type => "boots", reward => 4917 }, 1323 => { type => "Greaves", reward => 4915 }, 1353 => { type => "boots", reward => 4913 }, 1372 => { type => "boots", reward => 4911 }, 1373 => { type => "boots", reward => 4914 }, 1375 => { type => "boots", reward => 4916 }, 1377 => { type => "boots", reward => 4912 } },
);

sub EVENT_SAY
{
if ($text =~/Hail/i)
{
quest::say ("Hey there, $name. I can send you to [crusbone] if ya want. That area is best suited for players of 1 to 20 season. And if you do head that way, please see if you can find any of their instructions for [armor] crafting. What say you?");
}
elsif ($text =~/armor/i)
{
quest::say ("Yes, it is said that some of the Orcs of Crushbone hold instructions for basic armor crafting. I think they sound perfect for a novice crafter such as myself. Would you like to hear more [rumors] about the instructions? ");
}
elsif ($text =~/rumors/i)
{
quest::say ("I hear the easier parts to make are kept by the common Orcs you will find there, but the harder leggings and chest instructions are only to be had by Emperor Crush himself, and his Ambassador.");
}
elsif ($text =~/crushbone/i)
{
quest::say ("Off ya go!");
quest::emote ("fumbles about trying to cast a spell. Let's hope you arrive where you were heading safely...");
quest::movepc(58, 158,-644,4);
}
}

sub EVENT_ITEM {
my $gaveitem = 0;

foreach my $itemturnin ( sort keys %{ $itemturnins{$class} } ) {
if (plugin::check_handin(\%itemcount, $itemturnin => 1)) {
$gaveitem = 1;
quest::summonitem($itemturnins{$class}{$itemturnin }{reward});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name. Here is your new $itemturnins{$class}{$itemturnin}{type}");
}
}
if ($gaveitem == 0) {
quest::say("I didn't ask for this! Take your garbage elsewhere!");
}
plugin::return_items(\%itemcount);

}

1321 and other numbers correspond to item turn ins. the type and reward correspond to item type (boots, greaves, etc) and reward corresponds to item id to be given as a reward.

One thing I'd like to point out is that when you see this much redundancy such as in my hash for item turn in for each class, rest assured that it could be optimized a little more

Frothel
09-08-2008, 02:11 AM
I tried to modify the code a little for personalization, and did extensive modifications to the items, and it is still not working. I used the last one that was posted as a model. Here is my code:


#A conversation to Teleport Player to lvl 40-50 zone (Dulak)
#Hash of Hashes. rewarditem Is the reward given. rewardmessage Is the message given for each item turn in.

my %itemturnins = (
"Bard" => { 16370=> { type => "boots", reward => 19549 }, 16373 => { type => "Greaves", reward => 16771 }, 16371 => { type => "helm", reward => 9818 }, 16375 => { type => "chest piece", reward => 47643 }, 16372 => { type => "Sleeves", reward => 11444 }, 16374 => { type => "gloves", reward => 12664 }, 16369 => { type => "bracer", reward => 11178 } },
"Beastlord" => { 16382=> { type => "boots", reward => 20032 }, 16381 => { type => "Greaves", reward => 16787 }, 16376 => { type => "helm", reward => 9824 }, 16377 => { type => "chest piece", reward => 47652 }, 16378 => { type => "Sleeves", reward => 11450 }, 16380 => { type => "gloves", reward => 13553 }, 16379 => { type => "bracer", reward => 11196 } },
"Berserker" => { 16368=> { type => "boots", reward => 55509 }, 16367 => { type => "Greaves", reward => 55512 }, 16362 => { type => "helm", reward => 55513 }, 16363 => { type => "chest piece", reward => 55511 }, 16364 => { type => "Sleeves", reward => 55508 }, 16366 => { type => "gloves", reward => 55514 }, 16365 => { type => "bracer", reward => 55510 } },
"Cleric" => { 16370=> { type => "boots", reward => 20074 }, 16373 => { type => "Greaves", reward => 16797 }, 16371 => { type => "helm", reward => 9827 }, 16375 => { type => "chest piece", reward => 47646 }, 16372 => { type => "Sleeves", reward => 32012 }, 16374 => { type => "gloves", reward => 13563 }, 16369 => { type => "bracer", reward => 11199 } },
"Druid" => { 16382=> { type => "boots", reward => 20422 }, 16381 => { type => "Greaves", reward => 16811 }, 16376 => { type => "helm", reward => 9833 }, 16377 => { type => "chest piece", reward => 47651 }, 16378 => { type => "Sleeves", reward => 11575 }, 16380 => { type => "gloves", reward => 13603 }, 16379 => { type => "bracer", reward => 11281 } },
"Enchanter" => { 16389=> { type => "boots", reward => 20425 }, 16388 => { type => "Greaves", reward => 16931 }, 16383 => { type => "helm", reward => 9836 }, 16384 => { type => "chest piece", reward => 47656 }, 16385 => { type => "Sleeves", reward => 11578 }, 16387 => { type => "gloves", reward => 13614 }, 16386 => { type => "bracer", reward => 11298 } },
"Magician" => { 16389=> { type => "boots", reward => 20428 }, 16388 => { type => "Greaves", reward => 19021 }, 16383 => { type => "helm", reward => 9944 }, 16384 => { type => "chest piece", reward => 47655 }, 16385 => { type => "Sleeves", reward => 11598 }, 16387 => { type => "gloves", reward => 13619 }, 16386 => { type => "bracer", reward => 11303 } },
"Monk" => { 16382=> { type => "boots", reward => 19446 }, 16381 => { type => "Greaves", reward => 16727 }, 16376 => { type => "helm", reward => 9809 }, 16377 => { type => "chest piece", reward => 47650 }, 16378 => { type => "Sleeves", reward => 11435 }, 16380 => { type => "gloves", reward => 12624 }, 16379 => { type => "bracer", reward => 11146 } },
"Necromancer" => { 16389=> { type => "boots", reward => 20431 }, 16388 => { type => "Greaves", reward => 19024 }, 16383 => { type => "helm", reward => 9947 }, 16384 => { type => "chest piece", reward => 47653 }, 16385 => { type => "Sleeves", reward => 11618 }, 16387 => { type => "gloves", reward => 13623 }, 16386 => { type => "bracer", reward => 11306 } },
"Paladin" => { 16370=> { type => "boots", reward => 19449 }, 16373 => { type => "Greaves", reward => 16757 }, 16371 => { type => "helm", reward => 9812 }, 16375 => { type => "chest piece", reward => 47644 }, 16372 => { type => "Sleeves", reward => 11438 }, 16374 => { type => "gloves", reward => 12627 }, 16369 => { type => "bracer", reward => 11163 } },
"Ranger" => { 16368=> { type => "boots", reward => 19838 }, 16367 => { type => "Greaves", reward => 16777 }, 16362 => { type => "helm", reward => 9821 }, 16363 => { type => "chest piece", reward => 47647 }, 16364 => { type => "Sleeves", reward => 11447 }, 16366 => { type => "gloves", reward => 12816 }, 16365 => { type => "bracer", reward => 11193 } },
"Rogue" => { 16368=> { type => "boots", reward => 19443 }, 16367 => { type => "Greaves", reward => 16717 }, 16362 => { type => "helm", reward => 9806 }, 16363 => { type => "chest piece", reward => 47648 }, 16364 => { type => "Sleeves", reward => 11432 }, 16366 => { type => "gloves", reward => 12598 }, 16365 => { type => "bracer", reward => 11141 } },
"Shadowknight" => { 16370=> { type => "boots", reward => 19546 }, 16373 => { type => "Greaves", reward => 16763 }, 16371 => { type => "helm", reward => 9815 }, 16375 => { type => "chest piece", reward => 47645 }, 16372 => { type => "Sleeves", reward => 11441 }, 16374 => { type => "gloves", reward => 12637 }, 16369 => { type => "bracer", reward => 11173 } },
"Shaman" => { 16368=> { type => "boots", reward => 20078 }, 16367 => { type => "Greaves", reward => 16803 }, 16362 => { type => "helm", reward => 9830 }, 16363 => { type => "chest piece", reward => 47649 }, 16364 => { type => "Sleeves", reward => 11529 }, 16366 => { type => "gloves", reward => 13579 }, 16365 => { type => "bracer", reward => 11278 } },
"Wizard" => { 16389=> { type => "boots", reward => 20434 }, 16388 => { type => "Greaves", reward => 19027 }, 16383 => { type => "helm", reward => 9950 }, 16384 => { type => "chest piece", reward => 47654 }, 16385 => { type => "Sleeves", reward => 11876 }, 16387 => { type => "gloves", reward => 13627 }, 16386 => { type => "bracer", reward => 11309 } },
"Warrior" => { 16370=> { type => "boots", reward => 19440 }, 16373 => { type => "Greaves", reward => 16693 }, 16371 => { type => "helm", reward => 9629 }, 16375 => { type => "chest piece", reward => 47642 }, 16372 => { type => "Sleeves", reward => 11429 }, 16374 => { type => "gloves", reward => 12595 }, 16369 => { type => "bracer", reward => 11138 } },
);

sub EVENT_SAY
{
if ($text =~/Hail/i)
{
quest::say ("Good day to you, $name. The Pirates in Dulak are a menace to the sea-faring travelers in Norrath and must be stopped! They will occasionally drop armor molds/patterns that I can change into [armor] suitable for your class. I can send you there [now] if you like.");
}
elsif ($text =~/armor/i)
{
quest::say ("Yes, it is said that some of the Pirates of Dulak hold instructions for basic armor crafting. I think they sound perfect for a novice crafter such as myself. Would you like to hear more [rumors] about the instructions? ");
}
elsif ($text =~/rumors/i)
{
quest::say ("I hear the easier parts to make are kept by the common Pirates you will find there, but the harder leggings and chest instructions are only to be had by Captain Varns himself, and Quigli.");
}
elsif ($text =~/now/i)
{
quest::say ("$name , see you later.");
quest::movepc(225, 518,431,5);
}
}

sub EVENT_ITEM {
my $gaveitem = 0;

foreach my $itemturnin ( sort keys %{ $itemturnins{$class} } ) {
if (plugin::check_handin(\%itemcount, $itemturnin => 1)) {
$gaveitem = 1;
quest::summonitem($itemturnins{$class}{$itemturnin }{reward});
quest::emote("Works to make a piece of armor from the instructions you provided to her." );
quest::say ("Here you go $name. Here is your new $itemturnins{$class}{$itemturnin}{type}");
}
}
if ($gaveitem == 0) {
quest::say("I didn't ask for this! Take your garbage elsewhere, I am not a miracle worker!");
}
plugin::return_items(\%itemcount);

}

trevius
09-08-2008, 03:42 AM
Strait writes quests in a completely different way than I do, so that is a little hard for me to read. But, you might want to start by removing all of the elsifs from your EVENT_SAY, and change them to just plain "if" instead. I am pretty sure elsif will break the quest completely using it like that.

The best way to troubleshoot a problem like that is to start with just the EVENT_SAY section and test to make sure that works. Then, add in the rest in small examples piece by piece until you get it all working. That hash looks a little complex to me lol.

I don't think Strait tested his code at all, but if you use the code I posted in this thread, it works perfectly. Though, mine could probably use better commenting to make it easier to understand. But it is pretty straight forward.

If I was to write it all over again now, I am sure it would be much smaller and cleaner lol. I have learned a lot since that submission.

Frothel
09-09-2008, 09:54 AM
I modified your code to work for my server, and it still does not work, am I missing something?

#An Armor Quest for all classes
sub EVENT_SAY
{
if ($text =~/Hail/i)
{
quest::say ("Good day to you, $name. The Pirates in Dulak are a menace to the sea-faring travelers in Norrath and must be stopped! They will occasionally drop armor molds/patterns that I can change into [armor] suitable for your class. I can send you there [now] if you like.");
}
if ($text =~/armor/i)
{
quest::say ("Yes, it is said that some of the Pirates of Dulak hold instructions for basic armor crafting. I think they sound perfect for a novice crafter such as myself. Would you like to hear more [rumors] about the patterns? ");
}
if ($text =~/rumors/i)
{
quest::say ("I hear the easier parts to make are kept by the common Pirates you will find there, but the harder leggings and chest instructions are only to be had by Captain Varns himself, and Quigli.");
}
if ($text =~/now/i)
{
quest::say ("$name , see you later.");
quest::movepc(225, 518,431,5);
}
}

sub EVENT_ITEM {
if ($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') {
if (plugin::check_handin(\%itemcount, 16298 => 1)) {
my %rewards = (
"Warrior" => 19440, "Shadowknight" => 19546, "Paladin" => 19449, "Bard" => 19549, "Cleric" => 20074
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') {
if (plugin::check_handin(\%itemcount, 16344 => 1)) {
my %rewards = (
"Warrior" => 16693, "Shadowknight" => 16763, "Paladin" => 16757, "Bard" => 16771, "Cleric" => 16797
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}

if ($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') {
if (plugin::check_handin(\%itemcount, 16299 => 1)) {
my %rewards = (
"Warrior" => 9629, "Shadowknight" => 9815, "Paladin" => 9812, "Bard" => 9818, "Cleric" => 9827
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') {
if (plugin::check_handin(\%itemcount, 16346 => 1)) {
my %rewards = (
"Warrior" => 47642, "Shadowknight" => 47645, "Paladin" => 47644, "Bard" => 47643, "Cleric" => 47646
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}

if ($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') {
if (plugin::check_handin(\%itemcount, 16343 => 1)) {
my %rewards = (
"Warrior" => 11429, "Shadowknight" => 11441, "Paladin" => 11438, "Bard" => 11444, "Cleric" => 32012
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') {
if (plugin::check_handin(\%itemcount, 16345 => 1)) {
my %rewards = (
"Warrior" => 12595, "Shadowknight" => 12637, "Paladin" => 12627, "Bard" => 12664, "Cleric" => 13563
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') {
if (plugin::check_handin(\%itemcount, 16297 => 1)) {
my %rewards = (
"Warrior" => 11138, "Shadowknight" => 11173, "Paladin" => 11163, "Bard" => 11178, "Cleric" => 11199
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') {
if (plugin::check_handin(\%itemcount, 16296 => 1)) {
my %rewards = (
"Berserker" => 55509, "Ranger" => 19838, "Rogue" => 19443, "Shaman" => 20078
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') {
if (plugin::check_handin(\%itemcount, 16295 => 1)) {
my %rewards = (
"Berserker" => 55512, "Ranger" => 16777, "Rogue" => 16717, "Shaman" => 16803
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') {
if (plugin::check_handin(\%itemcount, 16290 => 1)) {
my %rewards = (
"Berserker" => 55513, "Ranger" => 9821, "Rogue" => 9806, "Shaman" => 9830
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') {
if (plugin::check_handin(\%itemcount, 16291 => 1)) {
my %rewards = (
"Berserker" => 55511, "Ranger" => 47647, "Rogue" => 47648, "Shaman" => 47649
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') {
if (plugin::check_handin(\%itemcount, 16292 => 1)) {
my %rewards = (
"Berserker" => 55508, "Ranger" => 11447, "Rogue" => 11432, "Shaman" => 11529
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') {
if (plugin::check_handin(\%itemcount, 16294 => 1)) {
my %rewards = (
"Berserker" => 55514, "Ranger" => 12598, "Rogue" => 12598, "Shaman" => 13579
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') {
if (plugin::check_handin(\%itemcount, 16293 => 1)) {
my %rewards = (
"Berserker" => 55510, "Ranger" => 11193, "Rogue" => 11141, "Shaman" => 11278
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Enchanter' || $class == 'Magician' || $class == 'Necromancer' || $class == 'Wizard') {
if (plugin::check_handin(\%itemcount, 16360 => 1)) {
my %rewards = (
"Enchanter" => 20425, "Magician" => 20428, "Necromancer" => 20431, "Wizard" => 20434
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Enchanter' || $class == 'Magician' || $class == 'Necromancer' || $class == 'Wizard') {
if (plugin::check_handin(\%itemcount, 16359 => 1)) {
my %rewards = (
"Enchanter" => 16931, "Magician" => 19021, "Necromancer" => 19024, "Wizard" => 19027
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Enchanter' || $class == 'Magician' || $class == 'Necromancer' || $class == 'Wizard') {
if (plugin::check_handin(\%itemcount, 16354 => 1)) {
my %rewards = (
"Enchanter" => 9836, "Magician" => 9944, "Necromancer" => 9947, "Wizard" => 9950
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Enchanter' || $class == 'Magician' || $class == 'Necromancer' || $class == 'Wizard') {
if (plugin::check_handin(\%itemcount, 16355 => 1)) {
my %rewards = (
"Enchanter" => 47656, "Magician" => 47655, "Necromancer" => 47653, "Wizard" => 47654
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Enchanter' || $class == 'Magician' || $class == 'Necromancer' || $class == 'Wizard') {
if (plugin::check_handin(\%itemcount, 16356 => 1)) {
my %rewards = (
"Enchanter" => 11578, "Magician" => 11598, "Necromancer" => 11618, "Wizard" => 11876
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Enchanter' || $class == 'Magician' || $class == 'Necromancer' || $class == 'Wizard') {
if (plugin::check_handin(\%itemcount, 16358 => 1)) {
my %rewards = (
"Enchanter" => 13614, "Magician" => 13619, "Necromancer" => 13623, "Wizard" => 13627
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Enchanter' || $class == 'Magician' || $class == 'Necromancer' || $class == 'Wizard') {
if (plugin::check_handin(\%itemcount, 16357 => 1)) {
my %rewards = (
"Enchanter" => 11298, "Magician" => 11303, "Necromancer" => 11306, "Wizard" => 11309
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') {
if (plugin::check_handin(\%itemcount, 16353 => 1)) {
my %rewards = (
"Beastlord" => 20032, "Druid" => 20422, "Monk" => 19446
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') {
if (plugin::check_handin(\%itemcount, 16352 => 1)) {
my %rewards = (
"Beastlord" => 16787, "Druid" => 16811, "Monk" => 16727
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') {
if (plugin::check_handin(\%itemcount, 16347 => 1)) {
my %rewards = (
"Beastlord" => 9824, "Druid" => 9833, "Monk" => 9809
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') {
if (plugin::check_handin(\%itemcount, 16348 => 1)) {
my %rewards = (
"Beastlord" => 47652, "Druid" => 47651, "Monk" => 47650
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') {
if (plugin::check_handin(\%itemcount, 16349 => 1)) {
my %rewards = (
"Beastlord" => 11450, "Druid" => 11575, "Monk" => 11435
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') {
if (plugin::check_handin(\%itemcount, 16351 => 1)) {
my %rewards = (
"Beastlord" => 13553, "Druid" => 13603, "Monk" => 12624
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
if ($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') {
if (plugin::check_handin(\%itemcount, 16350 => 1)) {
my %rewards = (
"Beastlord" => 1196, "Druid" => 11281, "Monk" => 11146
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}

trevius
09-09-2008, 05:07 PM
Any time you are only checking for certain classes and not all classes, then you have to do a Not Equal check as well for the other classes you don't want to use that turn in.

Don't ask me why it doesn't work the other way, as I have no clue. I also don't know why for equals you have to use ==, but for not equals, you have to use "ne". It doesn't make sense to me, but it does work.

Here is an example of what I mean:

if (($class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') && ($class ne 'Warrior' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker' && $class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman'))

So, for every if(class) check, you have to include every class and just ne the ones you don't want.

Also, don't forget to add this at the bottom as shown in my example:
else {
plugin::return_items(\%itemcount);
}

Or the NPC will eat any incorrect items turned into it.

I imagine there are much better ways of doing this, but I haven't really gone back and tried lately. The next time I make a similar armor quest using better code, I will definitely post it.

Frothel
09-09-2008, 08:48 PM
Now my code has changed to the below code, thanks to your suggestions =) However, it is still not working in game for some reason:

#An Armor Quest for all classes
sub EVENT_SAY
{
if ($text =~/Hail/i)
{
quest::say ("Good day to you, $name. The Pirates in Dulak are a menace to the sea-faring travelers in Norrath and must be stopped! They will occasionally drop armor molds/patterns that I can change into [armor] suitable for your class. I can send you there [now] if you like.");
}
if ($text =~/armor/i)
{
quest::say ("Yes, it is said that some of the Pirates of Dulak hold instructions for basic armor crafting. I think they sound perfect for a novice crafter such as myself. Would you like to hear more [rumors] about the patterns? ");
}
if ($text =~/rumors/i)
{
quest::say ("I hear the easier parts to make are kept by the common Pirates you will find there, but the harder leggings and chest instructions are only to be had by Captain Varns himself, and Quigli.");
}
if ($text =~/now/i)
{
quest::say ("$name , see you later.");
quest::movepc(225, 518,431,5);
}
}

sub EVENT_ITEM {
if (($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') && ($class ne 'Berserker' && $class ne 'Ranger' && $class ne 'Rogue' && $class ne 'Shaman' && $class ne 'Druid' && $class ne 'Beastlord' && $class ne 'Monk' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16298 => 1)) {
my %rewards = (
"Warrior" => 19440, "Shadowknight" => 19546, "Paladin" => 19449, "Bard" => 19549, "Cleric" => 20074
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') && ($class ne 'Berserker' && $class ne 'Ranger' && $class ne 'Rogue' && $class ne 'Shaman' && $class ne 'Druid' && $class ne 'Beastlord' && $class ne 'Monk' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16344 => 1)) {
my %rewards = (
"Warrior" => 16693, "Shadowknight" => 16763, "Paladin" => 16757, "Bard" => 16771, "Cleric" => 16797
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') && ($class ne 'Berserker' && $class ne 'Ranger' && $class ne 'Rogue' && $class ne 'Shaman' && $class ne 'Druid' && $class ne 'Beastlord' && $class ne 'Monk' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16299 => 1)) {
my %rewards = (
"Warrior" => 9629, "Shadowknight" => 9815, "Paladin" => 9812, "Bard" => 9818, "Cleric" => 9827
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') && ($class ne 'Berserker' && $class ne 'Ranger' && $class ne 'Rogue' && $class ne 'Shaman' && $class ne 'Druid' && $class ne 'Beastlord' && $class ne 'Monk' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16346 => 1)) {
my %rewards = (
"Warrior" => 47642, "Shadowknight" => 47645, "Paladin" => 47644, "Bard" => 47643, "Cleric" => 47646
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') && ($class ne 'Berserker' && $class ne 'Ranger' && $class ne 'Rogue' && $class ne 'Shaman' && $class ne 'Druid' && $class ne 'Beastlord' && $class ne 'Monk' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16343 => 1)) {
my %rewards = (
"Warrior" => 11429, "Shadowknight" => 11441, "Paladin" => 11438, "Bard" => 11444, "Cleric" => 32012
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') && ($class ne 'Berserker' && $class ne 'Ranger' && $class ne 'Rogue' && $class ne 'Shaman' && $class ne 'Druid' && $class ne 'Beastlord' && $class ne 'Monk' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16345 => 1)) {
my %rewards = (
"Warrior" => 12595, "Shadowknight" => 12637, "Paladin" => 12627, "Bard" => 12664, "Cleric" => 13563
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Warrior' || $class == 'Shadowknight' || $class == 'Paladin' || $class == 'Bard' || $class == 'Cleric') && ($class ne 'Berserker' && $class ne 'Ranger' && $class ne 'Rogue' && $class ne 'Shaman' && $class ne 'Druid' && $class ne 'Beastlord' && $class ne 'Monk' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16297 => 1)) {
my %rewards = (
"Warrior" => 11138, "Shadowknight" => 11173, "Paladin" => 11163, "Bard" => 11178, "Cleric" => 11199
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Druid' && $class ne 'Monk' && $class ne 'Beastlord' && $class ne 'Magician' && $class ne 'Enchanter' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16296 => 1)) {
my %rewards = (
"Berserker" => 55509, "Ranger" => 19838, "Rogue" => 19443, "Shaman" => 20078
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Druid' && $class ne 'Monk' && $class ne 'Beastlord' && $class ne 'Magician' && $class ne 'Enchanter' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16295 => 1)) {
my %rewards = (
"Berserker" => 55512, "Ranger" => 16777, "Rogue" => 16717, "Shaman" => 16803
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Druid' && $class ne 'Monk' && $class ne 'Beastlord' && $class ne 'Magician' && $class ne 'Enchanter' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16290 => 1)) {
my %rewards = (
"Berserker" => 55513, "Ranger" => 9821, "Rogue" => 9806, "Shaman" => 9830
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Druid' && $class ne 'Monk' && $class ne 'Beastlord' && $class ne 'Magician' && $class ne 'Enchanter' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16291 => 1)) {
my %rewards = (
"Berserker" => 55511, "Ranger" => 47647, "Rogue" => 47648, "Shaman" => 47649
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Druid' && $class ne 'Monk' && $class ne 'Beastlord' && $class ne 'Magician' && $class ne 'Enchanter' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16292 => 1)) {
my %rewards = (
"Berserker" => 55508, "Ranger" => 11447, "Rogue" => 11432, "Shaman" => 11529
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Druid' && $class ne 'Monk' && $class ne 'Beastlord' && $class ne 'Magician' && $class ne 'Enchanter' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16294 => 1)) {
my %rewards = (
"Berserker" => 55514, "Ranger" => 12598, "Rogue" => 12598, "Shaman" => 13579
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Berserker' || $class == 'Rogue' || $class == 'Ranger' || $class == 'Shaman') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Druid' && $class ne 'Monk' && $class ne 'Beastlord' && $class ne 'Magician' && $class ne 'Enchanter' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16293 => 1)) {
my %rewards = (
"Berserker" => 55510, "Ranger" => 11193, "Rogue" => 11141, "Shaman" => 11278
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') && ($class ne 'Warrior' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker' && $class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman')) {
if (plugin::check_handin(\%itemcount, 16360 => 1)) {
my %rewards = (
"Enchanter" => 20425, "Magician" => 20428, "Necromancer" => 20431, "Wizard" => 20434
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') && ($class ne 'Warrior' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker' && $class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman')) {
if (plugin::check_handin(\%itemcount, 16359 => 1)) {
my %rewards = (
"Enchanter" => 16931, "Magician" => 19021, "Necromancer" => 19024, "Wizard" => 19027
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') && ($class ne 'Warrior' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker' && $class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman')) {
if (plugin::check_handin(\%itemcount, 16354 => 1)) {
my %rewards = (
"Enchanter" => 9836, "Magician" => 9944, "Necromancer" => 9947, "Wizard" => 9950
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') && ($class ne 'Warrior' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker' && $class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman')) {
if (plugin::check_handin(\%itemcount, 16355 => 1)) {
my %rewards = (
"Enchanter" => 47656, "Magician" => 47655, "Necromancer" => 47653, "Wizard" => 47654
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') && ($class ne 'Warrior' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker' && $class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman')) {
if (plugin::check_handin(\%itemcount, 16356 => 1)) {
my %rewards = (
"Enchanter" => 11578, "Magician" => 11598, "Necromancer" => 11618, "Wizard" => 11876
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') && ($class ne 'Warrior' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker' && $class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman')) {
if (plugin::check_handin(\%itemcount, 16358 => 1)) {
my %rewards = (
"Enchanter" => 13614, "Magician" => 13619, "Necromancer" => 13623, "Wizard" => 13627
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') && ($class ne 'Warrior' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker' && $class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman')) {
if (plugin::check_handin(\%itemcount, 16357 => 1)) {
my %rewards = (
"Enchanter" => 11298, "Magician" => 11303, "Necromancer" => 11306, "Wizard" => 11309
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Berserker' && $class ne 'Rogue' && $class ne 'Ranger' && $class ne 'Shaman' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16353 => 1)) {
my %rewards = (
"Beastlord" => 20032, "Druid" => 20422, "Monk" => 19446
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Berserker' && $class ne 'Rogue' && $class ne 'Ranger' && $class ne 'Shaman' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16352 => 1)) {
my %rewards = (
"Beastlord" => 16787, "Druid" => 16811, "Monk" => 16727
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Berserker' && $class ne 'Rogue' && $class ne 'Ranger' && $class ne 'Shaman' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16347 => 1)) {
my %rewards = (
"Beastlord" => 9824, "Druid" => 9833, "Monk" => 9809
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Berserker' && $class ne 'Rogue' && $class ne 'Ranger' && $class ne 'Shaman' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16348 => 1)) {
my %rewards = (
"Beastlord" => 47652, "Druid" => 47651, "Monk" => 47650
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Berserker' && $class ne 'Rogue' && $class ne 'Ranger' && $class ne 'Shaman' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16349 => 1)) {
my %rewards = (
"Beastlord" => 11450, "Druid" => 11575, "Monk" => 11435
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Berserker' && $class ne 'Rogue' && $class ne 'Ranger' && $class ne 'Shaman' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16351 => 1)) {
my %rewards = (
"Beastlord" => 13553, "Druid" => 13603, "Monk" => 12624
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
}
if (($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Berserker' && $class ne 'Rogue' && $class ne 'Ranger' && $class ne 'Shaman' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16350 => 1)) {
my %rewards = (
"Beastlord" => 1196, "Druid" => 11281, "Monk" => 11146
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
else {
plugin::return_items(\%itemcount);
}
}
}

trevius
09-09-2008, 09:58 PM
The best way to solve a quest issue is to copy your entire quest into notepad so you don't lose it and then start with just 1 very small section at a time to make sure they work. Eventually you will get to a point where it doesn't work at all and you will know that the last thing you added is what caused it.

Try just using this from your code as the entire quest:

sub EVENT_ITEM {

if (($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Berserker' && $class ne 'Rogue' && $class ne 'Ranger' && $class ne 'Shaman' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16350 => 1)) {
my %rewards = (
"Beastlord" => 1196, "Druid" => 11281, "Monk" => 11146
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
else {
plugin::return_items(\%itemcount);
}
}
}

Test that and see if it works. If it doesn't, the I think you probably have a plugin problem. You will need to make sure that you moved your plugins from the quests/plugins folder into your eqemu/plugins folder. Without the plugins in the right place, these item exchanges can't work. Also, you might want to run the check syntax button on GeorgeS quest editor tool to verify that you aren't missing any brackets. Remember that a single extra bracket or quote missing or in the wrong place can break the entire quest.

Frothel
09-10-2008, 09:48 AM
Moving the plugins is what worked, thank you =)

ChaosSlayerZ
06-03-2009, 05:25 PM
Trev, can't

$class == 'Warrior'

be replaced with

$class == 1

?

trevius
06-03-2009, 05:44 PM
Since that quest, I have refined our armor scripts that use Arrays a bit to make them cleaner and a bit easier to manage. If done properly, I don't think the whole "if $class" stuff needs to be checked at all. Here is an example of the new format we use on Storm Haven for a bit more advanced Arrays for armor quests:

#Rough Defiant Armor Quests

%GetArmorType = ( #Convert each Class Name into an Armor Type Name
"Warrior" => "Plate",
"Rogue" => "Chain",
"Monk" => "Leather",
"Berserker" => "Chain",
"Shadowknight" => "Plate",
"Paladin" => "Plate",
"Ranger" => "Chain",
"Bard" => "Plate",
"Beastlord" => "Leather",
"Cleric" => "Plate",
"Druid" => "Leather",
"Shaman" => "Chain",
"Wizard" => "Cloth",
"Magician" => "Cloth",
"Enchanter" => "Cloth",
"Necromancer" => "Cloth"
);

%ArmorSlot = ( #Convert each Slot Name into a String for use in the Rewards Choosing
"Bracer" => "_Bracer",
"Gauntlets" => "_Gauntlets",
"Boots" => "_Boots",
"Helm" => "_Helm",
"Vambraces" => "_Vambraces",
"Greaves" => "_Greaves",
"Breastplate" => "_Breastplate",
);

%SimpleArmor = ( #Name each item appropriately for use With the Armor Type And Armor Slot selections
"Plate_Bracer" => 50033, #Simple Defiant Plate Bracer
"Plate_Gauntlets" => 50034, #Simple Defiant Plate Gauntlets
"Plate_Boots" => 50035, #Simple Defiant Plate Boots
"Plate_Helm" => 50036, #Simple Defiant Plate Helm
"Plate_Vambraces" => 50037, #Simple Defiant Plate Vambraces
"Plate_Greaves" => 50038, #Simple Defiant Plate Greaves
"Plate_Breastplate" => 50039, #Simple Defiant Breastplate

"Chain_Bracer" => 50040, #Simple Defiant Chain Bracer
"Chain_Gauntlets" => 50041, #Simple Defiant Chain Gauntlets
"Chain_Boots" => 50042, #Simple Defiant Chain Boots
"Chain_Helm" => 50043, #Simple Defiant Chain Coif
"Chain_Vambraces" => 50044, #Simple Defiant Chain Sleeves
"Chain_Greaves" => 50045, #Simple Defiant Chain Leggings
"Chain_Breastplate" => 50046, #Simple Defiant Chain Tunic

"Leather_Bracer" => 50047, #Simple Defiant Leather Bracer
"Leather_Gauntlets" => 50048, #Simple Defiant Leather Gloves
"Leather_Boots" => 50049, #Simple Defiant Leather Boots
"Leather_Helm" => 50050, #Simple Defiant Leather Cap
"Leather_Vambraces" => 50051, #Simple Defiant Leather Sleeves
"Leather_Greaves" => 50052, #Simple Defiant Leather Trousers
"Leather_Breastplate" => 50053, #Simple Defiant Leather Tunic

"Cloth_Bracer" => 50054, #Simple Defiant Cloth Wristwrap
"Cloth_Gauntlets" => 50055, #Simple Defiant Cloth Gloves
"Cloth_Boots" => 50056, #Simple Defiant Cloth Sandals
"Cloth_Helm" => 50057, #Simple Defiant Cloth Cap
"Cloth_Vambraces" => 50058, #Simple Defiant Cloth Sleeves
"Cloth_Greaves" => 50059, #Simple Defiant Cloth Pantaloons
"Cloth_Breastplate" => 50060, #Simple Defiant Cloth Robe
);

%Rewards = (
"Plate_Bracer" => 50061, #Rough Defiant Plate Bracer
"Plate_Gauntlets" => 50062, #Rough Defiant Plate Gauntlets
"Plate_Boots" => 50063, #Rough Defiant Plate Boots
"Plate_Helm" => 50064, #Rough Defiant Plate Helm
"Plate_Vambraces" => 50065, #Rough Defiant Plate Vambraces
"Plate_Greaves" => 50066, #Rough Defiant Plate Greaves
"Plate_Breastplate" => 50067, #Rough Defiant Breastplate

"Chain_Bracer" => 50068, #Rough Defiant Chain Bracer
"Chain_Gauntlets" => 50069, #Rough Defiant Chain Gauntlets
"Chain_Boots" => 50070, #Rough Defiant Chain Boots
"Chain_Helm" => 50071, #Rough Defiant Chain Coif
"Chain_Vambraces" => 50072, #Rough Defiant Chain Sleeves
"Chain_Greaves" => 50073, #Rough Defiant Chain Leggings
"Chain_Breastplate" => 50074, #Rough Defiant Chain Tunic

"Leather_Bracer" => 50075, #Rough Defiant Leather Bracer
"Leather_Gauntlets" => 50076, #Rough Defiant Leather Gloves
"Leather_Boots" => 50077, #Rough Defiant Leather Boots
"Leather_Helm" => 50078, #Rough Defiant Leather Cap
"Leather_Vambraces" => 50079, #Rough Defiant Leather Sleeves
"Leather_Greaves" => 50080, #Rough Defiant Leather Trousers
"Leather_Breastplate" => 50081, #Rough Defiant Leather Tunic

"Cloth_Bracer" => 50082, #Rough Defiant Cloth Wristwrap
"Cloth_Gauntlets" => 50083, #Rough Defiant Cloth Gloves
"Cloth_Boots" => 50084, #Rough Defiant Cloth Sandals
"Cloth_Helm" => 50085, #Rough Defiant Cloth Cap
"Cloth_Vambraces" => 50086, #Rough Defiant Cloth Sleeves
"Cloth_Greaves" => 50087, #Rough Defiant Cloth Pantaloons
"Cloth_Breastplate" => 50088, #Rough Defiant Cloth Robe
);

sub EVENT_SAY {

# Get the Armor Type of the Character character currently speaking With this NPC
my $ArmorType = $GetArmorType{$class};

#Create the full name of each item for the Rewards array
my $Bracer = "$ArmorType$ArmorSlot{Bracer}";
my $Gauntlets = "$ArmorType$ArmorSlot{Gauntlets}";
my $Boots = "$ArmorType$ArmorSlot{Boots}";
my $Helm = "$ArmorType$ArmorSlot{Helm}";
my $Vambraces = "$ArmorType$ArmorSlot{Vambraces}";
my $Greaves = "$ArmorType$ArmorSlot{Greaves}";
my $Breastplate = "$ArmorType$ArmorSlot{Breastplate}";

#Create the Item Links from the Rewards Array for use in say messages
my $Bracer_Link = quest::varlink($Rewards{$Bracer});
my $Gauntlets_Link = quest::varlink($Rewards{$Gauntlets});
my $Boots_Link = quest::varlink($Rewards{$Boots});
my $Helm_Link = quest::varlink($Rewards{$Helm});
my $Vambraces_Link = quest::varlink($Rewards{$Vambraces});
my $Greaves_Link = quest::varlink($Rewards{$Greaves});
my $Breastplate_Link = quest::varlink($Rewards{$Breastplate});

if($text=~/hail/i)
{
quest::say("What a fine looking $class you are.
You look Like you could use some new $ArmorType [armor], though.");
}

if($text=~/armor/i)
{
quest::say("I can provide you with the following if you are [interested]:");
quest::say("A $Bracer_Link");
quest::say("A $Gauntlets_Link");
quest::say("A $Boots_Link");
quest::say("A $Helm_Link");
quest::say("A $Vambraces_Link");
quest::say("A $Greaves_Link");
quest::say("A $Breastplate_Link");
}

if($text=~/interested/i)
{
quest::say("You will need to collect some items for me.
But, I don't have a list of those needed item yet.
(quest is still in progress of being finished)");
}

}

sub EVENT_ITEM {

# Get the Armor Type of the Character character currently speaking With this NPC
my $ArmorType = $GetArmorType{$class};

#Create the full name of each item for the Rewards array
my $Bracer = "$ArmorType$ArmorSlot{Bracer}";
my $Gauntlets = "$ArmorType$ArmorSlot{Gauntlets}";
my $Boots = "$ArmorType$ArmorSlot{Boots}";
my $Helm = "$ArmorType$ArmorSlot{Helm}";
my $Vambraces = "$ArmorType$ArmorSlot{Vambraces}";
my $Greaves = "$ArmorType$ArmorSlot{Greaves}";
my $Breastplate = "$ArmorType$ArmorSlot{Breastplate}";

#Reward for turning in the Bracer piece
if (plugin::check_handin(\%itemcount, $SimpleArmor{$Bracer} => 1, 1001 => 1)) {
quest::summonitem($Rewards{$Bracer});
quest::exp(450);
quest::say ("There you go, $name. You're looking tougher already!");
}

#Reward for turning in the Gauntlets piece
if (plugin::check_handin(\%itemcount, $SimpleArmor{$Gauntlets} => 1, 1001 => 1)) {
quest::summonitem($Rewards{$Gauntlets});
quest::exp(450);
quest::say ("There you go, $name. You're looking tougher already!");
}

#Reward for turning in the Boots piece
if (plugin::check_handin(\%itemcount, $SimpleArmor{$Boots} => 1, 1001 => 1)) {
quest::summonitem($Rewards{$Boots});
quest::exp(450);
quest::say ("There you go, $name. You're looking tougher already!");
}

#Reward for turning in the Helm piece
if (plugin::check_handin(\%itemcount, $SimpleArmor{$Helm} => 1, 1001 => 1)) {
quest::summonitem($Rewards{$Helm});
quest::exp(450);
quest::say ("There you go, $name. You're looking tougher already!");
}

#Reward for turning in the Vambraces piece
if (plugin::check_handin(\%itemcount, $SimpleArmor{$Vambraces} => 1, 1001 => 1)) {
quest::summonitem($Rewards{$Vambraces});
quest::exp(450);
quest::say ("There you go, $name. You're looking tougher already!");
}

#Reward for turning in the Greaves piece
if (plugin::check_handin(\%itemcount, $SimpleArmor{$Greaves} => 1, 1001 => 1)) {
quest::summonitem($Rewards{$Greaves});
quest::exp(450);
quest::say ("There you go, $name. You're looking tougher already!");
}

#Reward for turning in the Breastplate piece
if (plugin::check_handin(\%itemcount, $SimpleArmor{$Breastplate} => 1, 1001 => 1)) {
quest::summonitem($Rewards{$Breastplate});
quest::exp(450);
quest::say ("There you go, $name. You're looking tougher already!");
}

else
{
plugin::return_items(\%itemcount);
}

}

Of course, this script takes it a step further and defines the armor type for each class and then uses that to find which classes should get which piece of armor. This script could be simplified to just map each piece of armor to a specific class, which shouldn't be too hard to figure out for people wanting to do that.

ChaosSlayerZ
06-03-2009, 06:06 PM
looks interetsing, but you not answering my question though =P

I have looked at the quest wiki, and it doesn't say anywhere if numbers instead of class names can be used for the IF check - you know like 1 (warrior), 7 (monk) etc

trevius
06-03-2009, 06:13 PM
Technically, it should have been "$class eq 'Warrior'", not "$class == 'Warrior'", but I could never get it to work that way for some reason. My best guess is that it is automatically replacing the class name with the number. If so, then I don't see any reason why using the numbers wouldn't work. It might be a bit harder to reference what is going on in your scripts though if you do.

The reason I mentioned the new code I am using is because checking for which class it is should not have to be done with an array, since $class already does that. You just have to do things in the right order for them to work properly. It can make scripts much easier to manage. I am probably going to try to work up some more similar variations to the script above that I just posted. I will try to get one up that also has arrays for turn ins. It should make dealing with armor quests or epic quests considerably cleaner and much less scripting.

Andrew80k
06-03-2009, 06:19 PM
Actually, it should be $class eq "Warrior" with double quotes. Using single quotes is an array of char's, while double quotes is used for strings. Maybe why it didn't work. I like the way you do it now with the hashes. That's pretty slick. I love perl.

Andrew80k
06-03-2009, 06:23 PM
looks interetsing, but you not answering my question though =P

I have looked at the quest wiki, and it doesn't say anywhere if numbers instead of class names can be used for the IF check - you know like 1 (warrior), 7 (monk) etc
Perl is fairly type agnostic, but C++ is not. To answer your question you'd have to look at what $class represents. My guess is the answer is no as the $class variable holds a string with a value of "Warrior" and not a numeric value. And that is exported via the C++

trevius
06-03-2009, 06:44 PM
If you really had a reason to use numbers for classes, it would be easy to make a hash to do it. But, it would just be extra work that isn't really needed unless you needed numbers to do a random or something. Here is an example:

%ClassConvert = ( #Convert each Class Name into a Number
"Warrior" => 1,
"Rogue" => 2,
"Monk" => 3,
"Berserker" => 4,
"Shadowknight" => 5,
"Paladin" => 6,
"Ranger" => 7,
"Bard" => 8,
"Beastlord" => 9,
"Cleric" => 10,
"Druid" => 11,
"Shaman" => 12,
"Wizard" => 13,
"Magician" => 14,
"Enchanter" => 15,
"Necromancer" => 16
);

Note: These numbers are in no particular order and are definitely not the normal order EQ knows these classes as.

Then, to get that class number, you could just do this:

my $classnum = $ClassConvert{$class};

You would want to do that conversion inside the EVENT you are using it on, so it does the conversion each time that something triggers that event so it can be accurate for the current class doing it.

Then, you can do:

if ($classnum == 1)
quest::say("You are a Warrior!");

I am sure there are other ways to do it, but if that is something you were needing, this way should work fine for you.

joligario
06-03-2009, 08:36 PM
There might be a $client->GetClass() type of command also. I know when I was working on $client->GetBaseRace(), it gives an integer rather than "Erudite".

Zeice
06-16-2009, 02:10 PM
I'm just curious but can this code be used to summon more than one item for a specific class? For example if I need to summon 2 weapons for a class who dual wields. I've tried a few things but I couldn't get anything to work.



sub EVENT_ITEM {

if (($class == 'Beastlord' || $class == 'Druid' || $class == 'Monk') && ($class ne 'Warrior' && $class ne 'Cleric' && $class ne 'Bard' && $class ne 'Paladin' && $class ne 'Shadowknight' && $class ne 'Berserker' && $class ne 'Rogue' && $class ne 'Ranger' && $class ne 'Shaman' && $class ne 'Enchanter' && $class ne 'Magician' && $class ne 'Necromancer' && $class ne 'Wizard')) {
if (plugin::check_handin(\%itemcount, 16350 => 1)) {
my %rewards = (
"Beastlord" => 1196, "Druid" => 11281, "Monk" => 11146
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
$client->Message(6, "Sheley Courilan works to make a piece of armor from the instructions you provided to her." );
quest::exp(10);
quest::say ("Here you go, $name.");
}
}
else {
plugin::return_items(\%itemcount);
}
}
}

trevius
06-16-2009, 05:09 PM
For classes that get more than 1 reward as their epic 1.0, I just had to make sections for each of them:

if (($class == 'Warrior') && ($class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman' && $class ne 'Wizard' && $class ne 'Magician' && $class ne 'Enchanter' && $class ne 'Necromancer' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker'))
{
if (plugin::check_handin(\%itemcount, 1384 => 1, 1385 => 1, 1387 => 1)) {
quest::summonitem(10908);
quest::summonitem(17859);
$client->Message(6, "Brendor Lan'ise diligently fashions the pieces together with great skill and precision." );
quest::exp(45000);
quest::say ("Take care of this, $name, and it will take care of you. You will need it for future Epic Quests.");
}
else {
plugin::return_items(\%itemcount);
#quest::say("I have no use for this item, $name. Take it back.");
}
}

Though, it probably wouldn't be all too hard to rewrite it to use hashes and some IFs to make a single block like this handle rewards and turn ins for all classes.

Zeice
06-16-2009, 06:26 PM
Thanks, that got it. I was trying a few things to do it in one block but I'm not knowledgeable enough in perl to do so. Using if, elsif, statements worked flawlessly.

Lillu
06-17-2009, 01:50 PM
[QUOTE=Andrew80k;171254]Actually, it should be $class eq "Warrior" with double quotes. Using single quotes is an array of char's, while double quotes is used for strings.QUOTE]
This solved another problem of mine. Thanks Andrew80K.

Lillu
06-17-2009, 01:51 PM
no idea how, but double post.. sry ><

Sinister
09-03-2009, 12:57 PM
Thanks for the quest trev. I have edited the quest some but every time I turn in an item the NPC always says "I have no use for this item NAME, take it back". He says it whether I give him the right item, or if I give him a wrong item. He also never gives any item back. Here is the code im using:


sub EVENT_SAY
{

my $armor = quest::saylink("Armor");
my $rumor = quest::saylink("Rumors");

if ($text =~/Hail/i)
{
quest::say ("Hey there, $name. As you know chaos has taken our land, and this is the only safehaven left for us. The minions of chaos have started their infiltration into our palace here, and we need your help! If you head into the castle, please see if you can find any of their instructions for [$armor] crafting. That way I can aid you in your fight against Chaos.");
}
if ($text =~/armor/i)
{
quest::say ("Yes, it is said that some of the minions inside the castle hold instructions for basic armor crafting. I think they sound perfect for a novice crafter such as myself. Would you like to hear more [$rumor] about the instructions? ");
}
if ($text =~/rumors/i)
{
quest::say ("I hear the easier parts to make are kept by the common minions you will find there, but the harder leggings and chest instructions are only to be had by the leaders.");
}

}

sub EVENT_ITEM {
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Shadowkight' || $class ==
'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Cleric' || $class == 'Druid' || $class ==
'Shaman' || $class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') {
#Gloves
if (plugin::check_handin(\%itemcount, 1119 => 1)) {
my %rewards = (
"Warrior" => 27583, "Rogue" => 22690, "Monk" => 1319, "Shadowknight" => 19892, "Paladin" => 61149, "Ranger" => 27514,
"Bard" => 27528, "Cleric" => 20313, "Druid" => 19682, "Shaman" => 55122, "Wizard" => 63032, "Magician" => 27384, "Enchanter"
=> 20327, "Necromancer" => 22595
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Bracer
if (plugin::check_handin(\%itemcount, 1261 => 1)) {
my %rewards = (
"Warrior" => 27579, "Rogue" => 22686, "Monk" => 1323, "Shadowknight" => 19891, "Paladin" => 61145, "Ranger" => 27510,
"Bard" => 27524, "Cleric" => 20309, "Druid" => 19681, "Shaman" => 55121, "Wizard" => 63087, "Magician" => 27380, "Enchanter"
=> 20323, "Necromancer" => 22591
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Arms
if (plugin::check_handin(\%itemcount, 1264 => 1)) {
my %rewards = (
"Warrior" => 27580, "Rogue" => 22687, "Monk" => 1352, "Shadowknight" => 19890, "Paladin" => 61146, "Ranger" => 27511,
"Bard" => 27525, "Cleric" => 20310, "Druid" => 19680, "Shaman" => 55120, "Wizard" => 63077, "Magician" => 27381, "Enchanter"
=> 20324, "Necromancer" => 22593
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Helm
if (plugin::check_handin(\%itemcount, 1265 => 1)) {
my %rewards = (
"Warrior" => 27578, "Rogue" => 22685, "Monk" => 1353, "Shadowknight" => 19888, "Paladin" => 61144, "Ranger" => 27509,
"Bard" => 27523, "Cleric" => 20308, "Druid" => 19678, "Shaman" => 55119, "Wizard" => 63034, "Magician" => 27379, "Enchanter"
=> 20322, "Necromancer" => 22590
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Boots
if (plugin::check_handin(\%itemcount, 1266 => 1)) {
my %rewards = (
"Warrior" => 27581, "Rogue" => 22688, "Monk" => 1372, "Shadowknight" => 19894, "Paladin" => 61147, "Ranger" => 27512,
"Bard" => 27526, "Cleric" => 20311, "Druid" => 19684, "Shaman" => 55123, "Wizard" => 63033, "Magician" => 27382, "Enchanter"
=> 20325, "Necromancer" => 22592
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Legs
if (plugin::check_handin(\%itemcount, 1267 => 1)) {
my %rewards = (
"Warrior" => 27582, "Rogue" => 22689, "Monk" => 1373, "Shadowknight" => 19893, "Paladin" => 61148, "Ranger" => 27513,
"Bard" => 27527, "Cleric" => 20312, "Druid" => 19683, "Shaman" => 55124, "Wizard" => 63078, "Magician" => 27383, "Enchanter"
=> 20326, "Necromancer" => 22594
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Breastplate
if (plugin::check_handin(\%itemcount, 1270 => 1)) {
my %rewards = (
"Warrior" => 27584, "Rogue" => 22692, "Monk" => 1374, "Shadowknight" => 19889, "Paladin" => 61150, "Ranger" => 27515,
"Bard" => 27529, "Cleric" => 20314, "Druid" => 19679, "Shaman" => 55125, "Wizard" => 63040, "Magician" => 27385, "Enchanter"
=> 20328, "Necromancer" => 22596
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
else {
plugin::return_items(\%itemcount);
quest::say("I have no use for this item, $name. Take it back.");
}
}
}

Lillu
09-03-2009, 01:41 PM
I think just some "if" should be "elsif", see below (cant test it atm though, but should work).

sub EVENT_SAY
{

my $armor = quest::saylink("Armor");
my $rumor = quest::saylink("Rumors");

if ($text =~/Hail/i)
{
quest::say ("Hey there, $name. As you know chaos has taken our land, and this is the only safehaven left for us. The minions of chaos have started their infiltration into our palace here, and we need your help! If you head into the castle, please see if you can find any of their instructions for [$armor] crafting. That way I can aid you in your fight against Chaos.");
}
if ($text =~/armor/i)
{
quest::say ("Yes, it is said that some of the minions inside the castle hold instructions for basic armor crafting. I think they sound perfect for a novice crafter such as myself. Would you like to hear more [$rumor] about the instructions? ");
}
if ($text =~/rumors/i)
{
quest::say ("I hear the easier parts to make are kept by the common minions you will find there, but the harder leggings and chest instructions are only to be had by the leaders.");
}

}

sub EVENT_ITEM {
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Shadowkight' || $class ==
'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Cleric' || $class == 'Druid' || $class ==
'Shaman' || $class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') {
#Gloves
if (plugin::check_handin(\%itemcount, 1119 => 1)) {
my %rewards = (
"Warrior" => 27583, "Rogue" => 22690, "Monk" => 1319, "Shadowknight" => 19892, "Paladin" => 61149, "Ranger" => 27514,
"Bard" => 27528, "Cleric" => 20313, "Druid" => 19682, "Shaman" => 55122, "Wizard" => 63032, "Magician" => 27384, "Enchanter"
=> 20327, "Necromancer" => 22595
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Bracer
elsif (plugin::check_handin(\%itemcount, 1261 => 1)) {
my %rewards = (
"Warrior" => 27579, "Rogue" => 22686, "Monk" => 1323, "Shadowknight" => 19891, "Paladin" => 61145, "Ranger" => 27510,
"Bard" => 27524, "Cleric" => 20309, "Druid" => 19681, "Shaman" => 55121, "Wizard" => 63087, "Magician" => 27380, "Enchanter"
=> 20323, "Necromancer" => 22591
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Arms
elsif (plugin::check_handin(\%itemcount, 1264 => 1)) {
my %rewards = (
"Warrior" => 27580, "Rogue" => 22687, "Monk" => 1352, "Shadowknight" => 19890, "Paladin" => 61146, "Ranger" => 27511,
"Bard" => 27525, "Cleric" => 20310, "Druid" => 19680, "Shaman" => 55120, "Wizard" => 63077, "Magician" => 27381, "Enchanter"
=> 20324, "Necromancer" => 22593
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Helm
elsif (plugin::check_handin(\%itemcount, 1265 => 1)) {
my %rewards = (
"Warrior" => 27578, "Rogue" => 22685, "Monk" => 1353, "Shadowknight" => 19888, "Paladin" => 61144, "Ranger" => 27509,
"Bard" => 27523, "Cleric" => 20308, "Druid" => 19678, "Shaman" => 55119, "Wizard" => 63034, "Magician" => 27379, "Enchanter"
=> 20322, "Necromancer" => 22590
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Boots
elsif (plugin::check_handin(\%itemcount, 1266 => 1)) {
my %rewards = (
"Warrior" => 27581, "Rogue" => 22688, "Monk" => 1372, "Shadowknight" => 19894, "Paladin" => 61147, "Ranger" => 27512,
"Bard" => 27526, "Cleric" => 20311, "Druid" => 19684, "Shaman" => 55123, "Wizard" => 63033, "Magician" => 27382, "Enchanter"
=> 20325, "Necromancer" => 22592
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Legs
elsif (plugin::check_handin(\%itemcount, 1267 => 1)) {
my %rewards = (
"Warrior" => 27582, "Rogue" => 22689, "Monk" => 1373, "Shadowknight" => 19893, "Paladin" => 61148, "Ranger" => 27513,
"Bard" => 27527, "Cleric" => 20312, "Druid" => 19683, "Shaman" => 55124, "Wizard" => 63078, "Magician" => 27383, "Enchanter"
=> 20326, "Necromancer" => 22594
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
#Breastplate
elsif (plugin::check_handin(\%itemcount, 1270 => 1)) {
my %rewards = (
"Warrior" => 27584, "Rogue" => 22692, "Monk" => 1374, "Shadowknight" => 19889, "Paladin" => 61150, "Ranger" => 27515,
"Bard" => 27529, "Cleric" => 20314, "Druid" => 19679, "Shaman" => 55125, "Wizard" => 63040, "Magician" => 27385, "Enchanter"
=> 20328, "Necromancer" => 22596
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("Works to make a piece of armor from the instructions you provided to him." );
quest::say ("Here you go $name.");
}
}
else {
plugin::return_items(\%itemcount);
quest::say("I have no use for this item, $name. Take it back.");
}
}
}

Sinister
09-03-2009, 01:49 PM
Thanks so much for your help Lillu, I will test this when I am at home from work :)