Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #46  
Old 11-28-2015, 08:28 PM
atrayas
Hill Giant
 
Join Date: Jun 2010
Posts: 105
Default

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.

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

}
Reply With Quote
  #47  
Old 11-28-2015, 09:25 PM
tearinall
Fire Beetle
 
Join Date: Oct 2012
Posts: 9
Default

Haven't tested it for functionality, don't see anything immediately wrong besides unneeded lines:

Code:
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.
Reply With Quote
  #48  
Old 11-28-2015, 11:55 PM
atrayas
Hill Giant
 
Join Date: Jun 2010
Posts: 105
Default

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.
Reply With Quote
  #49  
Old 01-01-2016, 12:15 AM
Azrealvect
Sarnak
 
Join Date: May 2011
Posts: 53
Default

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.
Reply With Quote
  #50  
Old 12-18-2016, 11:41 AM
Jahosphat
Sarnak
 
Join Date: Apr 2009
Location: LA
Posts: 97
Default

Quote:
Originally Posted by NatedogEZ View Post
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

Do i just add this and replace the other level event in global.lua? Also can you add Spells / Disc to this code?
Reply With Quote
  #51  
Old 05-01-2017, 07:24 AM
jpyou127's Avatar
jpyou127
Discordant
 
Join Date: Nov 2005
Posts: 270
Default

Would anyone that is versed in LUA be able to create the above with spell scribe and discs?

Ex from above.

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

}
Reply With Quote
  #52  
Old 06-12-2017, 05:33 PM
Ninlin
Fire Beetle
 
Join Date: May 2017
Posts: 1
Default

Quote:
Originally Posted by jpyou127 View Post
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.)

Code:
-- #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
Code:
-- #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
Reply With Quote
  #53  
Old 06-19-2017, 10:37 AM
Baelu
Sarnak
 
Join Date: Jun 2017
Posts: 30
Default

Sorry to necro the thread, but if I wanted this to stop at say level 70, would it look like this?

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

}
}
}
Reply With Quote
  #54  
Old 06-19-2017, 11:30 AM
Baelu
Sarnak
 
Join Date: Jun 2017
Posts: 30
Default

Tested and works perfect
Reply With Quote
  #55  
Old 06-19-2017, 04:18 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

You have an extra curly in the code above.

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

Code:
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.
Reply With Quote
  #56  
Old 06-19-2017, 04:20 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

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
Reply With Quote
  #57  
Old 06-19-2017, 04:30 PM
Baelu
Sarnak
 
Join Date: Jun 2017
Posts: 30
Default

Awesome was just thinking about that haha. Thanks man
Reply With Quote
  #58  
Old 07-18-2017, 02:30 AM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
Default

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/a7ba...5eda7e37596ae1

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:
Code:
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/s...&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.
__________________

~Shin Noir
DungeonEQ.com

Last edited by Shin Noir; 07-18-2017 at 02:40 AM..
Reply With Quote
  #59  
Old 08-26-2017, 03:09 PM
hayward6
Forum Guide
 
Join Date: Jul 2005
Posts: 468
Default

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


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
__________________
Sayin Silverwolf
Server Op of The Sandbox (Non-Legit)
Reply With Quote
  #60  
Old 10-10-2020, 09:31 AM
macdaddy02
Fire Beetle
 
Join Date: Oct 2020
Posts: 13
Default

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.

Code:
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
Reply With Quote
Reply


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 08:56 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3