EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Problem with quest (https://www.eqemulator.org/forums/showthread.php?t=39695)

Bandor 05-23-2015 05:03 PM

Problem with quest
 
Code:

        sub EVENT_ITEM {
        if (plugin::check_handin(\%itemcount, 5792 => 1) && plugin::check_hasitem($client, 5333)){
                plugin::Whisper("As promised! Here is your new item!");
        quest::summonitem(5769);
        }
                elsif (plugin::check_handin(\%itemcount, 5792 => 1) && plugin::check_hasitem($client, 5371)){
                plugin::Whisper("As promised! Here is your new item!");
        my %epic1 = ("Monk" => 5790, "Ranger" => 5787);
        quest::summonitem($epic1{$class});
        }
                        elsif (plugin::check_handin(\%itemcount, 5792 => 1) && plugin::check_hasitem($client, 5375)){
                plugin::Whisper("As promised! Here is your new item!");
        quest::summonitem(5720);
        }
                        elsif (plugin::check_handin(\%itemcount, 5792 => 1) && plugin::check_hasitem($client, 5390)){
                plugin::Whisper("As promised! Here is your new item!");
        quest::summonitem(5700);
        }
                        elsif (plugin::check_handin(\%itemcount, 5792 => 1) && plugin::check_hasitem($client, 5409)){
                plugin::Whisper("As promised! Here is your new item!");
        quest::summonitem(5750);
        }
                        elsif (plugin::check_handin(\%itemcount, 5792 => 1) && plugin::check_hasitem($client, 5419)){
                plugin::Whisper("As promised! Here is your new item!");
        quest::summonitem(5651);
        }
                        elsif (plugin::check_handin(\%itemcount, 5792 => 1) && plugin::check_hasitem($client, 5420)){
                plugin::Whisper("As promised! Here is your new item!");
        quest::summonitem(5755);
        }
                        elsif (plugin::check_handin(\%itemcount, 5792 => 1) && plugin::check_hasitem($client, 5421)){
                plugin::Whisper("As promised! Here is your new item!");
my %epic2 = ("Warrior" => 5775, "Rogue" => 5775, "Monk" => 5783, "Berserker" => 5770, "Shadowknight" => 5770, "Paladin" => 5770, "Ranger" => 5775, "Bard" => 5775, "Beastlord" => 5783);
        quest::summonitem($epic2{$class});
        }
                        elsif (plugin::check_handin(\%itemcount, 5792 => 1) && plugin::check_hasitem($client, 5426)){
                plugin::Whisper("As promised! Here is your new item!");
        quest::summonitem(5707);
        }
                        elsif (plugin::check_handin(\%itemcount, 5792 => 1) && plugin::check_hasitem($client, 5427)){
                plugin::Whisper("As promised! Here is your new item!");
        quest::summonitem(5650);
        }
                plugin::return_items(\%itemcount);
}
}


For some reason only the first line produces a reward,the rest just eat the item for some reason. Really wasnt sure how to write this when I did so I could have easily just did it wrong,any advice?

Shendare 05-23-2015 07:13 PM

I'm pretty sure check_handin() actually removes the checked item from the list of items the user has turned in if it's there, so that you can do the appropriate reward and return_items won't return it later. For that reason, all the following check_handin() checks on the same item will return false, because it's already been checked and removed in the first if.

You'll need to rework your checks, something like:

Code:

sub EVENT_ITEM
{
        if (plugin::check_handin(\%itemcount, 5792 => 1))
        {
                if (plugin::check_hasitem($client, 5333)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5769);
                }
                elsif (plugin::check_hasitem($client, 5371)){
                        plugin::Whisper("As promised! Here is your new item!");
                        my %epic1 = ("Monk" => 5790, "Ranger" => 5787);
                        quest::summonitem($epic1{$class});
                }
                elsif (plugin::check_hasitem($client, 5375)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5720);
                }
                elsif (plugin::check_hasitem($client, 5390)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5700);
                }
                elsif (plugin::check_hasitem($client, 5409)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5750);
                }
                elsif (plugin::check_hasitem($client, 5419)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5651);
                }
                elsif (plugin::check_hasitem($client, 5420)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5755);
                }
                elsif (plugin::check_hasitem($client, 5421)){
                        plugin::Whisper("As promised! Here is your new item!");
                        my %epic2 = ("Warrior" => 5775, "Rogue" => 5775, "Monk" => 5783, "Berserker" => 5770, "Shadowknight" => 5770, "Paladin" => 5770, "Ranger" => 5775, "Bard" => 5775, "Beastlord" => 5783);
                        quest::summonitem($epic2{$class});
                }
                elsif (plugin::check_hasitem($client, 5426)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5707);
                }
                elsif (plugin::check_hasitem($client, 5427)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5650);
                }
                else
                {
                        plugin::Whisper("You are not ready to give me this item yet.");
                        quest::summonitem(5792);
                }
        }
       
        plugin::return_items(\%itemcount);
}

I added the last else{} check in case they turned in item 5792 without meeting any of the other criteria, so they get it back.

Bandor 05-23-2015 08:19 PM

No go,he just eats them still :/

Shendare 05-23-2015 08:46 PM

Did you restart your server or use #reloadquest to reset the quest script cache?

It's working for me adding the code to a random NPC with different ItemIDs for testing.

Bandor 05-23-2015 08:55 PM

I just #reloadquest might work with a restart,Ive noticed some quests do that will give it a shot

Bandor 05-23-2015 09:04 PM

Nope still not working.

Shendare 05-23-2015 09:08 PM

Very weird.

I added the following code to my

C:\EQEmuServer\quests\felwithea\Exterminator_Valer n.pl

Code:

        if (plugin::check_handin(\%itemcount, 1001 => 1))
        {
                if (plugin::check_hasitem($client, 1002)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(1002);
                }
                elsif (plugin::check_hasitem($client, 1003)){
                        plugin::Whisper("As promised! Here is your new item!");
                        my %epic1 = ("Monk" => 1003, "Ranger" => 1003, "Cleric" => 1003);
                        quest::summonitem($epic1{$class});
                }
                elsif (plugin::check_hasitem($client, 1004)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(1004);
                }
                elsif (plugin::check_hasitem($client, 1005)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(1005);
                }
                elsif (plugin::check_hasitem($client, 1006)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(1006);
                }
                elsif (plugin::check_hasitem($client, 1007)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(1007);
                }
                elsif (plugin::check_hasitem($client, 1008)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(1008);
                }
                elsif (plugin::check_hasitem($client, 1009)){
                        plugin::Whisper("As promised! Here is your new item!");
                        my %epic2 = ("Warrior" => 1009, "Rogue" => 1009, "Monk" => 1009, "Berserker" => 1009, "Shadowknight" => 1009, "Paladin" => 1009, "Ranger" => 1009, "Bard" => 1009, "Beastlord" => 1009);
                        quest::summonitem($epic2{$class});
                }
                elsif (plugin::check_hasitem($client, 1010)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(1010);
                }
                elsif (plugin::check_hasitem($client, 1011)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(1011);
                }
                else
                {
                        plugin::Whisper("You are not ready to give me this item yet.");
                        quest::summonitem(1001);
                }
        }

...in between his default check_handin() and the final return_items(), and it works just like it appears it should. Turn in # 1001 (cloth cap), and it checks for items # 1002 - 1011 in your inventory and duplicates them if it finds them. Otherwise, you get the else{} message and get Item # 1001 returned.

Also, I added "Cleric" to the $epic1 check since I already had a cleric tester character sitting in the zone and otherwise got a "There is no item with id 0" error in that turn-in. Hehe.

Bandor 05-23-2015 09:13 PM

Lol tried your version,still wouldnt work. Very odd lol. This is my full code maybe the problem lies somewhere else?

Code:

