PDA

View Full Version : Quest Globals not being recognized by some NPCs


trevius
02-26-2008, 05:05 PM
Yes, another post in the quest forum by me. I am constantly trying new things, and every now and then I get stuck and can't find a solution on the forums.

The current issue I am running into right now appears to be a problem with a certain NPC I created using #spawn. For some reason, the quest I gave that NPC is able to flag my character just fine by using quest globals, but it doesn't recognize the flags after it gives them. I checked the quest globals in Navicat and the flag is definitely showing up for my character as being set to 1 as it should. But, when I hail the mob, it just replies to me with the text as if I wasn't flagged even though I have other text set for flagged responses.

This isn't the actual script I am using, it is just a simple example to show what I mean. If I set the below quest on my NPC in nexus, and I hail and then say "flag", I can check the Quest Globals and see that it did add a flag for my character. So, if it was working right, the next time I hail this NPC, it should give the flagged hail response telling me that I have a flag. Instead, I only get the initial undefined flag response. Here is the example quest:

sub EVENT_SAY {
if ($text=~/hail/i && $level_quest == undef) {
quest::say("Hello, $name, you don't have a flag defined for this quest yet. Would you like a flag?");}

if ($text=~/flag/i && $level_quest == undef) {
quest::say("Hello, $name, you don't have a flag defined for this quest yet. Would you like a flag?");
quest::setglobal("level_quest", 1, 5, "F");
}

if ($text=~/hail/i && $level_quest == 1) {
quest::say("Hello, $name, you are flagged with 1 for this quest.");}

}
$level_quest = undef;
}
}

Then to test if there was maybe something in the quest that was causing it to skip the flagged responce, I tried a code similar to this:

sub EVENT_SAY {

if ($text=~/hail/i && $level_quest == 1) {
quest::say("Hello, $name, you are flagged with 1 for this quest.");}

}
$level_quest = undef;
}
}

The only possible response in this case is the flagged response. But, when I do a #reloadquest and try hailing the NPC with this quest set, the NPC doesn't respond at all.

So, to further troubleshoot this, I went to PoV where I have slightly modified the PEQ quest for access to Aerin'Dar's lair. It has flagging via quest globals and it is working perfectly. My character is flagged from that quest to have the last flag. When I hail the quest NPC in PoValor, it says "Good Luck", which is the response for having all of the flags. So, that is working properly. I then copied that NPC's quest and pasted it to my problem NPC in Nexus. When I hail that NPC, it says the initial response as if I had no flags for that quest. And to be clear, that particular quest uses global option 5 which means it should be recognized by ALL npcs in ALL zones for THIS player (me). So, basically the problem NPC in Nexus seems to not be recognizing flags at all. I even tried simplifying the PoV quest I copied to it so it only had 1 response choice. Here is basically what I had:

sub EVENT_SAY {

if ($text=~/hail/i && $pov_key_quest == 5) {
quest::say("Good Luck.");}

}
$pov_key_quest = undef;
}
}

As suspected, I still got no response from the problem NPC with this quest in place. I even tried rebooting my server to see if that might help the NPC recognize flags, but it made no difference. This same quest works fine on the PoValor NPC.

The only thing I haven't tried (but I will tonight when I get home) is to try copying the initial quest I was trying to get working on the problem Nexus NPC and pasting it to the PoValor NPC to see how it responds. I am pretty sure it would work as intended and recognize the flags.

So, as far as I can tell, the the cause seems to be something with that particular NPC in Nexus which I used #spawn to create. The NPC in PoValor is from PEQ and so is the the quest with globals that I have been using for my testing. I did modify the quest slightly on my server, since it wasn't complete in the PEQ DB. I simply reworded a few things and made the final reward easier to get.

So, is there something I am missing? Maybe there is a reason why mobs that are created using #spawn don't recognize quest globals? I know there must be something slightly different about them, because there seems to be a known issue that causes #spawn created NPCs to not always pop on repops or zone starts. I have this problem from time to time on my server, particularly in Nexus where I have all #spawn created NPCs.

