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

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 05-10-2011, 10:55 PM
Durge
Sarnak
 
Join Date: Jan 2010
Location: USA
Posts: 51
Default

I used the same set up, but I can't figure out what is wrong here, can anyone help?


Code:
sub EVENT_SAY{

	$client->Message(7, " ");
	my $NPCName = $npc->Ram();

	if($text=~/Hail/i) {
		if ($ulevel <= 10) {
			quest::selfcast(5415);
			quest::selfcast(5312);
			quest::selfcast(5405);
			quest::selfcast(5409);
			quest::selfcast(5521);
			quest::selfcast(5365);
			quest::selfcast(278);
			quest::selfcast(939);
			quest::selfcast(3391);
			quest::selfcast(5390);
			$client->Message(315, "$NPCName whispers to you, 'Since you are level 10 or lower you get free buffs, $name! Good luck to you.'");
		}
		if (($ulevel > 10) && ($ulevel < 25)) {
		$client->Message(315, "$NPCName whispers to you, 'Hello $name, I will give you buffs in exchange for 100 platinum.'");
		}
		if (($ulevel >= 25) && ($ulevel < 70)) {
		$client->Message(315, "$NPCName whispers to you, 'Hello $name, I will give you buffs in exchange for 500 platinum.'");
		}
		if ($ulevel >= 70) {
		$client->Message(315, "$NPCName whispers to you, 'Hello $name, I will give you buffs in exchange for 1,000 platinum.'");
		}
	}
}


sub EVENT_ITEM {

	$client->Message(7, " ");
	my $NPCName = $npc->Ram();
	
	if ($platinum == 1000) {
		if ($ulevel >= 70) {
			quest::selfcast(5278);
			quest::selfcast(5415);
			quest::selfcast(5312);
			quest::selfcast(5405);
			quest::selfcast(5409);
			quest::selfcast(5521);
			quest::selfcast(5365);
			quest::selfcast(278);
			quest::selfcast(939);
			quest::selfcast(3391);
			quest::selfcast(5390);
			$client->Message(315, "$NPCName whispers to you, 'Thank you $name!'");
		} else {
			$client->Message(315, "$NPCName whispers to you, 'Use the correct amount of platinum, $name!'");
			quest::givecash($copper,$silver,$gold,$platinum);
		}
	}
	if ($platinum == 500) {
		if (($ulevel < 75)&&($ulevel >= 25)) {
			quest::selfcast(5278);
			quest::selfcast(5415);
			quest::selfcast(5312);
			quest::selfcast(5405);
			quest::selfcast(5409);
			quest::selfcast(5521);
			quest::selfcast(5365);
			quest::selfcast(278);
			quest::selfcast(939);
			quest::selfcast(3391);
			quest::selfcast(5390);
			$client->Message(315, "$NPCName whispers to you, 'Thank you $name!'");
		} else {
			$client->Message(315, "$NPCName whispers to you, 'Use the correct amount of platinum, $name!'");
			quest::givecash($copper,$silver,$gold,$platinum);
		}
	}
	if ($platinum == 100) {
		if (($ulevel > 10) && ($ulevel < 25)) {
			quest::selfcast(5415);
			quest::selfcast(5312);
			quest::selfcast(5405);
			quest::selfcast(5409);
			quest::selfcast(5521);
			quest::selfcast(5365);
			quest::selfcast(278);
			quest::selfcast(939);
			quest::selfcast(3391);
			quest::selfcast(5390);
			$client->Message(315, "$NPCName whispers to you, 'Thank you $name!'");
		} else {
			$client->Message(315, "$NPCName whispers to you, 'Use the correct amount platinum, $name!'");
			quest::givecash($copper,$silver,$gold,$platinum);
		}
	}
	if (($platinum < 100) || ($platinum < 500) && ($platinum > 100) || ($platinum < 1000) && ($platinum > 100) && ($platinum > 500) || ($platinum > 1000)) {
		$client->Message(315, "$NPCName whispers to you, 'Use the correct amount of platinum, $name!'");
		quest::givecash($copper,$silver,$gold,$platinum);
	}
}
Reply With Quote
  #2  
Old 05-11-2011, 07:11 AM
lich2594
Sarnak
 
Join Date: Jun 2006
Location: Tennessee, USA
Posts: 77
Default

Without any details as to what's causing you the problems...

Try using:

Code:
my $NPCName = $npc->GetCleanName();
instead of:

Code:
my $NPCName = $npc->Ram();
__________________
Reply With Quote
  #3  
Old 05-10-2011, 11:16 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Can you give us more details of what works and what doesn't? Have you tried slimming down the script to the bare minimum and adding additional functions one at a time to see when it breaks?
Reply With Quote
  #4  
Old 05-11-2011, 08:42 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

I would guess the blank lines come from this:

$client->Message(7, " ");
Reply With Quote
  #5  
Old 05-11-2011, 08:43 AM
lich2594
Sarnak
 
Join Date: Jun 2006
Location: Tennessee, USA
Posts: 77
Default

