View Single Post
  #12  
Old 10-31-2013, 10:47 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default

Here, Entity Variables work just as well, make sure to set the NPC's qglobal to 1!

EDIT: Entity Variables reset upon #repop of the NPC.
Code:
sub EVENT_SAY
{
	if(!defined $qglobals{Won})
	{
		if($npc->GetEntityVariable("HailTest") >= 1 && $npc->GetEntityVariable("HailTest") <= 9)
		{
			if($text=~/Hail/i)
			{
				$npc->SetEntityVariable("HailTest", ($npc->GetEntityVariable("HailTest") + 1));
				quest::shout2("$name has hailed me, " . (10 - $npc->GetEntityVariable("HailTest")) . " more people can win!");
				quest::setglobal("Won", 1, 5, "F");
				#quest::givecash(Copper, Silver, Gold, Platinum);
				#quest::summonitem(1001, 1);
			}
		}
		elsif(!$npc->GetEntityVariable("HailTest"))
		{
			if($text=~/Hail/i)
			{
				$npc->SetEntityVariable("HailTest", 1);
				quest::shout2("$name has hailed me, " . (10 - $npc->GetEntityVariable("HailTest")) . " more people can win!");
				quest::setglobal("Won", 1, 5, "F");
				#quest::givecash(Copper, Silver, Gold, Platinum);
				#quest::summonitem(1001, 1);
			}
		}
		elsif($npc->GetEntityVariable("HailTest") > 9)
		{
			if($text=~/Hail/i)
			{
				$npc->Depop();
			}
		}
	}
	else
	{
		if($text=~/Hail/i)
		{
			plugin::Whisper("You may only win once!");
		}
	}
}
Reply With Quote