PDA

View Full Version : Class Specific quest


paaco
04-23-2006, 01:19 PM
I am attempting to make a quest in my noobie zone that gives class specific rewards. However when you hail him, he gives you the text, but then when you hand him a mold for your wep he does nothing :( Can anyone tell me what is wrong in the format for this? Thank you any that can reply and help me get this working. :)

sub EVENT_SAY {
if ($text=~/hail/i) {
quest::say("Hello $name , I am one of the finest weaponsmiths this land has ever seen. If you find me a mold I will craft you a weapon. However if it is armor you seek, my brother makes the best around.");}
}

sub EVENT_ITEM {
if ($class == Warrior)
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Paladin)
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Shadow Knight) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Berserker) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Monk) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(6611);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Beastlord) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(6611);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Druid) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Necromancer) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Wizard) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Magician) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Enchanter) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Shaman) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
elsif ($class == Cleric) {
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29442);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
else {
plugin::return_items(\%itemcount);
quest::say("These are not the pieces I need.");
}
}


Also note that I have tried this with the class name typed out like in my posted code. and with the class ID#. Same result both ways.
elsif ($class == Paladin)

fathernitwit
04-24-2006, 02:06 AM
if($class == "Warrior")

missing quotes

Muuss
04-24-2006, 02:16 AM
sub EVENT_ITEM {
if ($class == Warrior)
(plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}


missing && between $class=="Warrior" and the check_handin
or miswritten tests.

I would write it that way :


sub EVENT_ITEM {
if (($class == "Warrior") && (plugin::check_handin(\%itemcount, 6164 => 1))) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}

if (($class == "Paladin") && (plugin::check_handin(\%itemcount, 6164 => 1))) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}

...
...
plugin::return_items(\%itemcount);
}

Muuss
04-24-2006, 02:25 AM
Forgot to write this, after you wrote a quest, you can test its syntax with perl :


perl -cw 'questfile.pl'


This will help you to fix some of the errors you made.

Muuss
04-24-2006, 04:25 AM
What i wrote previously has a correct syntax but won't work due to recent changes in the plugin::check_handin method.

You MUST write your quest like that :


sub EVENT_ITEM {
if ($class =="Warrior") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
... do stuff here
}
}

if ($class == "Paladin") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
... do stuff here
}
}

...
...

plugin::return_items(\%itemcount);
}


In my previous code, the test for the paladin would never be valid because the item will disappear of the list during the warrior's test. I m still not used to that new check_handin, sorry for the error :)

paaco
04-24-2006, 05:20 AM
Thanks a lot guys, With the info you gave I'm sure I can get it working. :)

paaco
04-24-2006, 06:18 AM
After updating my quest to what you guys suggested It still doesn't want to work. Any more suggestions? Or maybe I overloocked something.

sub EVENT_SAY {
if ($text=~/hail/i) {
quest::say("Hello $name , I am one of the finest weaponsmiths this land has ever seen. If you find me a mold I will craft you a weapon. However if it is armor you seek, my brother makes the best around."); }
}

sub EVENT_ITEM {
if ($class =="Warrior") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Paladin")
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Shadow Knight") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Berserker") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Monk") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(6611);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Beastlord") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(6611);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Druid") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Necromancer") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Wizard") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Magician") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Enchanter") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Shaman") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Cleric") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29442);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
else {
plugin::return_items(\%itemcount);
quest::say("These are not the pieces I need.");
}
}

jimbabwe
04-24-2006, 06:58 AM
you were missing a bracket in the paladin's code

sub EVENT_SAY
{
if ($text=~/hail/i)
{
quest::say("Hello $name , I am one of the finest weaponsmiths this land has ever seen. If you find me a mold I will craft you a weapon. However if it is armor you seek, my brother makes the best around.");
}
}

sub EVENT_ITEM
{
if ($class =="Warrior")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}

if ($class == "Paladin")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Shadow Knight")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Berserker")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Monk")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(6611);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Beastlord")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(6611);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Druid")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Necromancer")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Wizard")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Magician")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Enchanter")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Shaman")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class == "Cleric")
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
quest::summonitem(29442);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
else
{
plugin::return_items(\%itemcount);
quest::say("These are not the pieces I need.");
}
}

You may try formatting your code like that as it can be a lot easier to keep track of brackets and code segments.

Cisyouc
04-24-2006, 07:04 AM
Aren't you supposed to use the eq operator and not the == operator for strings?

if($class eq 'Warrior') { /* ... */ }

Muuss
04-24-2006, 08:12 AM
Using eq instead of == is a good idea, yes :)

About the else at the end of your code. It has no sense.

just add plugin::return_items(\%itemcount); without test.

check_handin verifies that you gave the right amount of items and removes them of the list of given items.

At the end of the quest, you call return_items to give back to the player each item that remains in the list. Don't include it in a test, just do it or don't do it.

paaco
04-24-2006, 08:58 AM
The quest works now, thank all of you guys for your hard work and patience helping me get it going. Posting the working code, maybe it will help someone else looking to make a class specific quest.

sub EVENT_SAY {
if ($text=~/hail/i) {
quest::say("Hello $name , I am one of the finest weaponsmiths this land has ever seen. If you find me a mold I will craft you a weapon. However if it is armor you seek, my brother makes the best around.");}
}

sub EVENT_ITEM {
if ($class eq "Warrior") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Paladin") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Shadow Knight") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Berserker") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Monk") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(6611);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Beastlord") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(6611);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Druid") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Necromancer") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Wizard") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Magician") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Enchanter") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Shaman") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq "Cleric") {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
quest::summonitem(29442);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
plugin::return_items(\%itemcount);
quest::say("These are not the pieces I need.");
}
}

paaco
04-24-2006, 09:20 AM
ok actually it doesn't work lol. This quest is starting to get old :( When you hand in the item now this stuff happens:
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();

But instead of summoning the correct item for you, he hands you back the mold and says:
These are not the pieces I need.

So basically you can stand there and hand the mold in over and over until you reach max lvl if you want to do 10k turnins =/

jimbabwe
04-24-2006, 12:02 PM
i got it working, let me finish it and i'll post it

jimbabwe
04-24-2006, 01:00 PM
I added a few comments into the file for you, so you can tweak usability.

#this quest will work for any class as is, however it just gives xp to rogues, rangers, and bards
#this can be fixed by moving the emote, exp and ding functions into the if statements individually.
sub EVENT_SAY
{
if ($text=~/hail/i)
{
quest::say("Hello $name , I am one of the finest weaponsmiths this land has ever seen. If you find me a mold I will craft you a weapon. However if it is armor you seek, my brother makes the best around.");
}
}

sub EVENT_ITEM
{
if (plugin::check_handin(\%itemcount, 6164 => 1))
{
if(($class eq "Warrior") || ($class eq "Paladin") || ($class eq "Shadowknight") || ($class eq "Berserker"))
{
quest::summonitem('62189');
}
if(($class eq "Monk") || ($class eq "Beastlord"))
{
quest::summonitem('6611');
}
if(($class eq "Druid") || ($class eq "Necromancer") || ($class eq "Magician") || ($class eq "Wizard") || ($class eq "Enchanter") || ($class eq "Cleric"))
{
quest::summonitem('29442');
}
quest::emote("smiles warmly as he hands you your weapon.");
quest::exp(750);
quest::ding();
}
elsif(plugin::return_items(\%itemcount))
{
#this command isn't working. maybe quest::return_items returns a false value when it gives soemthing back.
quest::say("These are not the pieces I need.");
}
}


EDIT: oh, I only tested this on bards, warriors, and wizards... could be bugs.

paaco
04-24-2006, 01:06 PM
Nice, thank you Jimbabwe, I'll try this out :)

paaco
04-24-2006, 01:11 PM
#this command isn't working. maybe quest::return_items returns a false value when it gives soemthing back.
quest::say("These are not the pieces I need.");
}
}

That command does work, just doesn't for some reason in this specific quest, here is another quest I have that works perfect.

sub EVENT_SAY {
if($text=~/Hail/i){
quest::say("Hail $class , How are ye today? If it's armor your wanting I'm your man. I have all the materials except a mold. If you can bring me a Mold I'll make you the best armor I've got. If it is a weapon you seek then you should speak to my brother.");
}
}
sub EVENT_ITEM {
if(plugin::check_handin(\%itemcount, 16346 =>1)) { # tunic
quest::summonitem(4154);
quest::exp(500);
quest::emote("Bort smiles warmly as he hands you your reward.");
quest::say("Enjoy Your new Breastplate");
quest::ding();
}
elsif(plugin::check_handin(\%itemcount, 16343 =>1)) { # sleeves
quest::summonitem(4155);
quest::exp(500);
quest::emote("Bort smiles warmly as he hands you your reward.");
quest::say("Enjoy Your new Vambraces");
quest::ding();
}
elsif(plugin::check_handin(\%itemcount, 16344 =>1)) { # leggings
quest::summonitem(4158);
quest::exp(500);
quest::emote("Bort smiles warmly as he hands you your reward.");
quest::say("Enjoy Your new Leggings");
quest::ding();
}
elsif(plugin::check_handin(\%itemcount, 16345 =>1)) { # gauntlets
quest::summonitem(4157);
quest::exp(500);
quest::emote("Bort smiles warmly as he hands you your reward.");
quest::say("Enjoy Your new Gauntlets");
quest::ding();
}
elsif(plugin::check_handin(\%itemcount, 16299 =>1)) { # cap
quest::summonitem(4153);
quest::exp(500);
quest::emote("Bort smiles warmly as he hands you your reward.");
quest::say("Enjoy Your new Cap");
quest::ding();
}
elsif(plugin::check_handin(\%itemcount, 16297 =>1)) { # bracers
quest::summonitem(4156);
quest::exp(500);
quest::emote("Bort smiles warmly as he hands you your reward.");
quest::say("Enjoy Your new Bracer");
quest::ding();
}
elsif(plugin::check_handin(\%itemcount, 16298 =>1)) { # boots
quest::summonitem(4159);
quest::exp(500);
quest::emote("Bort smiles warmly as he hands you your reward.");
quest::say("Enjoy Your new Boots");
quest::ding();
}
else {
plugin::return_items(\%itemcount);
quest::say("I can't do anything with this item! You can have it back.");
}
}

I do appreciate you taking the time to help with this quest though, honestly it was starting to drive me nuts.

jimbabwe
04-24-2006, 01:16 PM
I don't know how to test a NOT TRUE case in perl. If you can figure that out, then you can get that quest::say to work.

paaco
04-24-2006, 01:42 PM
Next time you log on my server Jim try handing the armor quest NPC a random item, the quest::say and everything works with him. I'm honestly not sure what the issue is hehe. I'll admit I'm pretty noob with most of this. I've never messed with C++ or perl any. I do manage some sql databases and websites that are pretty php intensive which helps a lot. But I'm no guru for sure. This stuff still confuses me :)

jimbabwe
04-24-2006, 01:51 PM
Yeah, i'm not sure. unless i put the return_item in an if statement, the turn in wouldn't even work. I'm not sure why, perl seems strange with it's logic if you ask me.

jimbabwe
04-24-2006, 01:58 PM
you may try taking the version that you said you got working earlier, and adding single quotations around the number in quest::summon_item('3453'); <---Like that. Maybe that'll work.

paaco
04-24-2006, 02:42 PM
This kind of works, but I'm tired of looking at it today, going to go populate my next zone. In this code, the quest works, you get the ding, say, exp, and item, but he also says I cannot use this item, you can have it back and gives you the mold. So now you get the mold back+ the item your supposed to get *boggle* Thinking about this is hurting my head though. I'll sleep on it and tinker more tomorrow :)


sub EVENT_SAY {
if ($text=~/hail/i) {
quest::say("Hello $name , I am one of the finest weaponsmiths this land has ever seen. If you find me a mold I will craft you a weapon. However if it is armor you seek, my brother makes the best around.");}
}

sub EVENT_ITEM {
if ($class eq 'Warrior') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Paladin') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Shadow Knight') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Berserker') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(62189);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Monk') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(6611);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Beastlord') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(6611);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Druid') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Necromancer') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Wizard') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Magician') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Enchanter') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Shaman') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(29422);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
if ($class eq 'Cleric') {
if (plugin::check_handin(\%itemcount, 6141 => 1)) {
quest::summonitem(29442);
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
plugin::return_items(\%itemcount);
quest::say("These are not the pieces I need.");
}
}

