When having problems with complex scripts, there are 2 things to do to help figure them out as quickly as possible:
1. Break your script down into separate parts to make sure you have each piece working individually. Since you think your issue is related to the class checks, try something like this:
Code:
sub EVENT_ITEM {
if($class eq "Ranger" || $class eq "Beastlord") {
quest::say("The Class Check worked!");
quest::summonitem("1192");
quest::say("Take this item!");
}
else {
quest::say("The Class Check failed, or you are not a Ranger or Beastlord!");
}
}
When working with something I am not 100% sure on how to use, I always simplify the script as far as possible to work with testing how to do just that 1 particular thing. Then, work the rest out from there.
2. Use debugging text in your scripts if they are giving you problems. What I mean by this is to basically put an quest::say message after almost every line of the script, so you can see the exact steps that the NPC made it to. Here is an example of debugging a portion of a version of your script:
Code:
sub EVENT_ITEM {
if($class eq "Ranger" || $class eq "Beastlord") {
quest::say("The Class Check worked! You are a Ranger or Beastlord.");
if(defined($qglobals{startweap}) && $qglobals{startweap} == 2) {
quest::say("You passed the qglobal check!");
if (plugin::check_handin(\%itemcount, 1192 => 1)) {
quest::say("You turned in the correct item!");
quest::summonitem("1192");
quest::say("Rewarded you with item 1192!");
}
else {
quest::say("You turned in the wrong item!");
plugin::return_items(\%itemcount);
}
}
else {
quest::say("You do not have the required Qglobal, or my npc qglobal flag is not set to 1!");
plugin::return_items(\%itemcount);
}
}
else {
quest::say("The Class Check failed, or you are not a Ranger or Beastlord!");
plugin::return_items(\%itemcount);
}
}
This way, you can see exactly what the NPC is thinking when you turn the item in. It really helps to break down the script and isolate the exact cause of the problem. This is especially useful on long complex scripts. Then, once you are done testing, you can always leave the debug say messages in and just comment them out in case you ever need them later.