Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-31-2009, 02:16 AM
Sylaei
Hill Giant
 
Join Date: Jan 2007
Posts: 124
Default

I just realized there was an error, I changed the word All to List but I didn't change it everywhere. Danged ole bugs.


Code:
#A buff bot script.
#Buffs a player for pp.

#SpellList is the array containing the names of the spells. SpellCost is the amount in pp for each spell. SpellID is the spell that is cast by the npc.
#Note these are 3 arrays.  Each position in the array corosponds to the same position in the other arrays.
#So I have this set so that if you say 'Spirit of Wolf' and pay 2 pp, then the npc will cast spell 278 on you.
#I am setting the amounts to pp just because they can be any amount you wish, this requires changing the EVENT_ITEM function to handle the other money types.
@SpellList = ("Everlasting Breath", "Improved Superior Camouflage", "Levitation", "See Invisible", "Spirit of Wolf", "Storm Strength");
@SpellCost = ("2",                  "10",                           "2",          "2",             "2",              "10");
@SpellID =   ("2881",               "1435",                         "2894",       "80",            "278",            "430");

sub EVENT_SAY
{
	my $all = quest::saylink("List", 1);
	#Spacer between Text messages to make them easier to read
	$client->Message(7, "-");
	my $NPCName = $npc->GetCleanName();
	if ($text =~/Hail/i)
	{
		$client->Message(315, "$NPCName whispers to you, 'If you need a buff or a Port just let me know, or I can [$all] them for you. You may also enter a partial name and I can find it.'");
	}
	#Counts each row for the While
	my $count = 1;
	#Counts each element in the Array for the While
	my $n = 0;
	if ($text !~ /Hail/i)
	{
		while ($SpellList[$n])
		{
			#This searches the list to find possible matches. The lc() command makes all text lowercase.
			#It is easier to make all text lower case for comparison, if the user types uppercase it will still match.
			if ((lc($SpellList[$n]) =~ lc($text) && lc($SpellList[$n]) ne lc($text)) || ($text =~ /^List$/i)) 
			{
				my $SpellList = quest::saylink($SpellList[$n]);
				$client->Message(315, "$NPCName whispers to you, 'Possible match is: $SpellList");
			}
 			#This is the command that is executed when a the user enters a spell.
			if (lc($SpellList[$n]) eq lc($text) && $text !~ /^List$/i)
			{
				#Creates a global variable.  You must set the qgolbal field in the npc_types table to 1 for each npc you wish to handle global variables.
				#buff is the name, $text is what the varible should be eq too, 0 only this npc, char, and zone apply to the variable, M5 is 5 minutes.
				quest::setglobal("buff", $text, 0, "M5");
				#I'm not sure why I need the next line, the line above should set the $qglobals{buff}, but it wouldn't work for me.
				$qglobals{buff} = $text;
				$client->Message(315, "Please give me $SpellCost[$n]pp, and I'll cast $qglobals{buff} for you!");
			}
			$n++;
			$count++;
		}
	}
} 
 
sub EVENT_ITEM
{
	my $correctmoney = 0;
	#Counts each row for the While
	my $count = 1;
	#Counts each element in the Array for the While
	my $n = 0;
	#Cycles through each spell in the array until it matches the requested spell, and the amount pp required.
	while ($SpellList[$n])
	{
		if(($SpellList[$n] eq $qglobals{buff}) && ($platinum == $SpellCost[$n]))
		{
	        $client->Message(315, "Thank you for the $SpellCost[$n]pp, prepare for $qglobals{buff}!");
       		$npc->CastSpell($SpellID[$n], $userid);
    		#set this to 1 so that we don't return money we shouldn't.
       		$correctmoney = 1;
		}
		$n++;
		$count++;
	}
	#Returns the money if it is not the correct amount.
	if ($correctmoney == 0 )
    {
        if(($copper > 0) || ($silver > 0) || ($gold > 0) || ($platinum > 0))
        {
            $client->Message(315, "I don't need these coins, you may have them back."); 
            quest::givecash($copper,$silver,$gold,$platinum);
        }
    }
	#deletes the $qglobals{buff} variable.
	quest::delglobal("buff");
}
__________________
Syl

"The significant problems we have cannot be solved at the same level of thinking with which we created them."
Albert Einstein
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

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


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3