PDA

View Full Version : auto-train on level for the extra lazy


c0ncrete
01-13-2013, 11:37 AM
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.

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 );

}

sorvani
01-13-2013, 01:09 PM
Why train level and level minus one? Those commands should accept same level as both arguments, is there a bug in them?

c0ncrete
01-13-2013, 01:30 PM
not bug. not sure why i didn't just use $ulevel for both, honestly. i was probably half asleep and thought for sure i had a really good reason at the time. just tried to keep the script from attempting to scribe spells for levels 0 to current every time.

Figback65
01-17-2013, 06:09 PM
When you die and lose a level and then re-ding, it checks and regives all the spells and retrains the skills again. Is there a way to put a level check or something in, so it doesnt re-apply what it already has?

c0ncrete
01-17-2013, 06:20 PM
this line should be checking to verify that the max skill available at the level obtained is higher than the current raw skill before setting the skill to the new value:

next unless $maxSkill > $client->GetRawSkill($skill);i would think that since the current skill is already at the max for the level when you re-ding, it should skip the skill in question. i believe i'd already tested this and it worked, but i can always test it again to verify.

as for the spells and discs, i'm sure it could be changed to not re-train/scribe already known items, but it would require source code modification as the work is actually done server-side and not in the script.

Figback65
01-17-2013, 06:24 PM
The reason I enquired more about is, bc I have added an AA point to the level ding as well. So when they ding, u get spells, skills, and 1 AA. The death and re-ding with the AA is whats getting me. I didnt want it to let people exploit it. Also tryen to make it start at level 10.

Figback65
01-17-2013, 06:38 PM
got the level requirement working, just not the delevel exploit

c0ncrete
01-17-2013, 06:38 PM
fdshjakfhksf...

so the problem isn't as you described it at all. it's with your additions, correct?

thanks for the clarification.

1) use a qglobal to store the highest level the character has obtained and check the value before supplying a new aa point.
2) use a condition to check for the character's level before calling AutoTrain().

Figback65
01-17-2013, 10:11 PM
Thanks for the direction. I am learning as I go :)

xplodr
05-30-2013, 01:29 PM
How do I do this? I mean how do I find the file you're talking about and where would I put this coding? Also I don't want the auto skill ups business, trying to leave it still somewhat legit. Basically I would just want spells and discs.

Kingly_Krab
05-30-2013, 04:22 PM
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.

xplodr
05-30-2013, 06:20 PM
Somehow my GM 250 character is not allowed to use the #reloadworld command lol. Any idea what that's about?

Kingly_Krab
05-30-2013, 06:57 PM
It may require more than 250 status, go in your database to the Commands table and check if anything requires above 250. A simple way to do so below this. If you do, set your status higher and relog.

/*Finds commands that are above 250 status.*/
SELECT * FROM `commands` WHERE `access` > 250;

xplodr
05-30-2013, 11:33 PM
The only command over 250 is setstat and that's set to 255

Akkadius
05-31-2013, 01:08 AM
command_add("reloadworld",NULL,255,command_reloadworld) ||

There was a time where I was a dipshit and originally implemented it with level 0. So new servers who didn't pay attention to this had this command on for regular players and could really hose up a server, that's tons of Mysql queries, quest reading depending on how many zones you have up.

It could have been 250 like the rest but I think I said something about it in coders and if someone was about to commit something to nail it up high so that's what it ended up being.

xplodr
05-31-2013, 04:31 PM
Do you happen to know how to close off expansions? So I can have just vanilla open for awhile then have the others unlocked later?

Kingly_Krab
05-31-2013, 05:21 PM
I replied to your question in your topic.

Mortow
06-13-2013, 07:32 PM
C0ncrete, is there a way to auto train a newly acquired skill to its minimum? I know on live they auto train your skill when you reach the level that it can be trained and the character gets a message telling them they have gained a new skill. Would this require a script for each individual skill? It is really nice not having to run back to your trainer to train a new skill only to have to run back to where you were hunting.

ward3
06-22-2013, 01:16 PM
Hmm, I can't seem to find global_player.pl. I see lots of player.pl files though.

Anyone know where I can find global_player.pl? Or maybe I am supposed to create one?

Thanks for your time.

Kingly_Krab
06-22-2013, 01:36 PM
Ward, you can find it in quests/templates then you'll see 'global_player.pl'.

ward3
07-07-2013, 08:40 PM
Hmm, has quests/templates been replaced by quests/globals? I reinstalled from scratch the other day, and now I can't find the templates directory under quests. I see a globals directory now under quests though. And it does have a global_player.pl listed.

The problem I am having is that I can't get the EVENT_LEVEL_UP to fire when I put it in the global_player.pl script. If I put the EVENT_LEVEL_UP inside player.pl for ecommons it works fine though.

Anyone have any ideas as to what I am doing wrong?

Thanks for your time.

Kingly_Krab
07-07-2013, 09:41 PM
Yes, templates is now global. You may need to update your source to work with the new Perl changes.

ward3
07-07-2013, 10:03 PM
Ahh, I see that in the change log now. Thanks for the information. I will get to updating. :)

