Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-12-2013, 02:27 PM
Figback65
Discordant
 
Join Date: Aug 2009
Location: 2131231231
Posts: 255
Default Buff Bot re-creation NPC getclass() Help

There is a post on here for an awsome buff bot

http://www.eqemulator.org/forums/showthread.php?t=29401

I am trying to take this a step further but my still growing limit script knowledge is leaving me in the dust.

I have a spawngroup cycle that spawns my buff bot. Sometimes it spawns as different classes, so when It spawns I want it to be able to only cast spells from the class it spawned as and with a player(not npc) level check so a level 1 player cannot get clarity 2 because he is too low lvl. I am posting what I have done so far and hoping im on the right track lol.

Code:
#Credit goes to Sylaei for the original creation of this buff bot! Thank you Sylaei 08-31-2009
#Edited by Fig to suit VCR server needs. 02-02-2013

sub EVENT_SPAWN {
my $Ench = ($npc->GetClass() == 'Enchanter');
my $Necro = ($npc->GetClass() == 'Necromancer');

if ($npc->GetClass() == 'Enchanter') {
@SpellList = ("Bind Affinity","Breeze","Clarity","Clarity II","Alacrity","Augment","Aanya's Quickening","Rune I");
@SpellCost = ("10","25","50","200","10","30","100","5");
@SpellID =   ("35","697","174","1693","170","1729","1708","481");

}

else ($npc->GetClass == 'Necromancer') {
@SpellList = ("Dead Men Floating");
@SpellCost = ("10");
@SpellID =   ("1391");
}

}


sub EVENT_SAY {
my $buffs = quest::saylink("buffs", 1);
my $NPCName = $npc->GetCleanName();
if ($text =~/Hail/i) {
$client->Message(315, "Chip Chip $name, Do you need some $buffs?'");
}

#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) && $Ench {
	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 =~ /^buffs$/i)) {
		my $SpellList = quest::saylink($SpellList[$n]);
		$client->Message(315, "These are your choices, $SpellList");
		}
 		#This is the command that is executed when a the user enters a spell.
			if (lc($SpellList[$n]) eq lc($text) && $text !~ /^buffs$/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("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
		}
	}


elsif ($text !~ /Hail/i) && $Necro {
	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 =~ /^buffs$/i)) {
		my $SpellList = quest::saylink($SpellList[$n]);
		$client->Message(315, "These are your choices, $SpellList");
		}
 		#This is the command that is executed when a the user enters a spell.
			if (lc($SpellList[$n]) eq lc($text) && $text !~ /^buffs$/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("buffs", $text, 0, "M5");
			$client->Message(315, "That's going to cost $SpellCost[$n]pp for the $qglobals{buffs} buff.");
			}
			$n++;
			$count++;
		}
	}
}

I do not have the level checks placed anywhere because honestly i have no clue where to put the check lol.
As always any and all feedback and suggestions appreciated

Edit: Its having a problem calling the correct spell list. I am pretty sure I cannot call
Code:
my $Ench = ($npc->GetClass() == 'Enchanter');
from sub EVENT_SPAWN to sub EVENT_SAY. Also I think my IF statement under EVENT_SAY could be changed to something like if
Code:
If ($npc->GetClass() == 'Enchanter') || ($npc->GetClass() == 'Enchanter')
brain hurts
__________________

Last edited by Figback65; 02-12-2013 at 03:16 PM.. Reason: notes
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 09:55 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3