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

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 11-14-2014, 10:30 AM
nenelan
Hill Giant
 
Join Date: Feb 2008
Posts: 116
Default Buff Master & Combination Buff script pair.

Tabasco mentioned it in the DC thread, but I'll explain what's going on here. I've cleaned it up a bit from what he has hosted as well, and commented it a bit. Also due to a custom quest::GetSpellName(spell_id) thing we had, it will not work out of the gate as he has it, it's had those juggled around so it will still work here.

First up, the Buff_Master script. This can be thrown on any NPC, you may want to go through and clean up the name of the NPC in the says though if you change it. Make sure that qglobals are enabled for this particular NPC.

Code:
## Buff_Master.pl, should work out of the box right now.
## Buff Store/Unstore, will use spell 25895, Placeholder - Generic - DRU PC Spell to test for now once I get that done.
## Later Spell 1347, Test GMD was changed to have no effect and be used for our Combinatorial Dweomer spell.  

## You can use any spell number you like, just make sure the spell script is correct.

## $client->HasSpellScribed(id); - Something I wanted to add to remove click effects from working with this.  Never got around to it.
## $client->GetActSpellCost(spell_id, cost); - To adjust spell cost

## Please note, quest::GetSpellName(spell_id); was something that Tabasco created for this.  I've commented out the times where we've used it and replaced with 
## something that just reports the Spell ID.  It isn't required to switch back, but it IS handy/convenient for players to see what buffs they have listed.

sub EVENT_SAY {
	my $buffs = quest::saylink("buffs", 1, "buffs");
	if($text=~/hail/i) {
		$client->Message(15, "Buff Master says, Greetings, $name.  I am the Buff Master.  A rather strange appellation, but it will work, I suppose.  Simply cast any beneficial spells on me, and I will note them for use with your Combinatorial Dweomer spell.  You may also ask me what [$buffs] you currently have stored and I will let you know privily their spell id numbers.");
	}

	if ($text=~/buffs/i) {
		if (!defined $qglobals{BuffsCount}) {
			$client->Message(15, "Buff Master says, Sorry, $name, you do not have any buffs set up.  Please cast one on me to start!");
		}
		else {
			$first = "ComboBuff";
			$BuffsCount = $qglobals{'BuffsCount'};
			$client->Message(15, "Buff Master says, You currently have the following buffs saved:");
			for ($x = 1; $x <= $BuffsCount; $x++) {
				my $second = $x;
				my $string = $first . $second;
				$buffnum = $qglobals{$string};
##				$BuffName = quest::GetSpellName($buffnum);
##				$client->Message(15, "In Slot $x is spell number: $buffnum ($BuffName)");
				$client->Message(15, "In Slot $x is spell number: $buffnum");
			}
		}
	}
}

sub EVENT_CAST_ON {
	my $test = quest::IsBeneficialSpell($spell_id);
	my $testMana = quest::GetMana($spell_id);
	my $scribed = 0;
	if ($testMana >= 10) {
		$scribed = 1;
	}
##	$scribed = $client->HasSpellScribed($spell_id);  # Desired Functionality
	$first = "ComboBuff"; 		## Setting up strings for later usage.
	if ($test == 1  && $scribed == 1 && $spell_id != 25895) { ## Beneficial Buff 
		if (!defined $qglobals{BuffsCount}) { 			## No buffs set up.
			my $BuffsCount = 1;
			my $NextBuff = 1;
			$client->Message(15, "Buff Master says, Great, we are going to store the spell number $spell_id at the slot $NextBuff.  This is your first buff!");
			quest::setglobal('BuffsCount',$BuffsCount,5,F);
			my $second = $NextBuff;
			my $string = $first . $second;
			quest::setglobal($string,$spell_id,5,F);
		}
		else {											## We already have buffs set up for this character.
			$BuffsCount = $qglobals{'BuffsCount'};
			$NextBuff = $BuffsCount+1;
			$FoundBuff = 0;
			$FoundBuffAt = 0;
			for ($x = 1; $x <= $BuffsCount; $x++) {		## Run through a list of buffs already stored to see if we already have this buff stored.
				my $second = $x;
				my $string = $first . $second;
				my $TestBuff = $qglobals{$string};
				if ($TestBuff == $spell_id ) {
					$FoundBuff = 1;
					$FoundBuffAt = $x;
					$client->Message(15, "Buff Master says, We Found this buff already in slot $FoundBuffAt!");
				}
			}
			if ($FoundBuff == 0 ) {						## Simply add a new buff to the list.  We should also do a test here to see if they can cast it.
##				$BuffName = quest::GetSpellName($spell_id);
##				$client->Message(15, "Buff Master says, Great, we are going to store the spell number $spell_id ($BuffName) at the slot $NextBuff");
				$client->Message(15, "Buff Master says, Great, we are going to store the spell number $spell_id at the slot $NextBuff");
				quest::setglobal('BuffsCount',$NextBuff,5,F);
				my $second = $NextBuff;
				my $string = $first . $second;
				quest::setglobal($string,$spell_id,5,F);
			}
			else {										## Remove a buff from the list, and bump everything down to close up the list.
##				$BuffName = quest::GetSpellName($spell_id);
##				$client->Message(15, "Buff Master says, We are going to remove the spell number $spell_id ($BuffName) located in slot $FoundBuffAt.");
				$client->Message(15, "Buff Master says, We are going to remove the spell number $spell_id located in slot $FoundBuffAt.");
				my $second = $FoundBuffAt;
				my $string = $first . $second;
				for ($y = $FoundBuffAt; $y <= $BuffsCount; $y++) {
					if ($y == $BuffsCount) {  			## Last Buff in the List
						my $second = $y;
						my $string = $first . $second;
						quest::delglobal($string);
						quest::setglobal('BuffsCount',$BuffsCount-1,5,F);
					}
					else {								## Bring the next Spell down one level
						my $second = $y;
						my $stringOne = $first . $second;
						my $third = $y+1;
						my $stringTwo = $first . $third;
						quest::setglobal($stringOne, $qglobals{$stringTwo},5,F);
					}
				}
			}
		}
	}
	elsif ($test != 1) {
		$client->Message(15, "Buff Master says, That's not very nice, please don't cast nasty spells on me!");
	}
	elsif ($scribed != 1) {
		$client->Message(15, "Buff Master says, I'll only accept spells that have a mana cost.");
	}
	elsif ($spell_id == 25895 || $spell_id == 1347) {  
		$client->Message(15, "Buff Master says, We do not deal in recursion here.");
		## This was to prevent any issues, however, it WILL still cast at him, and remove ALL spells at once, due to the spell being scripted.  Not necessary.
	}
	else {
		$client->Message(15, "Buff Master says, That is not a valid buff, in fact, I'm not quite sure what you did but don't do it again.");
	}
}
Next up the spell script.
Code:
## This should all work out of the gate if you throw it in the spells quest file as "spellnum.pl"  For instance, we used 1397.pl.
## Please note, this had to be a spell that was tagged as self only.  Either something I did wrong, or a quirk of spell scripts?  
## I could never figure out just what was going on there,it worked fine by casting it with someone else targeted even though the 
## base spell was self only, did have to have yourself targeted as well.

sub EVENT_SPELL_EFFECT_CLIENT {
	my $ClientID = $entity_list->GetClientByID($caster_id);  ## Pull the person casting
	if ($ClientID) {
		if (!defined $qglobals{'BuffsCount'} && $qglobals{'BuffsCount'}<=0) {  ## Check that they have buffs set up first, let them know where to go, & break.
			$ClientID->Message(15, "You have not set up any buffs so far.  Please see the Buff Master in Forgotten Halls to get your buffs set up.");
			return;
		}
		$Target = $ClientID->GetTarget();  
		$BuffsCount = $qglobals{'BuffsCount'};
		for ($x = 1; $x <= $BuffsCount; $x++) {	
			my $first = "ComboBuff"; 
			my $second = $x;
			my $string = $first . $second;
			$Buff = $qglobals{$string};
			if ($x == 1) {  ## Inelegant, never felt like fixing.
				@spells = $Buff;
				$manaCost = quest::GetMana($Buff);
				$manaCost = $client->GetActSpellCost($Buff,$manaCost);
				$ManaTotal = $manaCost;
			}
			else {
				push (@spells, $Buff);
				$manaCost = quest::GetMana($Buff);
				$manaCost = $client->GetActSpellCost($Buff,$manaCost);
				$ManaTotal = $ManaTotal + $manaCost;  ## Not sure why I didn't do a +=.
			}
		}
		$ManaTotal = int($ManaTotal*1.5);  ## Increase the mana total by 1.5, as extra due to the convienence of this spell.
		if ($ManaTotal > $client->GetMana()) {
			$client->Message(15, "You do not have the mana to cast this spell.  Either regain some, or think of removing a few buffs with the Buff Master.  Total cost is $ManaTotal.");
		}
		else {
			$client->SetMana($client->GetMana()-$ManaTotal);
			foreach $spell (@spells) {
				$client->SpellFinished($spell,$Target,0,-1000);
			}
			$client->Message(15, "Total Cost, $ManaTotal");
		}
	}
}

sub EVENT_SPELL_EFFECT_NPC {  ## Just added as a caveat, probably never needed it.
	$client->Message(15, "We are sorry, you can not use this spell on an NPC");
}
Quick explanation of how to use this. Find wherever the server dev sets this up, cast buffs at it. The NPC will write them to qGlobals and save what you have. You can remove/add at any time you are at this npc, there's no buff limit other than your mana. When all done, load up the Combo Buff spell, whatever it's called, and cast it at your target (it should be a self only buff icon, this is okay and was required when I was developing it). It will shotgun off all of those spells at once at 1.5x adjusted mana cost.

We always used a 10 second spell cast time for our Combo Buff. That'd be up to whoever uses this, still useful for someone like a Shaman that'd sit there with 3 different groups & 3 different sets of buffs or something. Also, we set a decently large recast timer, due to people using it as a primary heal.

Interesting notes are: you could load runes and heals on this and become a nice little patch healer. We had some players that used that as a strategy to great effect. I imagine that you could put a test for spell duration to prevent heals from going on there. We debated it and threw it out the window, as we liked the emergent gameplay that stemmed from there.

As it stands, it will not report the buff name, it needs a special quest:: command that we added in for that. Should be fairly trivial, but was not something I knew how to do =P

Detrimental spells will not take as well out of design, I had to force this functionality. I had debated adding a version for that, but that could get VERY out of hand VERY quickly (wizard loading every nuke he'd ever had access to at once). I imagine it COULD be done well, but there'd have to be an upper limit on spell numbers for that, and heavy drawbacks. It COULD have some interesting applications for DOT spells though.

Hope someone gets some use out of this, it was a handy little thing. No one had ever asked about it before or I'd have shared prior to now (self-conscious about my code). I had in my mind to do a group version at one point as well, but I could see being more cumbersome & more potential for exploits.
Reply With Quote
  #2  
Old 11-03-2015, 01:18 PM
Splose's Avatar
Splose
Discordant
 
Join Date: Apr 2014
Posts: 279
Default

it wasnt working for me because of quest::getmana but I have it pulling all that information from the DB instead.. im still working on it a little bit but i'll post the fix before I customize it.. this is an awesome concept.
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 08:06 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