sub EVENT_SAY {
if($text=~/hail/i) {
                if(quest::istaskactivityactive(19, 2)) {
                        quest::updatetaskactivity(19,2);
                        plugin::Whisper("Wow you really did it! Did you happen to obtain an essence of power?! If so give it here now!");
                        }
                        elsif (defined $qglobals{"Derlook"} && $qglobals{"Derlook"} == 3) {
                        plugin::Whisper("Get to work $name!");
                        }
                        elsif (defined $qglobals{"Derlook"} && $qglobals{"Derlook"} >= 4) {
                        plugin::Whisper("Your work here is finished $name. Your are needed elsewhere!");
                                }
                                else {
                plugin::Whisper("Hello $name! Im glad you made it here alive! It is time for our  " . quest::saylink("revenge", 1) . "!");
        }
        }
        elsif($text=~/revenge/i) {
        plugin::Whisper("There is a great General in these halls known as Veyse. Rumor has it that she has been working alongside Rallos to
        incite this war. His presence in these halls, along with the Zekian soldiers, seem to hold credence to these rumors! From the intelligence gathered thus far, It appears the ancient throne of Marr beholds a source of great power. We believe that Veyse has somehow absorbed this power and is using it to increase the power of him and his minions. Commander Tazen has asked for you to handle this threat as our forces are a bit stretched at the moment. Do you like a    " . quest::saylink("challenge", 1) . " ?");
        }
        elsif($text=~/challenge/i) {
        plugin::Whisper("I thought so $class! This mission is extremely simple,but in no ways shall it be easy! If you happen to defeat Veyse come and speak with me. Perhaps we can impart some of that power upon a item for you! So what say you are you up for the " . quest::saylink("task", 1) . " ?");
        }
        elsif($text=~/task/i) {
        plugin::Whisper("Very well, be off now!");
        quest::assigntask(19);
        quest::setglobal("Derlook", 3, 5, "F");
        }
        }
       
       
sub EVENT_ITEM {
        if (plugin::check_handin(\%itemcount, 5792 => 1))
        {
                if (plugin::check_hasitem($client, 5333)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5769);
                }
                elsif (plugin::check_hasitem($client, 5371)){
                        plugin::Whisper("As promised! Here is your new item!");
                        my %epic1 = ("Monk" => 5790, "Ranger" => 5787);
                        quest::summonitem($epic1{$class});
                }
                elsif (plugin::check_hasitem($client, 5375)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5720);
                }
                elsif (plugin::check_hasitem($client, 5390)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5700);
                }
                elsif (plugin::check_hasitem($client, 5409)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5750);
                }
                elsif (plugin::check_hasitem($client, 5419)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5651);
                }
                elsif (plugin::check_hasitem($client, 5420)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5755);
                }
                elsif (plugin::check_hasitem($client, 5421)){
                        plugin::Whisper("As promised! Here is your new item!");
                        my %epic2 = ("Warrior" => 5775, "Rogue" => 5775, "Monk" => 5783, "Berserker" => 5770, "Shadowknight" => 5770, "Paladin" => 5770, "Ranger" => 5775, "Bard" => 5775, "Beastlord" => 5783);
                        quest::summonitem($epic2{$class});
                }
                elsif (plugin::check_hasitem($client, 5426)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5707);
                }
                elsif (plugin::check_hasitem($client, 5427)){
                        plugin::Whisper("As promised! Here is your new item!");
                        quest::summonitem(5650);
                }
                else
                {
                        plugin::Whisper("You are not ready to give me this item yet.");
                        quest::summonitem(5792);
                }
        }


Shendare 05-23-2015 09:26 PM

Hmm...

1) Looks like you have a line break in your ($text=~/revenge/i) response. Not sure how Perl handles line breaks in string literals. Might be causing a problem.

2) Didn't see a closing brace ( } ) for EVENT_ITEM in this copy/paste.

Bandor 05-23-2015 09:42 PM

1) is fine,reads it like any other text have used it plenty of times.

2) not really sure what you mean? Mine is almost identical to yours from what I can tell,where should the } be at?

Shendare 05-23-2015 10:06 PM

You have a closing } for the plugin::check_handin(), but if that's the entire file, then you're missing the } for the end of EVENT_ITEM.

Otherwise, I can only guess there's something interfering with your perl. I created dummy copies of your custom items for turning in, and tested with a full replacement of my felwithea\Exterminator_Valern.pl file, after removing the line break and adding the finishing } at the end of the file.

https://youtu.be/U0ZG18wQS_4

Bandor 05-23-2015 10:55 PM

Gotcha,added the last } and now works perfect,ty for the help very much appreciated!

Shendare 05-23-2015 10:56 PM

http://i.imgur.com/YqmC8W5.gifv


All times are GMT -4. The time now is 11:01 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.