trevius
09-11-2009, 08:37 PM
This script is for armor quests based on Armor type. So, all plate classes get the same rewards, all chain get the same rewards and so on. In this example, I used the Simple Defiant Armor set, but you could easily swap in any armor set that is based on armor type like this. It also makes use of Saylinks and Varlinks to be able to show the rewards beforehand if you want.
The only custom items in this script are the items being turned in to earn the rewards. The armor set in this example already exists in the PEQ DB, so you would just need to change out the item IDs being turned in and this script should be able to function on any server.
I mostly wanted to put this up just as an example of another way to write armor quests. I think it keeps them fairly clean and easy to change out items in them to make more similar quests.
#Simple 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",
);
%Rewards = ( #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
);
sub EVENT_SAY {
my $armor = quest::saylink("armor");
my $chest = quest::saylink("chest");
my $legs = quest::saylink("legs");
my $arms = quest::saylink("arms");
my $head = quest::saylink("head");
my $feet = quest::saylink("feet");
my $hands = quest::saylink("hands");
my $wrists = quest::saylink("wrists");
# 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});
my $chest_template = quest::varlink(6454);
my $leg_template = quest::varlink(6455);
my $arm_template = quest::varlink(6456);
my $boot_template = quest::varlink(6458);
my $helm_template = quest::varlink(6459);
my $hand_template = quest::varlink(6460);
my $bracer_template = quest::varlink(6461);
my $chipped_emerald = quest::varlink(6453);
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 create armor for [$chest], [$legs], [$arms], [$head], [$feet], [$hands], and [$wrists].");
}
if($text=~/chest/i)
{
quest::say("You will need to bring me a $chest_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/legs/i)
{
quest::say("You will need to bring me a $leg_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/arms/i)
{
quest::say("You will need to bring me a $arm_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/head/i)
{
quest::say("You will need to bring me a $helm_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/feet/i)
{
quest::say("You will need to bring me a $boot_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/hands/i)
{
quest::say("You will need to bring me a $hand_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/wrists/i)
{
quest::say("You will need to bring me a $bracer_template and a $chipped_emerald so I can create that piece for you.");
}
}
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, 6461 => 1, 6453 => 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, 6460 => 1, 6453 => 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, 6458 => 1, 6453 => 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, 6459 => 1, 6453 => 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, 6456 => 1, 6453 => 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, 6455 => 1, 6453 => 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, 6454 => 1, 6453 => 1)) {
quest::summonitem($Rewards{$Breastplate});
quest::exp(450);
quest::say ("There you go, $name. You're looking tougher already!");
}
else
{
plugin::return_items(\%itemcount);
}
}
The only custom items in this script are the items being turned in to earn the rewards. The armor set in this example already exists in the PEQ DB, so you would just need to change out the item IDs being turned in and this script should be able to function on any server.
I mostly wanted to put this up just as an example of another way to write armor quests. I think it keeps them fairly clean and easy to change out items in them to make more similar quests.
#Simple 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",
);
%Rewards = ( #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
);
sub EVENT_SAY {
my $armor = quest::saylink("armor");
my $chest = quest::saylink("chest");
my $legs = quest::saylink("legs");
my $arms = quest::saylink("arms");
my $head = quest::saylink("head");
my $feet = quest::saylink("feet");
my $hands = quest::saylink("hands");
my $wrists = quest::saylink("wrists");
# 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});
my $chest_template = quest::varlink(6454);
my $leg_template = quest::varlink(6455);
my $arm_template = quest::varlink(6456);
my $boot_template = quest::varlink(6458);
my $helm_template = quest::varlink(6459);
my $hand_template = quest::varlink(6460);
my $bracer_template = quest::varlink(6461);
my $chipped_emerald = quest::varlink(6453);
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 create armor for [$chest], [$legs], [$arms], [$head], [$feet], [$hands], and [$wrists].");
}
if($text=~/chest/i)
{
quest::say("You will need to bring me a $chest_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/legs/i)
{
quest::say("You will need to bring me a $leg_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/arms/i)
{
quest::say("You will need to bring me a $arm_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/head/i)
{
quest::say("You will need to bring me a $helm_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/feet/i)
{
quest::say("You will need to bring me a $boot_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/hands/i)
{
quest::say("You will need to bring me a $hand_template and a $chipped_emerald so I can create that piece for you.");
}
if($text=~/wrists/i)
{
quest::say("You will need to bring me a $bracer_template and a $chipped_emerald so I can create that piece for you.");
}
}
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, 6461 => 1, 6453 => 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, 6460 => 1, 6453 => 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, 6458 => 1, 6453 => 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, 6459 => 1, 6453 => 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, 6456 => 1, 6453 => 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, 6455 => 1, 6453 => 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, 6454 => 1, 6453 => 1)) {
quest::summonitem($Rewards{$Breastplate});
quest::exp(450);
quest::say ("There you go, $name. You're looking tougher already!");
}
else
{
plugin::return_items(\%itemcount);
}
}