EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Buffbot with Links and Scaling Costs (https://www.eqemulator.org/forums/showthread.php?t=39467)

Lord of Steel 03-13-2015 02:59 PM

Buffbot with Links and Scaling Costs
 
Here is a script that gives you a clickable link when you hail the cleric buffbot NPC. The cost and the spell casted scale depending on level.
Code:

sub EVENT_SAY {
my $GetPlayerID = $client->GetID();
my $GetMoney = $client->GetCarriedMoney();
        my $Buff = quest::saylink("Buff",0,"Buff");
        if($text=~/hail/i)
        {
                quest::say ("For 1 platinum piece per level I can cast a strong health [$Buff] on you.");       
        }


       
        if($text=~/buff/i)
        {
                if($GetMoney >= $ulevel *1000)
                {
                        $client->TakeMoneyFromPP($ulevel * 1000, true);
                        if ($ulevel<11)
                        {                               
                                $npc->CastSpell(244, $GetPlayerID, 10,0,0,0 );
                        }
                        if ($ulevel >10 && $ulevel<21)
                        {                               
                                $npc->CastSpell(312, $GetPlayerID, 10,0,0,0 );
                        }
                        if ($ulevel >20 && $ulevel<31)
                        {
                                $npc->CastSpell(314, $GetPlayerID, 10,0,0,0 );
                        }
                        if ($ulevel >30 && $ulevel<41)
                        {
                                $npc->CastSpell(3692, $GetPlayerID, 10,0,0,0 );
                        }
                        if ($ulevel >40 && $ulevel<51)
                        {
                                $npc->CastSpell(3692, $GetPlayerID, 10,0,0,0 );
                        }
                        if ($ulevel >50)
                        {
                                $npc->CastSpell(1447, $GetPlayerID, 10,0,0,0 );
                        }
                        $client->Message(2, "Here you go.  Thanks for the donation!");
                        $client->Message(5, "$ulevel platinum has been removed from your inventory.");
                }
        }
}


Kingly_Krab 03-13-2015 03:48 PM

It's much easier to do it without GetCarriedMoney due to Perl not being able to use int64, as well as the fact this will only work if you have enough money to take directly, in one conditional.
Code:

sub EVENT_SAY {
    my $Buff = quest::saylink("Buff");
    if ($text =~ /hail/i) {
        quest::say ("For 1 platinum piece per level I can cast a strong health [$Buff] on you.");   
    } elsif ($text =~ /buff/i) {
        if ($client->TakeMoneyFromPP(($ulevel * 1000), 1)) {
            if ($ulevel <= 10) {               
                quest::selfcast(244);
            } elsif ($ulevel > 10 && $ulevel <= 20) {   
                quest::selfcast(312);
            } elsif ($ulevel > 20 && $ulevel <= 30) {
                quest::selfcast(314);
            } elsif ($ulevel > 30 && $ulevel <= 40) {
                quest::selfcast(3692);
            } elsif ($ulevel > 40 && $ulevel <= 50) {
                quest::selfcast(3692);
            } elsif ($ulevel > 50) {
                quest::selfcast(1447);
            }
            $client->Message(2, "Here you go.  Thanks for the donation!");
            $client->Message(5, "$ulevel platinum has been removed from your inventory.");
        }
    }
}



All times are GMT -4. The time now is 05:12 AM.

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