EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Custom (https://www.eqemulator.org/forums/forumdisplay.php?f=671)
-   -   auto-train on level for the extra lazy (https://www.eqemulator.org/forums/showthread.php?t=36263)

Azrealvect 02-25-2015 01:34 AM

Any way to make this so that it does not train trade skills?

ghanja 02-25-2015 02:16 AM

Code:

sub EVENT_LEVEL_UP {

    AutoTrain(1); ## if 1 is passed it will train trade skills
    AutoTrain(); ## will not train trade skills (

}

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
    if ($_[0]) {my @skillsarray = [0..74];}
    else {my @skillsarray = [0..54,62,66,67,70..74];}
    foreach my $skill (@skillsarray) {
        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 );

}

untested

Azrealvect 02-25-2015 11:35 AM

Ill give it a try later today thank you

dew1960 06-07-2015 03:45 PM

Quote:

Originally Posted by Kingly_Krab (Post 221302)
Go in to your server folder, quests, templates, find global_player.pl and add these lines to the script and save it, enter the game, and type #reloadworld to repop all zones and reload scripts world-wide.

I know this is an old post and it may not apply to the current build so if that is the case, please let me know.

I just built a private local server to play on and learn how to use MQemulator.

Is there still a global_player.pl file somewhere because I can't find it in my server. I went into the server folder, quests, but there is no template folder there and a search of my pc only finds a reference to global_player.pl in a SQL update and a changelog.txt

Is there a way to still accomplish this on the current windows server build?

Just curious because I like the idea of this!

Kingly_Krab 06-07-2015 04:17 PM

The 'templates' folder was renamed to 'global'.

dew1960 06-07-2015 06:26 PM

Quote:

Originally Posted by Kingly_Krab (Post 240789)
The 'templates' folder was renamed to 'global'.

OK, I can see that. There is no global_player.pl but there is a global_player.lua, is that the same thing?

Kingly_Krab 06-07-2015 06:30 PM

If you're not compiling Lua, the .lua file will not work, also, the code in this thread is Perl, so you'll have to use a global_player.pl file, which may require you deleting the global_player.lua file, as Lua has precedence.

jpyou127 10-25-2015 10:07 PM

How hard would this be to add to LUA?


Celestial

Kingly_Krab 10-26-2015 01:21 PM

Very simple, it's already enabled on the CMake by default. So unless you turn it off, it should be enabled already.

NatedogEZ 10-26-2015 06:55 PM

Quote:

Originally Posted by jpyou127 (Post 244691)
How hard would this be to add to LUA?


Celestial


Try this... (might want to test it.. lol I r bad at lua)


This will train all skills except tradeskills

Code:

function event_level_up(e)
        local skills = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 48, 49, 50, 51, 52, 53, 54, 56, 62, 66, 67, 70, 71, 72, 73, 74 };
        for i, curskill in ipairs(skills) do
                local maxskill = e.self:MaxSkill(curskill);
                if (e.self:CanHaveSkill(curskill) == false) then
                        --Do nothing...
                elseif (maxskill <= e.self:GetRawSkill(curskill)) then
                        --Do nothing...
                else
                        --Train!
                        e.self:SetSkill(curskill, maxskill);
                end
        end
end


jpyou127 10-28-2015 08:47 AM

Thanks Natedog will give this a try!


Celestial

Azrealvect 11-05-2015 12:29 AM

If anyone is interested this will train everything but trade skills and spell specializations.

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 .. 42, 48 .. 54, 70 .. 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 );

}


Shendare 11-05-2015 12:33 PM

Wow. That foreach iteration specification is beautiful.

Several people have been wondering about the cleanest way to iterate through numbers while skipping some, without nested ifs or multiple fors.

That's just gorgeous!

NatedogEZ 11-05-2015 03:55 PM

Quote:

Originally Posted by Shendare (Post 244859)
Wow. That foreach iteration specification is beautiful.

Several people have been wondering about the cleanest way to iterate through numbers while skipping some, without nested ifs or multiple fors.

That's just gorgeous!

Its easy in perl.. I have no clue how to do it in lua though :p

Akkadius 11-05-2015 05:02 PM

I feel like Shendare is kind of like this guy right now.



All times are GMT -4. The time now is 02:19 AM.

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