EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   NPC Buffing Scripting Help (https://www.eqemulator.org/forums/showthread.php?t=42520)

Zoid13erg 07-06-2019 02:43 PM

NPC Buffing Scripting Help
 
Hey I am hoping I can get some help with scripting my npc buff bot i have in PoK. Currently I have it set to Shout every so often that Buffs are available. I would like to change 2 things:

1) set a timer to shout or ooc that there will be an AoE buff in 5 mins + the aoe buff cast.

2) how to make the npc self cast a spell on itself every 30 mins or so.

Here is what I have so far, I have not implemented both of the items on my wishlist yet. so far I have it able to shout and take donations for buffs

Quote:

#zone:PoKnowledge
#Clerical

sub EVENT_SAY {
if(($text=~/hail/i)&&($ulevel<= 45)){
$npc->SetAppearance(0);
quest::say("Hello $name, I can buff you with Temperance for a fee of 10pp, and my friend over there has enchanter buffs.");
}
elsif(($text=~/hail/i)&&($ulevel=>46)){
$npc->SetAppearance(0);
quest::say("Hello $name, I can buff you with Virtue for a fee of 50pp, and my friend over there has cleric buffs");
}
}

sub EVENT_SPAWN
{
$x = $npc->GetX();
$y = $npc->GetY();
quest::set_proximity($x - 800, $x + 800, $y - 800, $y + 800);
}

sub EVENT_ENTER
{
$npc->SetAppearance(1);
my $random_result = int(rand(40));
if ($random_result<=20){
quest::shout("Casting Temp and Virtue for donations beside the main bank!");
}else{
#Do Nothing
}
}

sub EVENT_ITEM{
if (($platinum>=50)&&($ulevel=> 46)){
$npc->SetAppearance(0);
$npc->CastSpell(3479,$userid);
quest::say("Casting Virtue, Good hunting!");
}elsif(($platinum>=10)&&($ulevel<= 45)){
$npc->SetAppearance(0);
$npc->CastSpell(3692,$userid);
quest::say("Casting Temperance, Good hunting!");
}else{
quest::say("Thank you for your donation $name, it wasn't enough though ...");
}
}

sub EVENT_SIGNAL {
quest::shout("Casting Temp and Virtue for donations beside the main bank!");
}

Almusious 07-06-2019 06:21 PM

Code:

## Zone: PoKnowledge
## Clerical Buffs

sub EVENT_SPAWN
{
        quest::set_proximity($x - 800, $x + 800, $y - 800, $y + 800);
        quest::settimer("fiveminutes", 300);
        quest::settimer("thirtyminutes", 1800);
}

sub EVENT_TIMER
{
        if ($timer eq "fiveminutes")
        {
                quest::stoptimer("fiveminutes");
                quest::settimer("buffaoe");
                quest::shout("Buffing AOE buffs in five minutes, get near me before that time!");
        }
        elsif ($timer eq "thirtyminutes")
        {
                quest::stoptimer("thirtyminutes");
                quest::settimer("thirtyminutes");
        }
        elsif ($timer eq "buffaoe")
        {
                quest::shout("Casting AOE spell(s) now! If you aren't in range too bad!");
                my @clientlist = $entity_list->GetClientList();
                foreach $singeclient (@clientlist)
                {
                        if ($singleclient)
                        {
                                if ($singleclient->CalculateDistance($x, $y, $z) <= 40)
                                {
                                        $npc->CastSpell(1111, $singeclient->GetID()); ## Change 1111 to whichever spell, copy/paste this line how ever many times
                                }
                        }
                }
                quest::stoptimer("buffaoe");
                quest::settimer("fiveminutes");
        }
}

sub EVENT_ENTER
{
        $npc->SetAppearance(1);
        if (quest::ChooseRandom(0..40) <= 20)
        {
                quest::shout("Casting Temp and Virtue for donations beside the main bank!");
        }
}

sub EVENT_SIGNAL
{
        quest::shout("Casting Temp and Virtue for donations beside the main bank!");
}

