|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
Quests::Custom Custom Quests here |

06-03-2009, 06:06 PM
|
 |
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
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
|
 |
|
 |

06-03-2009, 06:13 PM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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.
|
 |
|
 |

06-03-2009, 06:19 PM
|
Dragon
|
|
Join Date: Feb 2007
Posts: 659
|
|
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.
|

06-17-2009, 01:50 PM
|
Hill Giant
|
|
Join Date: Sep 2008
Posts: 204
|
|
[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.
|

06-17-2009, 01:51 PM
|
Hill Giant
|
|
Join Date: Sep 2008
Posts: 204
|
|
no idea how, but double post.. sry ><
|
 |
|
 |

09-03-2009, 12:57 PM
|
Fire Beetle
|
|
Join Date: Jul 2004
Posts: 11
|
|
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:
Code:
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.");
}
}
}
|
 |
|
 |
 |
|
 |

09-03-2009, 01:41 PM
|
Hill Giant
|
|
Join Date: Sep 2008
Posts: 204
|
|
I think just some "if" should be "elsif", see below (cant test it atm though, but should work).
Code:
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.");
}
}
}
__________________
|
 |
|
 |

06-03-2009, 06:23 PM
|
Dragon
|
|
Join Date: Feb 2007
Posts: 659
|
|
Quote:
Originally Posted by ChaosSlayerZ
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++
|
 |
|
 |

06-03-2009, 06:44 PM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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.
|
 |
|
 |

06-03-2009, 08:36 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
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".
|
 |
|
 |

06-16-2009, 02:10 PM
|
Sarnak
|
|
Join Date: Oct 2008
Location: USA
Posts: 92
|
|
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);
}
}
}
|
 |
|
 |
 |
|
 |

06-16-2009, 05:09 PM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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.
|
 |
|
 |

06-16-2009, 06:26 PM
|
Sarnak
|
|
Join Date: Oct 2008
Location: USA
Posts: 92
|
|
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.
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 12:23 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |