View Single Post
  #5  
Old 09-19-2009, 10:57 PM
nightsta69
Hill Giant
 
Join Date: May 2005
Posts: 134
Default

Quote:
Originally Posted by Shin Noir View Post
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.
I put this in to quests/template/player.pl. restarted server, and still nothing, makes me feel like i'm not putting this in the correct spot, or that #level 50 isn't triggering the sub EVENT_LEVEL_UP. idk which, any enlightenment would be appreciated.
Reply With Quote