Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 09-19-2009, 10:42 PM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
Default

Instead of copy pasting the code 15 times, you could do something like this:

Code:
sub EVENT_LEVEL_UP {
	my $maxlvl = 50;
	my @classlist = ("Warrior", "Cleric", "Paladin", "Ranger", "ShadowKnight", "Druid", "Monk", "Bard", "Rogue", "Shaman", "Necromancer", "Wizard", "Magician", "Enchanter", "Beastlord", "Berserker");
	foreach my $curclass (@classlist) {
       if(!defined($qglobals{$curclass."maxlvl"}) && $ulevel == $maxlvl && $curclass eq $class) {
            quest::setglobal($curclass."maxlvl",$name,2,"F");
            quest::shout2("$name has made the server first level $ulevel $class!");
            return;
	   }
	}
}
I think that may work. I'm storing the player's name in the variable instead of just a boolean flag in hopes that who knows, one day $pglobal will be loadable on NPC's.

If that ever occurs, I wrote a reporter NPC too, $qglobals are a little weird scope wise, NPC's don't load no NPC ID vars (aka Player vars). I may ask the coders to add a $pglobal that when you talk to a NPC, it loads non-NPC ID globals for the zone are loaded into $pglobal{}. Would be handy for this situation, and I can think of a few others.

This code doesn't work, but I wrote it anyways if the theory of player global vars non-NPC specific ever get written in.
Code:
sub EVENT_SAY
{
    if ($text=~/Hail/i) { #Initial Hail
        my @classlist = ("Warrior", "Cleric", "Paladin", "Ranger", "ShadowKnight", "Druid", "Monk", "Bard", "Rogue", "Shaman", "Necromancer", "Wizard", "Magician", "Enchanter", "Beastlord", "Berserker");;
        my $buffer = "";
        foreach my $curclass (@classlist) {
            $buffer = $buffer . $pglobals{$curclass."maxlvl"} . " [$curclass], " if (defined($qglobals{$curclass."maxlvl"}));
            if (defined($qglobals{Bardmaxlvl})) { $buffer = $buffer . $pglobals{Bardmaxlvl} . " [$curclass], "; }
        }
        if (length($buffer) > 3) {
            $buffer = substr $buffer, 0, length($buffer)-3;
            quest::say("Server First Classes: " . $buffer);
        }
        quest::say("end");
    }
}
__________________

~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 07:24 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