ward3
07-07-2013, 10:55 PM
Rockin. After updating, everything seems to be working. :)

Thanks for all of the help.

ward3
07-07-2013, 11:36 PM
Probably not the place to ask this, but it is along the lines of auto adding spells on level. Sometimes when I level, I get multiple entries for the same spell.

I can't seem to delete any spells from my spell book. If I remember right, you would right click on the spell and then press the delete button. That doesn't seem to be working for me any longer.

Is there another way to delete spells? :)

Thanks for your time.

Ciraith
08-13-2014, 12:12 AM
Here is what I am using to train 1 point into each skill. It unlocks the skill at the level you would normally train it by checking max skill > 0 and current skill < 1. It also gives you one point in all the generic skills even if you cant use them.


sub EVENT_LEVEL_UP
{
foreach my $skill ( 0 .. 73 ) {
next unless $client->MaxSkill( $skill, $client->GetClass(), $ulevel ) > 0 & $client->GetRawSkill($skill) < 1;
$client->SetSkill( $skill, 1 );
}
}

Bandor
12-28-2014, 12:28 PM
Is there any way of altering this to stop at a certain level?

c0ncrete
12-28-2014, 12:35 PM
yes. check against $ulevel in a conditional.

Andrew425
01-11-2015, 08:44 PM
I cant seem to get the auto train code to work for my server. I am using the AXClassic-PEQ Repack and have placed the code in the player.pl file and it is not working. Originally I saw the text "Your experiences across..." but nothing would happen. I am not scribing spells or maxing skills. The only skill that increases is swimming for some reason. Any help would be appreciated.

jsr
02-18-2015, 07:56 AM
It will help if you post your player.pl script and where the file is located. Otherwise are you getting any errors when you load scripts? (Subscribe to errors and #reloadpl)

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
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
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
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
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


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.

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
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.

OQSNhk5ICTI

atrayas
11-28-2015, 08:28 PM
Im having trouble getting this to work. We had it working fine before but we just recently migrated our server from a windows 7 baed machine to a Linux machine running debian8. Below is a copy of the perl script we are using, that worked fine before we migrated.

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 ) {
next unless $client->CanHaveSkill($skill);
my $maxSkill = $client->MaxSkill( $skill, $client->GetClass(), $ulevel );
next unless $maxSkill > $client->GetRawSkill($skill);
$client->SetSkill( $skill, $maxSkill );
}
foreach my $skill ( 48 .. 55 ) {
next unless $client->CanHaveSkill($skill);
my $maxSkill = $client->MaxSkill( $skill, $client->GetClass(), $ulevel );
next unless $maxSkill > $client->GetRawSkill($skill);
$client->SetSkill( $skill, $maxSkill );
}
foreach my $skill ( 66 .. 73 ) {
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 );

}

tearinall
11-28-2015, 09:25 PM
Haven't tested it for functionality, don't see anything immediately wrong besides unneeded lines:


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..55,66..73) {
if ($client->CanHaveSkill($skill)) {
my $maxSkill = $client->MaxSkill($skill);
if ($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 );
}


Bah, copied from the wrong tab.

atrayas
11-28-2015, 11:55 PM
The only thing I can figure is something minuscule was altered during the transfer from windows to linux but I cant quite figure out what it could be. Like we had a few issues with perl scripts with the names in lowercase and Linux being case sensitive.

Azrealvect
01-01-2016, 12:15 AM
Also note that if you go from skills 66-73 you will get a few trade skills in there. Think its JC and and Pottery if I remember right. Just a thought though as I see you skipped the others.

Jahosphat
12-18-2016, 11:41 AM
Try this... (might want to test it.. lol I r bad at lua)


This will train all skills except tradeskills


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



Do i just add this and replace the other level event in global.lua? Also can you add Spells / Disc to this code?

jpyou127
05-01-2017, 07:24 AM
Would anyone that is versed in LUA be able to create the above with spell scribe and discs?

Ex from above.

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 );

}

Ninlin
06-12-2017, 05:33 PM
Would anyone that is versed in LUA be able to create the above with spell scribe and discs?

Ex from above.

I think this is what you requested? You can toy with it a bit the change the level granted etc. We dropped a couple extra NPC into PoK and put these in lua quest files for them. You could add them to MisterLockout or the like. Also, my original code (not here) has some additions for things like clearing out a spellbook or discs before scribing all the new ones or for restricting lists of spells. Happy to provide that if you like, but figured I'd give minimal working example. (I also just allow the NPC to scribe/train everything up to current level, so I omit the second argument in the scribspells function for our server.)


-- #Spell_Scribe
-- Used to allow players to scribe all spells at an NPC.

function event_say(e)

if(e.message:findi("hail")) then
-- Intro message
e.other:Message(257, "Hail, adventurer! I can teach you all your spells! Would you like me to [" ..eq.say_link('write them', false, 'write them') .."] down for you in that book?")

elseif(e.message:findi("write them")) then

-- scribe all spells for current level
e.other:scribe_spells(e.other:GetLevel(), e.other:GetLevel()-1);

end

end



-- #Discipline_Trainer
-- Used to allow players to train disciplines at an NPC.

function event_say(e)

