PDA

View Full Version : Lang quest - $qglobals not working.


Sylaei
10-11-2008, 05:30 PM
Ok, guys, I give up. I can't get this to work. I'm sure the quest is right, I think this might be something I need to add or change in the database but I can't seem to find it.

I have a new npc in pok that I want to teach you a lang for pp. I thought I'd use a global variable to determine if you had paid and then let you tell him what lang you wanted to learn. I realize there are eaiser ways to do this i.e. turn in an item, but I wanted to see if this was possible. It should be, but I'm stumped.
Here is the quest so far:


#Script to learn a language for 10pp each.
sub EVENT_SAY
{
if($text=~/Hail/i)
{
quest::say("I can teach you a Language if you will give me 10 pp and then tell me the language you wish to learn. I can teach the following languages: Barbarian, Erudian, Elvish, Dark Elvish, Dwarvish");
}
if($text=~/Barbarian/i)
{
if (defined($qglobals{lang}))
{
quest:setlanguage(1,100);
quest:delglobal("lang");
}
else
{
quest::say("You must pay first! Nobody gets barbarian for free.");
}
}
if($text=~/Erudian/i)
{
if (defined($qglobals{lang}))
{
quest:setlanguage(2,100);
quest:delglobal("lang");
}
else
{
quest::say("You must pay first! Nobody gets a free languague.");
}
}
if($text=~/Elvish/i)
{
if (defined($qglobals{lang}))
{
quest:setlanguage(3,100);
quest:delglobal("lang");
}
else
{
quest::say("You must pay first! Nobody gets a free languague.");
}
}
if($text=~/Dark Elvish/i)
{
if (defined($qglobals{lang}))
{
quest:setlanguage(4,100);
quest:delglobal("lang");
}
else
{
quest::say("You must pay first! Nobody gets a free languague.");
}
}
if($text=~/Dwarvish/i)
{
if (defined($qglobals{lang}))
{
quest:setlanguage(5,100);
quest:delglobal("lang");
}
else
{
quest::say("You must pay first! Nobody gets a free languague.");
}
}
}

sub EVENT_ITEM
{
if ($platinum == 10)
{
quest::setglobal("lang", 1, 1, "Y1");
quest::say("Done. Which Language do you want to learn?");

}
}

joligario
10-11-2008, 07:22 PM
Don't forget all quest commands need double-colons

quest::command

Also, ensure your NPC has the ability to set globals in the npc_types table.

Sylaei
10-11-2008, 11:27 PM
Thanks, I missed the single colon. Copy and Paste can get you into trouble :-)

I didn't have the npc set to use globals.

I'll have to restart the server I assume to get it to take affect.

trevius
10-13-2008, 03:38 AM
I think a simple repop or at most zone reset will make the qglobal setting take effect.

Sylaei
10-14-2008, 12:22 AM
I did have to do a reboot. A repop didn't work. Is it enough to get everyone out of the zone? That also didn't work. A reboot did, but I'd rather do a zone reset if there is some way to force it.

That fixed it, the script is working fine.

Thanks

Rocker8956
10-14-2008, 12:47 AM
I have not played with the globals but I know for regular quest changes a #reloadpl usually works.

trevius
10-14-2008, 03:51 AM
If your zones are static, having everyone leave isn't the same as a reset, but if they are all dynamic it basically is. You can always use #zoneshutdown <zonename> to force it to shut down. Make sure to zone out first =P