EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Custom (https://www.eqemulator.org/forums/forumdisplay.php?f=671)
-   -   Armor Quest for all Classes and Teleporter (https://www.eqemulator.org/forums/showthread.php?t=24921)

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:

Code:

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:

Code:

#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

Quote:

Originally Posted by ChaosSlayerZ (Post 171252)
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:

Code:

%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:

Code:

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:

Code:

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.



Code:

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:
Code:

    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 ><


All times are GMT -4. The time now is 07:56 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.