Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 04-10-2019, 07:13 AM
Kattamaran.CH
Fire Beetle
 
Join Date: Mar 2013
Location: Switzerland
Posts: 15
Default Modifying the Steadfast servant

Ok i need a simple buffer / healer and thought i might be a nice idea to modify the steadfast serverant.

- i am able to change the reuse time of the AA - check
- i am able to change the duration until he fades - check
- now id like to have the level check and diffrent spells per level range removed and at the very top id like to enter the IDs of the buffs he needs to cast, the HoT and HP% on wich he casts it are ok, another thing id like to add is a direct heal spell and also at what HP% he should heal it.


any lua specialist able to change those features in the code?:

Code:
#
# Steadfast Servant Veteran AA

$HPThreshold = 50;      # HP Threshold at which HoT will be cast.
$Frequency = 35;        # Frequency in seconds with which the EVENT_TIMER is executed.
$Range = 100;           # How close a player must be for a chance to be buffed.

@ManaRegenSpells = (697, 174, 1693, 6898);      # Breeze, Clarity, Clarity II, Servant's Breath
@HasteSpells = (10, 170, 171, 172);             # Augmentation, Alacrity, Celerity, Swift like the wind
@HoTSpells = (2502, 2175, 1283, 1522);          # Celestial Remedy,  Health, Cleansing, Elixir
@ACSpells = (18, 19, 20, 3470);                 # Guard, Armor of Faith, Shield of Words, Ward of Gallantry

sub EVENT_SPAWN {
        quest::settimer("RandomAction", $Frequency);
}

sub EVENT_TIMER {

        # First we find our owner and see if is in range and in need of any buffs.
        #
        $OwnerID = $npc->GetFollowID();

        if($OwnerID <= 0)
        {
                return;
        }
        $Owner = $entity_list->GetClientByID($OwnerID);

        if($Owner)
        {
                $x = $Owner->GetX();
                $y = $Owner->GetY();
                $z = $Owner->GetZ();

                $Distance = $npc->CalculateDistance($x, $y, $z);

                if($Distance < $Range) {
                        if(BuffPlayer($Owner))
                        {
                                # We cast a buff on our owner, so we are done for this cycle.
                                return;
                        }
                }
        }

        # Our owner didn't need any buffs, so look for someone else within range.
        #
        $c = $entity_list->GetRandomClient($x, $y, $z, $Range, $Owner);

        if(!$c)
        {
                return;
        }

        BuffPlayer($c);
}

sub BuffPlayer
{
        $c = $_[0];

        if($c)
        {
                $ClientID = $c->GetID();

                $HPRatio = ($c->GetHP() / $c->GetMaxHP()) * 100;

                $Level = $c->GetLevel();

                if($Level < 15)
                {
                        $SpellSet = 0;
                }
                elsif($Level < 30)
                {
                        $SpellSet = 1;
                }
                elsif($Level < 50)
                {
                        $SpellSet = 2;
                }
                else
                {
                        $SpellSet = 3;
                }

                $ManaRegenSpell = $ManaRegenSpells[$SpellSet];
                $HasteSpell = $HasteSpells[$SpellSet];
                $HoTSpell = $HoTSpells[$SpellSet];
                $ACSpell = $ACSpells[$SpellSet];

                if($HPRatio <= $HPThreshold)
                {
                        # Check if the player already has our HoT spell on.
                        #
                        $Slot = $c->FindBuff($HoTSpell);
                        if(!$Slot)
                        {
                                if($c->CanBuffStack($HoTSpell, $npc->GetLevel(), True) >= 0)
                                {
                                        $npc->FaceTarget($c);
                                        $npc->CastSpell($HoTSpell, $ClientID);
                                        return 1;
                                }
                        }
                }

                # Next the mana regen buff. Only cast this if the player uses mana.
                #
                if($c->GetMaxMana() > 0)
                {
                        $Slot = $c->FindBuff($ManaRegenSpell);
                        if(!$Slot)
                        {
                                if($c->CanBuffStack($ManaRegenSpell, $npc->GetLevel(), True) >= 0)
                                {
                                        $npc->FaceTarget($c);
                                        $npc->CastSpell($ManaRegenSpell, $ClientID);
                                        return 1;
                                }
                        }
                }

                # Finally, see if they need our Haste or AC buff.
                #
                @Buffs = ($HasteSpell, $ACSpell);

                foreach $Spell (@Buffs)
                {
                        $Slot = $c->FindBuff($Spell);
                        if(!$Slot)
                        {
                                if($c->CanBuffStack($Spell, $npc->GetLevel(), True) >= 0)
                                {
                                        $npc->FaceTarget($c);
                                        $npc->CastSpell($Spell, $ClientID);
                                        return 1;
                                }
                        }
                }
        }

        return 0;
}
Reply With Quote
  #2  
Old 04-10-2019, 07:59 AM
Kattamaran.CH
Fire Beetle
 
Join Date: Mar 2013
Location: Switzerland
Posts: 15
Default

Im playing around with the script. Is there a command to instant cast for a npc and overrule whatever the spell has defined as casting time?
Something diffrent to CastSpell?

When i use my buff npc with the perlscript he can instantly buff all spells.
Reply With Quote
  #3  
Old 12-03-2023, 03:25 AM
Drathil
Fire Beetle
 
Join Date: Feb 2016
Posts: 2
Default

Could you please tell me where I can find the Steadfast Servant script? Would like to edit it as well, but I cannot find it in the scripts.
Reply With Quote
  #4  
Old 12-03-2023, 04:55 PM
Ishtass
Fire Beetle
 
Join Date: Mar 2021
Posts: 1
Default

Quote:
Originally Posted by Drathil View Post
Could you please tell me where I can find the Steadfast Servant script? Would like to edit it as well, but I cannot find it in the scripts.
quests\global\a_steadfast_servant.lua
Reply With Quote
Reply

Thread Tools
Display Modes

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:36 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