Turn-in trouble
I've made a few quests that require items to be turned in. Some of them require 1 item, some require 2 or more, and some require multiple item turn-ins at different times. For the quests that need 1 or 2+ items at once, people can turn in 1 of any item (ex. You need an apple but you turn in a twig and it does the same thing). For the multiple turn-in quest, if you turn in 1 of any item, it gives you experience and/or the item(s) for every part of the quest (ex. You need a necklace, then after you get xp you need a ring, but it gives you xp as if you turned in both.). My question is, how might I fix this problem?
Quest needing 1 item: Code:
sub EVENT_SAY{ Code:
sub EVENT_SAY{ |
Search the forums here for the plugin called "check_handin.pl". I am not sure when the emulator started using this method to check for handins, but the documentation is severly lacking in that area - the question has come up a lot lately.
The perl script itself should be in the folder named "plugins" from the CVS, but in case you can't find it: Code:
# plugin::check_handin($item1 => #required_amount,...); Code:
sub EVENT_ITEM { |
However, in your original post, the problems are because in the first example you used = instead of ==, resulting in assignment instead of comparison. In the second example you were assigning to a hash instead of checking it for existence and then testing the value.
Code:
if ($item1==5014) { |
Ok, I got that to work, so nobody can take shortcuts through quests now :P
Now I have another problem with turn-ins...I have a series of quests where the first person you talk to hands out items based on class and gives you your quest. The other people in the series will only talk to you if you hand in one of the items, so there are multiple lines that get the same response, then 1 line that gets a different response. However, the NPC only replies to the hail and keyword I have set, any item turn-ins result in the NPC having a nice lunch. This is just 1 of them, but if this problem is solved, the rest will work too: Code:
sub EVENT_SAY{ |
This example has an extra } for each if statement which ultimately results in the subroutine not compiling. The result of this is that the npc will quietly eat the items. You may find it easier to follow and maintain if you don't try to do everything on one line.
Code:
You have: |
Ok, so I've changed it to look like this:
Code:
sub EVENT_SAY{ |
If you used the check_handins plugin I mentioned, nothing would get eaten.
|
Even using check_handin plugin would have eaten the stuff if the subroutine has syntax errors.
The operation of the check_handin routine is a little inconsistent tho. If you hand in what is needed along with something else it eats what was needed and ignores the rest, acknowledging that it got what it wanted. If you hand it more of what's needed than it wants, whether or not you also hand anything else, it does not eat anything does not acknowledge it got what it wanted. Either way, it only returns the items it didn't want or need if you call the return_items plugin at the end. I would be quicker to use it if check_handin were coded as: Code:
sub check_handin { As to the potential to exploit of using a negative quantity required, the person coding the quest could just summon it directly if they wanted to. |
All times are GMT -4. The time now is 04:10 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.