if(e.message:findi("hail")) then
-- Intro message
e.other:Message(257, "Would you prefer that I ["..eq.say_link('teach', false, 'teach') .. "] you how to perform the skills that require more discipline than the basics?")

elseif(e.message:findi("teach")) then

-- scribe all disciplines for level
eq.train_discs(e.other:GetLevel(), e.other:GetLevel()-1);

end


end

Baelu
06-19-2017, 10:37 AM
Sorry to necro the thread, but if I wanted this to stop at say level 70, would it look like this?

sub AutoTrain {

if ($ulevel <= 70) {
$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 );

}
}
}

Baelu
06-19-2017, 11:30 AM
Tested and works perfect

ghanja
06-19-2017, 04:18 PM
You have an extra curly in the code above.


sub AutoTrain {
if ($ulevel <= 70) {
$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 );
}
}


For it to apply to only level 2-70.

May as well just put it in the sub EVENT_LEVEL_UP like so:


sub EVENT_LEVEL_UP {
if ($ulevel <= 70) {
$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 );
}
}


Unless you intend to make it it's own subroutine of course.

ghanja
06-19-2017, 04:20 PM
Also, since this thread had a lot of conversation. The iteration you have does all skills 0 through 74. That will include trade skills and such. Use this as a reference as to which skills you actually want to have affected or at least confirm:

http://wiki.eqemulator.org/p?Skills

Baelu
06-19-2017, 04:30 PM
Awesome was just thinking about that haha. Thanks man

Shin Noir
07-18-2017, 02:30 AM
When I tackled this, I ended up editing source and just went into
Client::SetLevel around the point it calls DoTributeUpdate(), I declared a new function called Client::UpdateSkillsAndSpells().

The scripted way is probably easier, but with this route, you get nearly full control of what a player autotrains. This may be useful in cases where you don't want *all* spells memorized automatically, yet certain spells can be obtained via quests/other means while other baseline ones are obtained.

Then I just tossed this into the UpdateSkillsAndSpells() call.
https://gist.github.com/xackery/a7ba2803a416eda5885eda7e37596ae1

Note this does not max skills, but really just sharing it for those who stumble upon this post to see another way. *shrugs*

This gives me granular control over what skills and spells a player earns on levelup.
You'll see a javascript selector snippet in the source, like so:

for ($i = 0; $i < document.querySelectorAll('a').length; $i++) { $ref = document.querySelectorAll('a')[$i].href; if ($ref.includes("zstrat")) { console.log($ref); } }


I leveraged this to hit up http://everquest.allakhazam.com/db/spelllist.html?name=&type=brd&level=1&opt=And+Higher&expansion=&action=search
Change your class, in chrome, right click the page and go to Inspect, then the Console tab, then click the circle with a line through to clear console, and paste in the above selector. Then right right click the listed output, hit Save As...and it'll create a logfile dump with the info.

Open it in a multiline edit tool like Sublime or TextWrangler and manipulate it into a conditional list, and remove any spells you don't want.

hayward6
08-26-2017, 03:09 PM
So this is working perfectly for giving skills to players, what's the best way to provide spell scribing in here? I want it to just happen at skill-up. I chopped up what was posted earlier in an npc and I couldn't get it working. I understand lua is probably great, but I had a hard enough time with perl :)


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

macdaddy02
10-10-2020, 09:31 AM
I'm not sure if this is old or I should post here anymore, however I got a .lua code that works and thought I'd share it with everyone.


function event_level_up(e)
e.self:Message(15, "You have gained the knowledge of learning new skills, spells and discs!!");
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
-- Scribe all spells up to current level
eq.scribe_spells(e.self:GetLevel());
-- Train all disciplines up to current level
eq.train_discs(e.self:GetLevel());
--Train all skills for current level
e.self:SetSkill(curskill, maxskill);
end
end
end

Rakkoraz05
11-23-2020, 09:31 PM
I'm not sure if this is old or I should post here anymore, however I got a .lua code that works and thought I'd share it with everyone.


function event_level_up(e)
e.self:Message(15, "You have gained the knowledge of learning new skills, spells and discs!!");
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
-- Scribe all spells up to current level
eq.scribe_spells(e.self:GetLevel());
-- Train all disciplines up to current level
eq.train_discs(e.self:GetLevel());
--Train all skills for current level
e.self:SetSkill(curskill, maxskill);
end
end
end


To use this would you just replace the current Event_Level_Up that's in the global_player.lua or just add it below?

jsr
11-23-2020, 10:42 PM
You could add it to the existing function.

It would probably be better to put it in a separate function like grantsSkills(), and then call it.

That code can be simplified a bit, the negative checks are not needed (if false then do nothing + if false then do nothing + if true then do something == if true then do something).

Rakkoraz05
11-23-2020, 11:35 PM
If there are two function calls for the same event, would that cause issue?

Edit: I did add this into the lua file. Seems to work just fine id the skill isn't 1 or greater.

jsr
11-24-2020, 07:40 PM
I'm not quite sure how it will handle the same function twice, but it's not a good idea. Most languages won't allow it. If it does allow it, then its a bad idea from a maintenance perspective.