View Single Post
  #6  
Old 10-16-2011, 03:01 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

FYI, you should ALWAYS make your turn in check last in your if statements:

Code:
if  ((plugin::check_handin(\%itemcount, xxxx => 1)) && ($ulevel>=8) && ($ulevel<16))
The above example from you will result in the NPC eating the turned in item and failing to trigger the desired result for the player if they don't meet the level criteria.

Here is a better way:

Code:
if  ($ulevel >= 8 && $ulevel < 16 && plugin::check_handin(\%itemcount, xxxx => 1))
This way, if they fail the level checks (or any checks that you want to do along with an item turn-in), the item is not lost. You can still use the return items plugin and give back any items that were not taken by the NPC.

Also, since any items that get taken by the NPC will be removed from the list of items to return, you can use the return plugin at the end of the EVENT_ITEMS sub without having it inside an else or any other statement.

Code:
plugin::return_items(\%itemcount);
Just put that before the last bracket of EVENT_ITEM and you will always return any unused items.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote