Perhaps a better way to write that would be the following:
Code:
sub EVENT_ITEM {
if (plugin::check_handin(\%itemcount, 1389 => 1)) {
if (defined($qglobals{epic15})) {
if($qglobals{epic15} == 3) {
quest::say("Good report to Sergeant Zind and see if he needs any help. Here you hang onto the jewel for safekeeping.");
plugin::return_items(\%itemcount);
quest::setglobal("epic15",4,5,"F"); }
else {
quest::say ("Hang on to this, till its needed once again.");
plugin::return_items(\%itemcount); }
}
else {
quest::say ("Hang on to this, till its needed once again.");
plugin::return_items(\%itemcount); }
}
else {
quest::say ("I have no use for this item, $name.");
plugin::return_items(\%itemcount); }
}
This will first check if the player turned in the correct item. If not, it will return it. Then, it checks if the player has the quest global defined at all (if they have even started the quest line) and if not, it returns the item but tells them to hang on to it. Finally, it checks if the player has the 3 value for the global and if not, it returns the item and tells them to hang onto it.
I haven't tested this, but I think it should work. You might have to adjust it slightly to get it working in case I missed something. But, this should probably be the best way to do it. The only part I am not sure about is all of the elses for returning items. You might not need all of them. I have had issues in the past where it will do all of the elses for some reason, when I think it should really only be doing 1 of them. You can tell if that is happening easily by testing to see if you get multiple return messages. If that happens, you should be able to just remove some of the quest::say's in the else returns.
I also wanted to mention that I changed the format so that it is easier to read. It is hard to tell what is going on when all of the brackets are on the left side and all of the lines are lined up as well.