sub EVENT_SAY
{
        if ($text=~/Hail/i)
        {
                if ($ulevel <= 45)
                {
                        $npc->SetAppearance(0);
                        quest::say("Hello $name, I can buff you with Temperance for a fee of 10pp, and my friend over there has enchanter buffs.");
                }
                elsif ($ulevel >= 46)
                {
                        $npc->SetAppearance(0);
                        quest::say("Hello $name, I can buff you with Virtue for a fee of 50pp, and my friend over there has cleric buffs");
                }
        }
}

sub EVENT_ITEM
{
        if ($platinum >= 50 && $ulevel >= 46)
        {
                $npc->SetAppearance(0);
                $npc->CastSpell(3479, $userid);
                quest::say("Casting Virtue, Good hunting!");
        }
        elsif ($platinum >= 10 && $ulevel <= 45)
        {
                $npc->SetAppearance(0);
                $npc->CastSpell(3692, $userid);
                quest::say("Casting Temperance, Good hunting!");
        } else {
                quest::say("Thank you for your donation $name, it wasn't enough though ...");
        }
}

It may be what you're after. Only checked it for syntax.

Zoid13erg 07-06-2019 07:55 PM

Quote:

Originally Posted by Almusious (Post 262970)
Code:

## Zone: PoKnowledge
## Clerical Buffs

sub EVENT_SPAWN
{
        quest::set_proximity($x - 800, $x + 800, $y - 800, $y + 800);
        quest::settimer("fiveminutes", 300);
        quest::settimer("thirtyminutes", 1800);
}

sub EVENT_TIMER
{
        if ($timer eq "fiveminutes")
        {
                quest::stoptimer("fiveminutes");
                quest::settimer("buffaoe");
                quest::shout("Buffing AOE buffs in five minutes, get near me before that time!");
        }
        elsif ($timer eq "thirtyminutes")
        {
                quest::stoptimer("thirtyminutes");
                quest::settimer("thirtyminutes");
        }
        elsif ($timer eq "buffaoe")
        {
                quest::shout("Casting AOE spell(s) now! If you aren't in range too bad!");
                my @clientlist = $entity_list->GetClientList();
                foreach $singeclient (@clientlist)
                {
                        if ($singleclient)
                        {
                                if ($singleclient->CalculateDistance($x, $y, $z) <= 40)
                                {
                                        $npc->CastSpell(1111, $singeclient->GetID()); ## Change 1111 to whichever spell, copy/paste this line how ever many times
                                }
                        }
                }
                quest::stoptimer("buffaoe");
                quest::settimer("fiveminutes");
        }
}

sub EVENT_ENTER
{
        $npc->SetAppearance(1);
        if (quest::ChooseRandom(0..40) <= 20)
        {
                quest::shout("Casting Temp and Virtue for donations beside the main bank!");
        }
}

sub EVENT_SIGNAL
{
        quest::shout("Casting Temp and Virtue for donations beside the main bank!");
}

sub EVENT_SAY
{
        if ($text=~/Hail/i)
        {
                if ($ulevel <= 45)
                {
                        $npc->SetAppearance(0);
                        quest::say("Hello $name, I can buff you with Temperance for a fee of 10pp, and my friend over there has enchanter buffs.");
                }
                elsif ($ulevel >= 46)
                {
                        $npc->SetAppearance(0);
                        quest::say("Hello $name, I can buff you with Virtue for a fee of 50pp, and my friend over there has cleric buffs");
                }
        }
}

sub EVENT_ITEM
{
        if ($platinum >= 50 && $ulevel >= 46)
        {
                $npc->SetAppearance(0);
                $npc->CastSpell(3479, $userid);
                quest::say("Casting Virtue, Good hunting!");
        }
        elsif ($platinum >= 10 && $ulevel <= 45)
        {
                $npc->SetAppearance(0);
                $npc->CastSpell(3692, $userid);
                quest::say("Casting Temperance, Good hunting!");
        } else {
                quest::say("Thank you for your donation $name, it wasn't enough though ...");
        }
}

It may be what you're after. Only checked it for syntax.



Thank you so much for the response! I will try it later this evening, do you know what the script is for making a npc cast a spell on themselves? Ive been looking for something like Guard Tynthal or Paspe in South Felwithe who can cast a HP buff spell on themselves. I dont see any pearl scripts for them.

Almusious 07-06-2019 10:30 PM

Code:

$npc->CastSpell (xxxx, $npc->GetID());


All times are GMT -4. The time now is 12:38 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.