Class Specific quest
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. :)
Code:
sub EVENT_SAY { elsif ($class == Paladin) |
if($class == "Warrior")
missing quotes |
Code:
sub EVENT_ITEM { or miswritten tests. I would write it that way : Code:
sub EVENT_ITEM { |
Forgot to write this, after you wrote a quest, you can test its syntax with perl :
Code:
perl -cw 'questfile.pl' |
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 : Code:
sub EVENT_ITEM { |
Thanks a lot guys, With the info you gave I'm sure I can get it working. :)
|
After updating my quest to what you guys suggested It still doesn't want to work. Any more suggestions? Or maybe I overloocked something.
Code:
sub EVENT_SAY { |
you were missing a bracket in the paladin's code
Code:
sub EVENT_SAY |
Aren't you supposed to use the eq operator and not the == operator for strings?
if($class eq 'Warrior') { /* ... */ } |
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. |
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.
Code:
sub EVENT_SAY { |
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 =/ |
i got it working, let me finish it and i'll post it
|
I added a few comments into the file for you, so you can tweak usability.
Code:
#this quest will work for any class as is, however it just gives xp to rogues, rangers, and bards EDIT: oh, I only tested this on bards, warriors, and wizards... could be bugs. |
Nice, thank you Jimbabwe, I'll try this out :)
|
Quote:
Code:
sub EVENT_SAY { |
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.
|
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 :)
|
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.
|
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.
|
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 :)
Code:
sub EVENT_SAY { |
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. Code:
if (scalar(%itemcount)>0) { To test that a string isn't something, use 'ne' and != for an integer Code:
if ($class ne "Paladin") { } |
Final Working version of quest. Works Perfectly ( Thank you Doodman for all the help )
Code:
sub EVENT_SAY |
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. |
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.
|
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. |
ehh too much typing i'd just do this
Code:
sub EVENT_ITEM { |
Just to throw yet another solution to the same problem out:
Code:
sub EVENT_ITEM { |
All times are GMT -4. The time now is 10:16 AM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.