PDA

View Full Version : "Buff Bot" help


emho24
07-15-2016, 01:23 PM
I've got an npc that I'd like to hand out buffs to those players who ask, aka the good ol' "Buff Bot".

The issue I'm having is that I can't get her to cast group spells on the target, they won't land on the hailing player or anyone else. I have to set her up with the single target version of the spells to get anything to work.

Here is a simple example below. I've commented out the line where she casts Conviction, but it does work, she casts Conviction on the hailing player if I uncomment that line. What I want her to do instead is cast Hand of Conviction on the player so it will land on the whole group, but it won't land.

sub EVENT_SAY
{
if($text=~/hail/i)
{
$npc->Say("Buffs for you!");
#plugin::CastOnGroup(5257, 0, $client); # Conviction
plugin::CastOnGroup(5278, 0, $client); # Hand of Conviction
}
}

Buff says 'Buffs' for you!
Buffy is filled with a powerful conviction.

The above line is the verbose text in game, it shows that she just casts it on herself. This sounds like a /TGB ON issue if it were a player, but it's an NPC so I'm a bit confused.

Below are the comments in the plugin itself, I don't think I'm using it wrong.

Thoughts?

# Usage: plugin::CastOnGroup(SpellID, MaxDist=0, Client=$client);
# This script will cast the spell on the client's group from an NPC (such as a buff bot).
# SpellID - This is just the spell ID to be cast.
# MaxDist - This is an optional field for setting the Max Distance for the spell to land on group members.
# The Default 0 setting for MaxDist disables the check for distance so it will be cast on all group members in zone.
# Client - This is an optional field to set a specific client to cast buffs on their group (Default is the client interacting with the NPC)

N0ctrnl
07-15-2016, 01:42 PM
You looked at this at all? http://www.eqemulator.org/forums/showthread.php?t=36479

For scripting, there is a TON of stuff here in the forums. Just have to look around for it.

N0ctrnl
07-15-2016, 01:49 PM
Also, I'm pretty sure if you're casting group buffs you don't need to castongroup. I think castspell will accomplish the same thing.

emho24
07-15-2016, 02:36 PM
I'll try castspell instead of castongroup when I get home.

DanCanDo
07-15-2016, 04:40 PM
This is the script I have on my buff bot. It checks for a group and levels, then
cast the appropriate spells.(setting NPC level to 70 helps with buff timer).


sub EVENT_SAY {
if (($text=~/hail/i) && ($ulevel<46)) {
quest::say("Hello $name, If you or your group need [Temp] or [Spirit] to run with, please gather near. I can also give you [Clarity] to help you on your journeys as well. When you reach 46 I can give you KEI and at 47 Virtue");
}
if (($text=~/hail/i) && ($ulevel>46)) {
quest::say("Hello $name, If you or your group need [Virtue] or [KEI] or [Spirit] to run with, please gather near.");
}
if (($text=~/hail/i) && ($ulevel==46)) {
quest::say("Hello $name, If you or your group need [Temp] or [KEI] or [Spirit] to run with, please gather near.");
}
elsif (($text=~/temp/i) && ($ulevel<47)) {
my $Group = $client->GetGroup();
if ($Group) {
my $Valid = 1;
for ($count = 0; $count < $Group->GroupCount(); $count++) {
if ($Group->GetMember($count)->GetLevel() < 1) {
$Valid = 0;
}
}
if ($Valid == 1) {
quest::say("Incoming Group Temp for $name.");
$Group->CastGroupSpell($npc, 4053);
}
else {
quest::say("Sorry $name. You are not at the appropriate level for that.");
}
}
else {
quest::say("Incoming Temp for $name");
my $GetPlayerID = $client->GetID();
$npc->CastSpell(3692, $GetPlayerID );
}
}
elsif (($text=~/virtue/i) && ($ulevel>46)) {
my $Group = $client->GetGroup();
if ($Group) {
my $Valid = 1;
for ($count = 0; $count < $Group->GroupCount(); $count++) {
if ($Group->GetMember($count)->GetLevel() > 65) {
$Valid = 0;
}
}
if ($Valid == 1) {
quest::say("Incoming Group Virtue for $name.");
$Group->CastGroupSpell($npc, 3479);
}
else {
quest::say("Sorry $name. You are not at the appropriate level for that.");
}
}
else {
quest::say("Incoming Virtue for $name");
my $GetPlayerID = $client->GetID();
$npc->CastSpell(3467, $GetPlayerID );
}
}
elsif (($text=~/clarity/i) && ($ulevel<66)) {
quest::say("Incoming Clarity for $name");
my $GetPlayerID = $client->GetID();
$npc->CastSpell(174, $GetPlayerID );
}
elsif (($text=~/kei/i) && ($ulevel>45)) {
quest::say("Incoming KEI for $name");
my $GetPlayerID = $client->GetID();
quest::selfcast(2570);
}
elsif (($text=~/spirit/i) && ($ulevel<66)) {
my $Group = $client->GetGroup();
if ($Group) {
my $Valid = 1;
for ($count = 0; $count < $Group->GroupCount(); $count++) {
if ($Group->GetMember($count)->GetLevel() > 65) {
$Valid = 0;
}
}
if ($Valid == 1) {
quest::say("Incoming Spirit of Bih'Li for $name.");
$Group->CastGroupSpell($npc, 2524);
}
else {
quest::say("Sorry $name. You are not at the appropriate level for that.");
}
}
else {
quest::say("Incoming SoW for $name");
my $GetPlayerID = $client->GetID();
$npc->CastSpell(278, $GetPlayerID );
}
}
}

emho24
07-16-2016, 01:16 AM
Thanks all for the assistance. Below is what I ended up writing for levels up to 70. It will iterate through the hailing pc's group and give them the level appropriate buffs.
I didn't bother testing group buffs, I just buffed everyone with the single target versions.
I'm still an extreme novice with Perl but I'm learning (I'm mostly proficient in C#, Java).

sub EVENT_SAY
{
my @groupMembers;

if( $text =~ /hail/i )
{
if($client->IsGrouped())
{
for($count = 0; $count < 6; $count++)
{
my $cur = $client->GetGroup()->GetMember($count);
if($cur)
{
if($cur->IsClient())
{
push @groupMembers, $cur;
}
}
}
}
else
{
push @groupMembers, $client;
}

BuffMembers(\@groupMembers);

$npc->Say("Use them wisely " . $client->GetCleanName());
}
}

sub BuffMembers
{
my $members = shift;

my %buffBot;
# Levels 1 to 35
$buffBot{"tier1"}{Cleric}{HP} = 312; #Valor / 32
$buffBot{"tier1"}{Cleric}{SpellHaste} = 3576; #Blessing of Faith / 35
$buffBot{"tier1"}{Druid}{HPRegen} = 144; #Regeneration / 34
$buffBot{"tier1"}{Druid}{RunSpeed} = 11545; #Spirit of Wolf / 10
$buffBot{"tier1"}{Enchanter}{ManaRegen} = 174; #Clarity / 26
$buffBot{"tier1"}{Enchanter}{MeleeHaste} = 10; #Augmentation / 28
$buffBot{"tier1"}{Magician}{DamageShield} = 479; #Inferno Shield / 28
$buffBot{"tier1"}{Shaman}{HP} = 167; #Talisman of Tnarg / 32

# Levels 36 to 55
$buffBot{"tier2"}{Cleric}{HP} = 1533; #Heroism / 52
$buffBot{"tier2"}{Cleric}{SpellHaste} = 3576; #Blessing of Faith / 35
$buffBot{"tier2"}{Druid}{HPRegen} = 1568; #Regrowth / 54
$buffBot{"tier2"}{Druid}{RunSpeed} = 11545; #Spirit of Wolf / 10
$buffBot{"tier2"}{Enchanter}{ManaRegen} = 1693; #Clarity II / 52
$buffBot{"tier2"}{Enchanter}{MeleeHaste} = 1708; #Aanya's Quickening / 53
$buffBot{"tier2"}{Magician}{DamageShield} = 412; #Shield of Lava / 45
$buffBot{"tier2"}{Shaman}{HP} = 1585; #Talisman of Kragg / 55

# Levels 56 to 70
$buffBot{"tier3"}{Cleric}{HP} = 5257; #Conviction / 67
$buffBot{"tier3"}{Cleric}{SpellHaste} = 5258; #Blessing of Devotion / 67
$buffBot{"tier3"}{Druid}{HPRegen} = 5342; #Oaken Vigor / 66
$buffBot{"tier3"}{Druid}{RunSpeed} = 11545; #Spirit of Wolf / 10
$buffBot{"tier3"}{Enchanter}{ManaRegen} = 5513; #Clairvoyance / 68
$buffBot{"tier3"}{Enchanter}{MeleeHaste} = 5507; #Speed of Salik / 67
$buffBot{"tier3"}{Magician}{DamageShield} = 5466; #Fireskin / 66
$buffBot{"tier3"}{Shaman}{HP} = 5396; #Wunshi's Focusing / 68
$buffBot{"tier3"}{Shaman}{MeleeDodge} = 5390; #Spirit of Sense / 66
$buffBot{"tier3"}{Shaman}{MeleeProc} = 6667; #Spirit of the Panther / 69

foreach my $member (@{$members})
{
my $clientLevel = $member->GetLevel();

if($clientLevel >= 1 && $clientLevel <= 35)
{
my $tier = "tier1";
$npc->SpellFinished($buffBot{$tier}{Cleric}{HP}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Cleric}{SpellHaste}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Druid}{HPRegen}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Druid}{RunSpeed}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Enchanter}{MeleeHast e}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Enchanter}{ManaRegen }, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Magician}{DamageShie ld}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Shaman}{HP}, $member, 0);
}
elsif($clientLevel >= 36 && $clientLevel <= 55)
{
my $tier = "tier2";
$npc->SpellFinished($buffBot{$tier}{Cleric}{HP}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Cleric}{SpellHaste}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Druid}{HPRegen}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Druid}{RunSpeed}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Enchanter}{ManaRegen }, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Enchanter}{MeleeHast e}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Magician}{DamageShie ld}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Shaman}{HP}, $member, 0);
}
elsif($clientLevel >= 56 && $clientLevel <= 70)
{
my $tier = "tier3";

$npc->SpellFinished($buffBot{$tier}{Cleric}{HP}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Cleric}{SpellHaste}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Druid}{HPRegen}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Druid}{RunSpeed}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Enchanter}{ManaRegen }, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Enchanter}{MeleeHast e}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Magician}{DamageShie ld}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Shaman}{HP}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Shaman}{MeleeDodge}, $member, 0);
$npc->SpellFinished($buffBot{$tier}{Shaman}{MeleeProc}, $member, 0);
}
}
}