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

Quests::Custom Custom Quests here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 10-23-2009, 07:15 AM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
Default

fine fine.
Here's a more complete version. Needs quite a few tweaking here or there, but it is working on my test box. Got to clean up some random junk, trying to make it easy to plug into other situations.. Not sure I'll mess around with this more later or not. But, Enjoy~

Yeah, I need to use some qglobals and not rely on local vars so much since they can be pretty icky, but for all intent and purposes this seems to work decently well!

Code:
#Written by Shin Noir, with intent of being used on /crystal/Derron_Coldmist.pl
sub EVENT_SAY {
    $towerid = 121026; #Guard Evercold
    #tower location spawn points.
    $dname = "defender";
    $aname = "orc";
    @towerx = ( 200.4,  221.8,  198.8,  210.1,  220.7,  192.9,  215.2,  203.1,  191.3,  214.3);
    @towery = (-226.7, -227.5, -246.5, -245.2, -246.5, -259.9, -263.6, -299.6, -279.4  -275.6);
    @towerz = (-382.7, -382.7, -382.7, -380.2, -382.7, -382.7, -382.7, -382.7, -382.7, -382.7);
    @towerh = (  27.3,      0,   19.6,    8.8,  254.8,   18.6,    1.9,    7.0,   15.1,      0);
    @creeploc = (229.3, -73.7, -376.7, 131.8); #This could be split up like tower is.
    if (!defined $bounty) { $bounty = 0; }
    if (!defined $killcount) { $killcount = 0; }
    $wavedelay = 5; #seconds between each wave.
    $towercost = 3; #How many creeps does it cost to buy a tower?
    if ($text=~/hail/i) {
        if (!defined $wave) {
            quest::say("Are you [ready] to begin?");
        } else {
            quest::say("It has already begun.");
        }
    }
    if ($text=~/ready/i) {
        if (!defined $wave) {
            $bounty = 0; #Reset Bounty
            $wave = 1; #Reset Wave
            $killcount = 0;
            @tower = {0,0,0,0,0,0,0,0,0,0 }; #reset defenders.
            quest::say("I hear them incoming...");
            quest::settimer(1, $wavedelay); #Set timer for initial wave, delay 5 secs.
        } else {
            quest::say("It has already begun.");
        }
    }
    if ($text=~/bounty/i) {
        if (!defined $wave) {
            quest::say("You haven't started yet.");
        } else {
            quest::say("Your current bounty is $bounty, with $killcount total kills.")
        }
    }
    if ($text=~/left/i) {
        quest::say("I would guess there's about ".scalar @creeps." left..");
    }
    if ($text=~/$dname/i) {
    #Figure out who goes next!
    #this is a routine where I essentially have an array, @tower, that stors each tower mob.
    #It goes through each tower, seeing if they're still alive, and if not, replaces their
    #spot with fresh tower.
        if ($bounty > $towercost) {
            for ($i = 1; $i < 11; $i++) {
                if (!defined($tower[$i]) || !defined( $entity_list->GetMobID($tower[$i]))) {
                    $tower[$i] = quest::spawn2($towerid, 0, 0, $towerx[$i-1], $towery[$i-1], $towerz[$i-1], $towerh[$i-1]);
                    quest::say("Tower #$i reporting!"); #$tower[$i]
                    $entity_list->GetMobID($tower[$i])->Stun(2.0); #Stun new tower for 2 seconds.
                    $bounty = $bounty - $towercost;
                    return;
                }
            }
            quest::say("No spots available.");
            return;
        } else {
            quest::say("You need at least $towercost bounty points to buy a $dname, you only have $bounty.");
        }
    }
}

sub EVENT_TIMER {
    #116024: Scout, 116007: Centurion, 116172: Legionarre, 116011: Elite
    @creepid = (116024, 116024, 116007, 116007, 116172, 116172, 116011, 116011);
    @creepamt = (1, 3, 2, 4, 1, 3, 1, 3);
    if ($timer eq "1") { #Initial Message.
        if (!defined $wavedelay) { #sanity check
            quest::stoptimer(1);
            quest::say("Event ended prematurely (GM Intervention?)");
            return;
        }
        quest::say("They're here! (Wave $wave)");
        quest::settimer(2, 2); #2 second delay until upkeep check
        quest::stoptimer(1); #kill this timer.
        
        if (!defined(@creeploc)) { my @creeploc = (200.4, -226.7, -382.7, 27.3); } #This could be split up like tower is.
        undef(@creeps);
        if (!defined $creepamt[$wave-1]) { #end of creeps!
            quest::say("You have won! You ended up with $bounty bounty and $killcount total kills!");
            $bounty = 0; #Reset Bounty
            undef($wave); #Reset Wave
            $bounty = 0;
            $killcount = 0;
            quest::stoptimer(1);
        }
        for ($i =0; $i < $creepamt[$wave-1]; $i++) {
            #quest::say("$creepid");
            $creeps[$i] = quest::spawn2($creepid[$wave-1], 0, 0, $creeploc[0], $creeploc[1], $creeploc[2], $creeploc[3]); #Keep their entity ID.
            $entity_list->GetMobID($creeps[$i])->Stun(int(rand(5)));
            $entity_list->GetMobID($creeps[$i])->AddToHateList($npc, 1,0); #make them hate Derron.
        }
        quest::say("Looks to be about ".$creepamt[$wave-1]." ".$entity_list->GetMobID($creeps[0])->GetCleanName. (($creepamt[$wave-1]>1) ? "s" : ""));
    }
    if ($timer eq "2") { #Upkeep
        if (!defined $wavedelay) { #sanity check
            quest::stoptimer(2);
            quest::say("Event ended prematurely (GM Intervention?)");
            return;
        }
        #quest::say(scalar @creeps);
        my $oldbounty = 0;
        for ($i = 0; $i < scalar @creeps; $i++) {  #Creep check!
            if (defined $creeps[$i]) { #I find this a silly check but scalar size is wierd.
                if (!defined $entity_list->GetMobID($creeps[$i])) {
                    delete $creeps[$i]; #Clean up dead mobs.
                    $bounty++;
                    $oldbounty++;
                    $killcount++;
                }
            }
        }
        if ($oldbounty) {
            #quest::say("You killed an $aname, putting your total to $bounty!");
        }
        #quest::say(scalar @creeps);
        if (scalar @creeps < 1) { #no more creeps
            quest::stoptimer(2); #kill this timer
            $wave = $wave+1; #Next wave!
            quest::settimer(1, $wavedelay); #delay until next wave
            quest::say("You have finished off the wave! You have $bounty unspent bounty points. $wavedelay seconds until the next attack...");
        }
    }
}

sub EVENT_SIGNAL {
    #quest::ze(15, "Orc Dead Rec'd.");
    if (!defined($orcslays)) {
        $orcslays = 0;
    }
    $orcslays++;
    $orcmoney++;
    quest::say("$orcslays orcs have been killed!");
}
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
 


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 03:07 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3