So, maybe there is some setting causing these NPCs to not recognize quest globals for some reason. If anyone can look into this, it would be much appreciated. I will continue to do more testing and provide my results when I get them.

AndMetal
02-26-2008, 09:12 PM
I think this post (http://www.eqemulator.net/forums/showthread.php?t=23943) should solve your problem.

0.7.0-1063 changelog (http://www.eqemulator.net/releases/logs/EQEmu-0.7.0-1063.txt):
KLS: Fixed: qglobals will now not be exported for npcs that do not have the qglobal flag set in the perl parser.

In short, you need to make sure any NPCs that need to be able to access quest_globals have the qglobal field in the npc_types table set to 1. This was changed after release 1063. I went from 1061 to 1090 after changing servers & reinstalling everything, which is how I ran into the problem.

trevius
02-26-2008, 09:28 PM
THANK YOU!!!

That is exactly what I needed to hear. I figured it would be an easy fix :D

AndMetal
02-26-2008, 09:43 PM
Fyi, if you're researching bugs on your server, I have a forum (http://andmetal.net/smforum/index.php?board=3.0) for my server that I use to document all bugs that I'm currently experiencing, as well as what the (detailed) resolutions were (which is where I found the answer (http://andmetal.net/smforum/index.php?topic=35.0) for this). I find it helps if I ever run into the issue again, and since Google is checking it for changes like a million times a day, it also helps for anyone googling for answers.

Striat
02-27-2008, 01:59 PM
Wanted to make a suggestions for something that may make quest globals a little more functional for you
[QUOTE=trevius;143734]

sub EVENT_SAY {
if ($text=~/hail/i && $level_quest == undef) {
quest::say("Hello, $name, you don't have a flag defined for this quest yet. Would you like a flag?");}

if ($text=~/flag/i && $level_quest == undef) {
quest::say("Hello, $name, you don't have a flag defined for this quest yet. Would you like a flag?");
quest::setglobal("level_quest", 1, 5, "F");
}

if ($text=~/hail/i && $level_quest == 1) {
quest::say("Hello, $name, you are flagged with 1 for this quest.");}

}
$level_quest = undef;
}
}

For this, I'd write it,

sub EVENT_SAY {
if ($text=~/hail/i && $level_quest == undef) {
quest::say("Hello, $name, you don't have a flag defined for this quest yet. Would you like a flag?");}

if ($text=~/flag/i) {
if ($qglobals{level_quest} == 1) {
quest::say("Hello, $name, you are flagged with 1 for this quest.");
}
elsif ($qglobals{level_quest} != 1) {
quest::say("Hello, $name, you don't have a flag defined for this quest yet. Would you like a flag?");
quest::setglobal("level_quest", 1, 5, "F");
}
}
}


Using the hases prevents you from having to undef variable each time. You can write is alot cleaner too.

I've written countless progression quests and here is another example of how you can write it to end up with cleaner text, etc.


sub EVENT_SAY {
if ($text=~/hail/i) {
if ($qglobals{generaltom} == 4) {
quest::say("You have proven yourself well, $name. For this next task, I'll need you to destroy the vicious sabertooth outside of the vilalge. He has run off with alot of our children");
}
elsif ($qglobals{generaltom} == 3) {
quest::say("Now, I'll need you to kill some deer to make the ceremonial headdress.");
}
elsif ($qglobals{generaltom} == 2) {
quest::say("Great, I'll need you to forage some green ikk berries to make the die for the ceremonial clothing.");
}
elsif ($qglobals{generaltom} == 1) {
quest::say("Seek out the alchemist and obtain the recipe for making the ceremonial headdress
}
else {
quest::say("You really handled that tiger well, $name! Good luck with your journeys");
}
}
}

trevius
02-27-2008, 03:25 PM
Thanks for the reply. I got it working last night after setting the NPC to 1 in the qglobals of the NPC table.

I have seen quests written that way, but doing it that way is a little harder for me to read. It may be cleaner, but the way I have it right now seems to work fine for me. The actual quest has more "IF"s and might get a little complicated if I started trying to do elses and stuff to clean it up a little.

I may have modified it slightly after adding it in to tweak it a little, but this should be basically what I am using right now:

#Permanent De-Level Quest for access to PoTimeA

sub EVENT_SAY {

if($text=~/hail/i && $level_quest == undef && $ulevel <= 69){
quest::say("Hello, $name, if you are here to give me a Golden Ticket, please do. Otherwise scram and don't come back until you reach level 70.");
}
if($text=~/hail/i && $level_quest == undef && $ulevel == 70){
quest::say("Hello, $name, I have a type of quest for you that you have most likely never heard of before. Let's just say it doesn't come without a heavy [price].");
}
if($text=~/price/i && $level_quest == undef && $ulevel == 70){
quest::say("If you are willing to give up your seasoned level 70 experience to me, I can give you access to a place that normal adventures are unable to get to. There are treasures to be found there that cannot be found anywhere else. Your experience shall be added to mine to make me even more powerful than I am now! Would you like to hear [more]?");
}
if($text=~/more/i && $level_quest == undef && $ulevel == 70){
quest::say("If you are ready to make this great [sacrifice], just say the word and I will take your experience! If you would like to know more reasons of [why] you might want to de-level, I can tell you.");
}
if($text=~/why/i && $level_quest == undef && $ulevel == 70){
quest::say("De-leveling is mainly for players who like to solo often, or who prefer to level instead of raiding. If you find yourself getting bored here, you may want to give it a try. You won't be able to gain items that are the quality of raid items, but you can get fun things that may make you more efficient at soloing. Also, if you are planning to help level a friend or alt, de-leveling is a great way to do so, as it allows you to bring 1 friend with you.");
}
if($text=~/sacrifice/i && $level_quest == undef && $ulevel == 70) {
quest::say("You have made a great sacrifice! Hopefully the rewards prove to be well worth it.");
$client->Message(15, "You have received a flag to access the Plane of Time A");
quest::setglobal("level_quest", 1, 5, "F");
quest::summonitem(2242);
quest::selfcast(331);
quest::level(1);
}


if($text=~/hail/i && $level_quest == 1) {
quest::say("Hello again, $name! Anytime you wish to travel to the Plane of [Time] A, I will send you straight there. However, if you are looking for other De-Leveling services, you will need to speak with my sister right here next to me.");
}

if ($text =~/time/i && $level_quest == 1)
{
quest::say ("Few journey to the Plane of Time, but even fewer return. So be careful!");
$client->Message(6, "A beam of light surrounds your body, and particle by particle your entire being is relocated.");
quest::movepc(219, 0,0,3);
}
{
$level_quest=undef;
}
}


sub EVENT_ITEM {
if(plugin::check_handin(\%itemcount, 2242 => 1)) {
quest::say("The person who gave this to you has made a great sacrifice to get this item for you.");
$client->Message(15, "You have received a flag to access the Plane of Time A");
quest::setglobal("level_quest", 1, 5, "F");
}
else {
plugin::return_items(\%itemcount);
quest::say("I have no use for this item, $name. Take it back.");
}
{
$level_quest=undef;
}
}

Basically, the quest delevels a character from level 70 down to level 1 in exchange for access to a custom zone. It also gives them 1 tradeable token that they can give to anyone they want that can be turned in for a flag to the same zone. This way, a level 70 can de-level and bring an alt or friend to the zone with them and level up and get special gear with no level req that is much better than normal low level gear. The items there have clicky buffs that would even be useful for level 70 soloers. The main reason to go there is to level a friend or alt much quicker than normal and gear them up quickly. Just 1 more thing people can do if they get bored and would rather level characters than raid.