View Single Post
  #1  
Old 01-13-2013, 11:37 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default auto-train on level for the extra lazy

lots of people seem to enjoy skill trainer and spell scriber/disc trainer npcs. since you're going to be increasing skills for free, why not just pop it in global_player.pl and trigger it when the player levels? no need to add a new spawn.

this script will increase skills to the maximum level allowed by the player's race/class/level (and only those that he/she can learn). it also automatically scribes spells and trains discs.

Code:
sub EVENT_LEVEL_UP {

    AutoTrain();

}

sub AutoTrain {

    $client->Message( 15, "Your experiences across the realm have infused you with increased power and knowledge..." );

    # set all available skills to maximum for race/class at current level
    foreach my $skill ( 0 .. 74 ) {
        next unless $client->CanHaveSkill($skill);
        my $maxSkill = $client->MaxSkill( $skill, $client->GetClass(), $ulevel );
        next unless $maxSkill > $client->GetRawSkill($skill);
        $client->SetSkill( $skill, $maxSkill );
    }

    # scribe all spells for current level
    quest::scribespells( $ulevel, $ulevel - 1 );

    # train all discs for current level
    quest::traindiscs( $ulevel, $ulevel - 1 );

}
Reply With Quote