|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Q&A This is the quest support section |
|
|
|
04-03-2014, 02:51 PM
|
Sarnak
|
|
Join Date: Feb 2008
Posts: 87
|
|
Help with this script please?
To start :P the script works fine in terms of it accomplishes what it is supposed to.
The problem is that the script completely ignores the level check for the player.
I would like it to be so that the script will not work and hand back the items if the player is NOT exactly level 65.
Checking the script with a command line prompt using perl it goes through without problem.
I just came back to scripting for eqemu and am sure I am missing something simple so would anyone please allow me to feel very stupid and point out what im missing lol
Code:
sub EVENT_SAY{
my $saylink1 = quest::saylink("Experienced");
if ($text =~/Hail/i){
$client->Message(315, "Greetings $class, I have been waiting for someone [$saylink1] such as yourself");
}
if ($text=~ /Experienced/i) {
$client->Message(315, "To prove your experience I require a Tooth from Trakanon in Sebelis, a Robe of the Kedge from Phingegl Autropos in Kedge Keep and an Incarnadine Helm from Overking Bathezid in Chardok");
}
}
sub EVENT_ITEM
{
if($ulevel = 65)
{
if(plugin::check_handin(\%itemcount, 7276 => 1, 1253 => 1, 4132 => 1))
{
$client->Message(315, "Shado Feralis will be quite impressed with your progress you should speak to him.");
quest::level(66);
}
else {
$client->Message(315, "I have no need for this item $name, you can have it back.");
plugin::return_items(\%itemcount);
}
}
}
|
|
|
|
04-03-2014, 03:14 PM
|
Hill Giant
|
|
Join Date: Oct 2002
Location: Rockville, MD
Posts: 124
|
|
try if ($ulevel == 65) {
__________________
Bront -Server Admin/Owner and Lead Quest Dev for Kildrukaun's Prophecy
http://kpemu.com/
|
04-03-2014, 03:26 PM
|
Sarnak
|
|
Join Date: Feb 2008
Posts: 87
|
|
Thank you for the reply I did try that and on changing it disallows any items to be traded correct or not and does not finish the script or give the items back
Any other ideas?
My best guess is I would have to make that change but the problem is the double if section meaning this
Code:
sub EVENT_ITEM
{
if($ulevel = 65)
{
if(plugin::check_handin(\%itemcount, 7276 => 1, 1253 => 1, 4132 => 1))
{
I cannot seem to figure the correct way to handle it.
I tried
Code:
sub EVENT_ITEM
{
if($ulevel = 65)
if(plugin::check_handin(\%itemcount, 7276 => 1, 1253 => 1, 4132 => 1))
{
But it just causes the Npc to do nothing
|
|
|
|
04-03-2014, 03:59 PM
|
Hill Giant
|
|
Join Date: Oct 2002
Location: Rockville, MD
Posts: 124
|
|
Code:
sub EVENT_SAY{
my $saylink1 = quest::saylink("Experienced");
if ($text =~/Hail/i){
$client->Message(315, "Greetings $class, I have been waiting for someone [$saylink1] such as yourself");
}
if ($text=~ /Experienced/i) {
$client->Message(315, "To prove your experience I require a Tooth from Trakanon in Sebelis, a Robe of the Kedge from Phingegl Autropos in Kedge Keep and an Incarnadine Helm from Overking Bathezid in Chardok");
}
}
sub EVENT_ITEM
{
if($ulevel == 65) {
if(plugin::check_handin(\%itemcount, 7276 => 1, 1253 => 1, 4132 => 1)) {
$client->Message(315, "Shado Feralis will be quite impressed with your progress you should speak to him.");
quest::level(66);
}
else {
$client->Message(315, "I have no need for this item $name, you can have it back.");
plugin::return_items(\%itemcount);
}
}
}
Worked fine for me on my server when i tested. Have you had any issues elsewhere with item turn ins? Thinking maybe your missing the plugin folder?
__________________
Bront -Server Admin/Owner and Lead Quest Dev for Kildrukaun's Prophecy
http://kpemu.com/
|
|
|
|
04-03-2014, 04:22 PM
|
Sarnak
|
|
Join Date: Feb 2008
Posts: 87
|
|
Ok.. I seem to be making progress Ive made changes to reflect yours. It works thank you:P
The only issue is if you are not eligable to do the quest the NPC does not give you the items back.
I will take it from here and figure it out.
Thank you so much for your help.
|
04-03-2014, 04:27 PM
|
Hill Giant
|
|
Join Date: Oct 2002
Location: Rockville, MD
Posts: 124
|
|
Check where you have your else statement. At the moment its only set to return items when a level 65 screws up the handin, id move the else statement outside of the level check and see how that works for ya.
__________________
Bront -Server Admin/Owner and Lead Quest Dev for Kildrukaun's Prophecy
http://kpemu.com/
|
|
|
|
04-03-2014, 06:30 PM
|
Administrator
|
|
Join Date: May 2013
Location: United States
Posts: 1,589
|
|
Code:
sub EVENT_SAY
{
my $saylink1 = quest::saylink("Experienced");
if ($text =~/Hail/i)
{
$client->Message(315, "Greetings $class, I have been waiting for someone [$saylink1] such as yourself");
}
elsif ($text=~ /Experienced/i)
{
$client->Message(315, "To prove your experience I require a Tooth from Trakanon in Sebelis, a Robe of the Kedge from Phingegl Autropos in Kedge Keep and an Incarnadine Helm from Overking Bathezid in Chardok");
}
}
sub EVENT_ITEM
{
if($ulevel == 65)
{
if(plugin::check_handin(\%itemcount, 7276 => 1, 1253 => 1, 4132 => 1))
{
$client->Message(315, "Shado Feralis will be quite impressed with your progress you should speak to him.");
quest::level(66);
}
else
{
$client->Message(315, "I have no need for this item $name, you can have it back.");
plugin::return_items(\%itemcount);
}
}
else
{
$client->Message(315, "I have no need for this item $name, and you're far too low level to trade with me.");
plugin::return_items(\%itemcount);
}
}
|
|
|
|
04-04-2014, 12:44 AM
|
Dragon
|
|
Join Date: May 2010
Posts: 966
|
|
You NEVER EVER EVER put the return items call inside ANY logic blocks.
It goes in a script once and once only at the end of sub EVENT_ITEM
Code:
sub EVENT_ITEM {
if blah blah blah {
lot of funky logic to do what you want. if/else/elsif/etc.
}
plugin::return_items(\%itemcount);
}
|
04-04-2014, 07:29 AM
|
Administrator
|
|
Join Date: May 2013
Location: United States
Posts: 1,589
|
|
Quote:
Originally Posted by sorvani
You NEVER EVER EVER put the return items call inside ANY logic blocks.
It goes in a script once and once only at the end of sub EVENT_ITEM
Code:
sub EVENT_ITEM {
if blah blah blah {
lot of funky logic to do what you want. if/else/elsif/etc.
}
plugin::return_items(\%itemcount);
}
|
It has worked perfectly well in my other scripts.
This works just fine for me: http://perl.pastebin.mozilla.org/4759052
|
04-04-2014, 10:48 AM
|
Dragon
|
|
Join Date: May 2010
Posts: 966
|
|
Just because it works, does not mean it is the best way to handle it. There was a LOT of misundstanding of this functionality when it was first introduced years ago and a lot of working, but technically incorrect scripts went in the quest repo.
Best practice is to put it once at the end of the script. The %itemcount hash will have its contents modified by your prior logic and only ever needs called once to then summon the items still left in the hash onto the player's cursor.
All it takes is a bad logic loop without a return in it to have items never returned as noted by the OP.
|
04-04-2014, 02:50 PM
|
Demi-God
|
|
Join Date: Aug 2010
Posts: 1,743
|
|
Unless you really like typing or copy/pasting there's no reason to have the same statement in multiple places, and as a bonus like Sorvani said, you won't miss one accidentally.
|
04-04-2014, 04:00 PM
|
Administrator
|
|
Join Date: May 2013
Location: United States
Posts: 1,589
|
|
Yeah, it makes sense. I understand the reasoning behind doing it your way, I just don't do it that way.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 08:33 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|