Quote:
Originally Posted by lerxst2112 View Post
I would guess the blank lines come from this:

$client->Message(7, " ");
That's correct... and since it isn't within the IF bracket, it will always execute as long as there isn't an error prior to that point in the script.
__________________
Reply With Quote
  #6  
Old 05-12-2011, 07:36 AM
Durge
Sarnak
 
Join Date: Jan 2010
Location: USA
Posts: 51
Default

I tried even one small message and it still didn't work.
Here is what I have.
I also tried with the name you gave me and it didn't work.
Code:
sub EVENT_SAY {

$client->Message(7, " ");
my $NPCName = $npc->Ram();
my $Hello = quest::saylink("Hello", 1);

	if($text=~/Hail/i) {
	$client->Message(315, "$NPCName whispers to you, '[$Hello], I am a test bot.'");
	}
}
Reply With Quote
  #7  
Old 05-12-2011, 07:41 AM
lich2594
Sarnak
 
Join Date: Jun 2006
Location: Tennessee, USA
Posts: 77
Default

After changing the quest files, are you reloading quest memory? If I remember correctly, the command is: #reload pl (I haven't worked on the Emu in a while.)
__________________
Reply With Quote
  #8  
Old 05-12-2011, 07:13 PM
Durge
Sarnak
 
Join Date: Jan 2010
Location: USA
Posts: 51
Default

hmm, that didn't work either.
Reply With Quote
  #9  
Old 05-12-2011, 08:43 PM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default

Quote:
Originally Posted by lich2594 View Post
After changing the quest files, are you reloading quest memory? If I remember correctly, the command is: #reload pl (I haven't worked on the Emu in a while.)
#reloadquest
Reply With Quote
  #10  
Old 05-12-2011, 08:28 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

This line is wrong.

my $NPCName = $npc->Ram();

Replace with this as noted above:

my $NPCName = $npc->GetCleanName();
Reply With Quote
  #11  
Old 05-12-2011, 10:27 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Well, like I said before. Strip the script down to the bare minimum, no saylinks, no npc name, nothing but a simple response to the hail, and if that works add things and see where you break it.
Reply With Quote
  #12  
Old 05-13-2011, 12:08 PM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default

Since this thread popped back up, I got back on finalizing my buff bot.

One thing I was never able to do is get the chanter or Cleric bot to cast spells that have a target of group v2. Spells like the Druid Skin like Nature work just fine.

I have tried combinations like these. I have in remarks what happened with each spell.

Code:
#$npc->SpellFinished(3479,  $client->GetID()); #Buff bot cast virtue on herself
#$ent->CastSpell(3479, $ent, 10, -1, -1); #I cast virtue on myself
#$npc->CastSpell(3479, $ent, 10, -1, -1); #Buff bot cast virtue on herself
#$npc->CastSpell(3479, $userid); #Buff bot cast virtue on herself
Yeah I could code it to where I cast Virtue on myself but that seems really lame. Plus people will complain they did not get it, because they moved or something.
Reply With Quote
  #13  
Old 05-22-2011, 10:01 AM
Xevious
Fire Beetle
 
Join Date: May 2011
Posts: 15
Default My updates

Thanks for the script. This was a good one for me to start learning with and Buffy is now a happy part of my server interacting with players and providing buffs.

I made a few tweaks that I liked, and wanted to share my changes if anyone cares for them:

- Removed the extra line feeds from her interaction (the " - " lines)
- Consolidated the matching logic for requested spells. Asking for "port" fed back 3 matches per spell in the original logic.
- Put her "action" logic on a 5 minute timer and gave her 33% chance to log out (depop), 33% chance to shout one of three things, and a 33% chance to just sit down and wait for a customer.

In her setup in the database, I set her on a 15 min spawn with a 5 minute variable timer, just to give her a bit more random and player like function.


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 = ("Bind Affinity","Chloroplast","Port to Arcstone","Port to Barindu","Port to Blightfire Moors","Port to Bloodfields","Port to Buried Sea","Port to Butcher","Port to Cobalt Scar","Port to Commons","Port to Dawnshroud","Port to Feerrott","Port to Great Divide","Port to Grimling","Port to Iceclad","Port to Karana","Port to Knowledge","Port to Lavastorm","Port to Misty","Port to Natimbi","Port to Ro","Port to Steamfont","Port to Stonebrunt","Port to Surefall Glade","Port to the Combines","Port to the Nexus","Port to The Steppes","Port to Toxxulia","Port to Twilight","Port to Undershore","Port to Wakening Lands","Port to Emerald Jungle","Everlasting Breath","Levitation","Natureskin","Protection of the Cabbage","Regrowth","Resist Cold","Resist Disease","Resist Fire","Resist Magic","Resist Poison","See Invisible","Shield of Blades","Shield of Thorns","Skin like Diamond","Skin like Nature","Port to Sky Fire Mountains","Spirit of Eagle","Spirit of the Shrew","Spirit of Wolf","Storm Strength");
@SpellCost = ("2",            "10",         "15",              "15",             "2",                       "15",                 "15",                "5",              "10",                 "5",              "8",                 "8",               "8",                   "5",               "8",              "5",              "8",                "8",                "8",            "15",             "8",         "8",                "5",                 "5",                     "8",                   "5",                "20",                 "5",               "8",               "15",                "10",                    "8",                     "2",                 "2",         "15",        "15",                       "15",      "8",          "10",            "5",          "10",          "10",           "2",            "15",              "10",              "8",                "10",              "8",                         "15",             "8",                  "2",             "10");
@SpellID =   ("35",           "145",        "8965",            "5731",           "9957",                    "6184",               "11981",             "553",            "1440",               "551",            "2429",              "556",             "1438",                "2419",            "1434",           "550",           "3184",             "554",              "558",          "4966",           "555",       "557",              "3792",              "2020",                  "1517",                "2432",             "9954",               "552",             "2424",            "8235",              "1398",                  "1737",                  "2881",              "2894",      "1559",      "2188",                     "1568",    "61",         "63",            "60",         "64",          "62",           "80",           "1560",            "356",             "422",              "423",             "1736",                      "2517",           "4054",               "278",           "430");