Muuss
04-24-2006, 07:24 PM
Your last quest is how you must write quests with checkhandin now. (except there my be an extra } at its end, check that if it does not work).
If you don't want the NPC to say that he returns items, you must test that there's still some items left in the %itemcount hashtable.



if (scalar(%itemcount)>0) {
quest::say("Take this back");
plugin::return_items(\%itemcount);
}


Another way is to say nothing and just add return_items.


To test that a string isn't something, use 'ne' and != for an integer


if ($class ne "Paladin") { }
if ($level != 5) { }


These is the basic perl syntax, there's many tutorials on the web...

paaco
04-25-2006, 04:49 PM
Final Working version of quest. Works Perfectly ( Thank you Doodman for all the help )

sub EVENT_SAY
{
if ($text =~ /hail/i)
{
quest::say("Hello $name , I am one of the finest weaponsmiths this land has ever seen. If you find me a mold I will craft you a weapon. However if it is armor you seek, my brother makes the best around.");
}
}

sub EVENT_ITEM
{
if ($class eq 'Warrior' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (62189);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Paladin' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (62189);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Shadow Knight' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (62189);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Berserker' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (62189);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Monk' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (6611);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Beastlord' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (6611);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Druid' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (29422);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Necromancer' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (29422);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Wizard' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (29422);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Magician' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (29422);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Enchanter' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (29422);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Shaman' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (29422);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
elsif ($class eq 'Cleric' && plugin::check_handin (\%itemcount, 6141 => 1))
{
quest::summonitem (29442);
quest::exp (750);
quest::emote ("smiles warmly as he hands you your weapon.");
quest::ding ();
}
else
{
plugin::return_items (\%itemcount);
quest::say ("These are not the pieces I need.");
}
}

Muuss
04-25-2006, 07:29 PM
If you're using the last plugin, i bet you my shirt and my shoes than this won't work for any other class than warrior.

L8rs.

paaco
04-26-2006, 05:28 AM
Just tested with a Beastlord, Warrior, and Necro, give the right item he hands you your wep. Give the wrong item and all you get back is what you gave him with the message telling you it's the wrong item. It seems to work fine even with that last plugin. I have 2 quests that use it and give multiple items. My other quest has 8 different rewards and works.

Muuss
04-27-2006, 12:27 AM
I retire what i said about warrior. That quest works, but writing it like this is so risky that i wouldn't advise it to a perl beginner (inverse the tests and write 'if (plugin::check_handin(\%itemcount,6461=>1) && ($class eq "Warrior")) {' and it won't work anymore... but well...

Anyway, for that same quest, try to give the item 6461 plus another item, the one you want, and the npc won't return you the extra item.

Grundy
06-23-2006, 03:13 PM
ehh too much typing i'd just do this

sub EVENT_ITEM {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
if ( ($class == "Warrior") || ($class == "Paladin") || ($class == "Shadow Knight") || ($class == "Berserker") ) {
quest::summonitem(62189);
}
if ( ($class == "Monk") || ($class == "Beastlord") ) {
quest::summonitem(6611);
}
if ( ($class == "Druid") || ($class == "Shaman") || ($class == "Necromancer") || ($class == "Wizard") || ($class == "Magician") || ($class == "Enchanter") ) {
quest::summonitem(29422);
}
if ( $class == "Cleric" ) {
quest::summonitem(29442);
}
# probably add something for rogues, bards, and rangers
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
else {
plugin::return_items(\%itemcount);
quest::say("These are not the pieces I need.");
}
}

fathernitwit
06-23-2006, 03:19 PM
Just to throw yet another solution to the same problem out:

sub EVENT_ITEM {
if (plugin::check_handin(\%itemcount, 6164 => 1)) {
my %rewards = (
"Warrior" => 62189, "Paladin" => 62189, "Shadow Knight" => 62189,
"Monk" => 6611, "Beastlord" => 6611,
"Cleric" => 29442,
"Druid" => 29422, "Shaman" => 29422, "Necromancer" => 29422,
"Wizard" => 29422, "Magician" => 29422, "Enchanter" => 29422
);
if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::exp(750);
quest::emote("smiles warmly as he hands you your weapon.");
quest::ding();
}
}
else {
plugin::return_items(\%itemcount);
quest::say("These are not the pieces I need.");
}
}