sub EVENT_SPAWN 
{
      quest::settimer("buffy", 300);
	  quest::shout ("Hello everyone!  I'm back for awhile offering druid buffs near the bank.  Hail me if you are interested.");
}

sub EVENT_TIMER 
{
	#$npc->SetAppearance(1);
	if($timer eq "buffy") 
	{
		my $random_number = int(rand(8));
		if ($random_number == 0  || $random_number == 1 || $random_numer == 2)
		{
			$npc->SetAppearance(1);
			quest::shout ("Camping out for a bit.  See you later!");
			quest::depop();
		}
		elsif ($random_number == 3)
		{
			$npc->SetAppearance(0);
			quest::shout("Need a port? Come see me by the tree at the main bank!");
		}
		elsif ($random_number == 4)
		{
			$npc->SetAppearance(0);
			quest::shout("Giving druid buffs for pp by the tree near the bank!");
		}
		elsif ($random_number == 5)
		{
			$npc->SetAppearance(0);
			quest::shout("Get your buffs here! Come see me over by the big bank!");
		}
		if ($random_number == 6  || $random_number == 7 || $random_numer == 8)
		{
			$npc->SetAppearance(1);
		}
	}
}

sub EVENT_SAY
{
	my $all = quest::saylink("List", 1);
	my $ports = quest::saylink("Ports",1);
	my $buffs = quest::saylink("Buffs",1);
	#Spacer between Text messages to make them easier to read
	#$client->Message(7, "-"); 
	my $NPCName = $npc->GetCleanName();
	if ($text =~/Hail/i)
	{
		$npc->SetAppearance(0);
		$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. If you prefer to just see the [$buffs] or [$ports] I can do that too. 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) || (($text =~ /Buffs/i) && ($SpellList[$n] !~ /Port to/i)) || (($text =~ /Ports/i) && ($SpellList[$n] =~ /Port to/i))) 
			{
				my $SpellList = quest::saylink($SpellList[$n]);
				my $SpellCost = $SpellCost[$n];
				$client->Message(315, "$NPCName whispers to you, 'Possible match is: $SpellList and it costs $SpellCost pp");
			}
			#if ((lc($SpellList[$n]) =~ lc($text) && lc($SpellList[$n]) ne lc($text)) || (($text =~ /Buffs/i) && ($SpellList[$n] !~ /Port to/i))) 
			#{
			#	my $SpellList = quest::saylink($SpellList[$n]);
			#	my $SpellCost = $SpellCost[$n];
			#	$client->Message(315, "$NPCName whispers to you, 'Possible match is: $SpellList and it costs $SpellCost pp");
			#}
			#if ((lc($SpellList[$n]) =~ lc($text) && lc($SpellList[$n]) ne lc($text)) || (($text =~ /Ports/i) && ($SpellList[$n] =~ /Port to/i)) ) 
			#{
			#	my $SpellList = quest::saylink($SpellList[$n]);
			#	my $SpellCost = $SpellCost[$n];
			#	$client->Message(315, "$NPCName whispers to you, 'Possible match is: $SpellList and it costs $SpellCost pp");
			#}
			
 			#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}!");
       		if ($SpellList[$n] =~  /Port to/i)
       		{
       			quest::selfcast($SpellID[$n]) 
       		}
       		else
       		{
       		$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");
}
Reply With Quote
  #14  
Old 05-22-2011, 10:06 AM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default

I have three on my server now. A cleric, a druid and an enchanter. I also have them doing a MGB at random intervals, like a minimum of around 40 minutes with a max around 80 minutes. The start giving MGB calls every minute, 5 minutes before time for the MGB. The still act like buff vendors and give random calls through the zone with random text.
Reply With Quote
Reply


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 04:17 AM.


 

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