|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Q&A This is the quest support section |
|
|
|
02-10-2013, 08:00 PM
|
Hill Giant
|
|
Join Date: Sep 2006
Posts: 112
|
|
Possibly a few questions.
I am in the middle of working on a quest, but the only thing that I cannot seem to get working are the skills section. Everything else is working just fine. (I tested each piece as I was writing it to insure it's working state.)
Here is what I have so far:
Code:
##########
#Skills Trainer And Quest
#By Kingmen30264
##########
sub EVENT_SAY
{
my $skills = quest::saylink("skills");
my $advanced = quest::saylink("advanced skills");
my $trade = quest::saylink("trade");
my $free = quest::saylink("FREE");
my $items = quest::saylink("items");
my $zone1 = quest::saylink("zone1");
my $zone2 = quest::saylink("zone2");
my $item1 = quest::varlink("9989");
my $item2 = quest::varlink("9999");
my $count1 = quest::saylink("2");
my $count2 = quest::saylink("2");
if($text=~/Hail/i)
{
plugin::Whisper("Hi $name. My name is Skills.
I can train you in your $skills if you would like. Otherwise I might be able to teach some more $advanced.");
}
if($text=~/advanced skills/i)
{
plugin::Whisper("Yes, I can train you even more. I can train you so much, in fact, that when I am done, I doubt you could go further! However, I cannot merely offer my services for $free now can I?");
plugin::Whisper("No, no. But, I am in a good mood today, and I am willing to $trade you your higher skills in exchange for something.");
}
if($text=~/free/i)
{
plugin::Whisper("The only thing you will get from me for free is a swift kick up the --");
quest::emote("Skills turns his head in disgust.");
}
if($text=~/trade/i)
{
plugin::Whisper("Yes, you must do something for me for your $advanced.");
plugin::Whisper("If you wouldn't mind getting your armor a little scratched, I am going to require a few $items from some different locations.");
}
if($text=~/items/i)
{
plugin::Whisper("Ah, glad to hear that you are willing to begin your training. In that case, I am going to need the following:");
$client->Message(315, "===$zone1===");
plugin::Whisper("$item1 X $count1");
$client->Message(315, "===$zone2===");
plugin::Whisper("$item2 X $count2");
}
}
sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 9989 => 1))
{
plugin::Whisper("As promised, here are your advanced skills. Use them wisely.");
quest::setallskill(250);
}
plugin::return_items(\%itemcount);
}
As I said, above, the only thing that is not working is the skills command.
Does the command no longer work, or am I simply using it in the wrong manner?
I followed the usage from here.
Also, I was wondering about something else. On the plugin::check_handin*** I have it set right now as:
Code:
if(plugin::check_handin(\%itemcount, 9989 => 1))
If I wanted to add more items for the NPC to take, could I just modify it as follows?
Code:
if(plugin::check_handin(\%itemcount, 9989 => 1, 9990 => 1))
Or would I have to add another line to make it work? And what is the max amount of items that I can have the NPC take?
Thanks,
Kingmen
|
|
|
|
|
|
|
02-10-2013, 09:58 PM
|
|
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
have you tried a number other than 250 to see if that works?
i've never used quest::setallskill() as i'm not a fan of setting all skills to the same number, especially if the character isn't supposed to be able to use a certain skill or have it go over a certain level due to race or class limitations.
you can use something like this to limit skills by race, class, and level:
Code:
foreach my $skill ( 0 .. 74 ) {
next unless $client->CanHaveSkill($skill);
my $max = $client->MaxSkill( $skill, $client->GetClass(), $ulevel );
next unless $max > $client->GetRawSkill($skill);
$client->SetSkill( $skill, $max );
}
you can change $ulevel to the maximum level attainable on your server and it will just limit skills by the character's race and class.
yes, that's the correct way to use check_handin()
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Last edited by c0ncrete; 02-10-2013 at 09:59 PM..
Reason: typo
|
|
|
|
02-11-2013, 01:59 AM
|
Hill Giant
|
|
Join Date: Sep 2006
Posts: 112
|
|
Thanks.
I am in the middle of working on repopulating a zone (corathus) with some custom mobs/content, but one of the things that I am having issues with is when I create the NPC, and I try to set the race to one of the ones that was currently being used, the mobs stay a human. However, I can use #race # to make them look like the race that I want, and I am not sure how to set up a perl file to allow me to make them cast it on themselves when spawned.
Thanks,
Kingmen
|
|
|
|
02-12-2013, 10:13 PM
|
Hill Giant
|
|
Join Date: Sep 2006
Posts: 112
|
|
Quote:
Originally Posted by c0ncrete
have you tried a number other than 250 to see if that works?
i've never used quest::setallskill() as i'm not a fan of setting all skills to the same number, especially if the character isn't supposed to be able to use a certain skill or have it go over a certain level due to race or class limitations.
you can use something like this to limit skills by race, class, and level:
Code:
foreach my $skill ( 0 .. 74 ) {
next unless $client->CanHaveSkill($skill);
my $max = $client->MaxSkill( $skill, $client->GetClass(), $ulevel );
next unless $max > $client->GetRawSkill($skill);
$client->SetSkill( $skill, $max );
}
you can change $ulevel to the maximum level attainable on your server and it will just limit skills by the character's race and class.
yes, that's the correct way to use check_handin()
|
I tried to get this to work, but I just can't do it. I am not sure if this is meant to be put in the player.pl file, or if it was meant for the trainer.
What I am really wanting to do is make it a quest in the end. For the lower levels, you can just hail him, and he will set your skills to around 50 or so to start off with. Later, if you want, then you can do a quest and make them max level.
I don't really care if the person is using skills not normally aquired by that class, but I am just wanting it to where thier skills can be maxed outside of skilling it up, like Meditate, or Specializations or something of that caliber.
Here is my quest file so far. The only thing missing from it is where I would appoint skills.
Code:
##########
#Skills Trainer And Quest
#By Kingmen30264
##########
sub EVENT_SAY
{
my $train = quest::saylink("train");
my $advanced = quest::saylink("advanced skills");
my $trade = quest::saylink("trade");
my $free = quest::saylink("FREE");
my $items = quest::saylink("items");
my $zone1 = quest::saylink("zone1");
my $zone2 = quest::saylink("zone2");
my $item1 = quest::varlink("9989");
my $item2 = quest::varlink("9999");
my $count1 = quest::saylink("2");
my $count2 = quest::saylink("2");
my $skill = (0 .. 74);
if($text=~/Hail/i)
{
plugin::Whisper("Hi $name. My name is Skills.
I can $train you in your skills if you would like. Otherwise I might be able to teach some more $advanced.");
}
if($text=~/train/i)
{
#Insert Skill Command Here <--
}
if($text=~/advanced skills/i)
{
plugin::Whisper("Yes, I can train you even more. I can train you so much, in fact, that when I am done, I doubt you could go further! However, I cannot merely offer my services for $free now can I?");
plugin::Whisper("No, no. But, I am in a good mood today, and I am willing to $trade you your higher skills in exchange for something.");
}
if($text=~/free/i)
{
plugin::Whisper("The only thing you will get from me for free is a swift kick up the --");
quest::emote("Skills turns his head in disgust.");
}
if($text=~/trade/i)
{
plugin::Whisper("Yes, you must do something for me for your $advanced.");
plugin::Whisper("If you wouldn't mind getting your armor a little scratched, I am going to require a few $items from some different locations.");
}
if($text=~/items/i)
{
plugin::Whisper("Ah, glad to hear that you are willing to begin your training. In that case, I am going to need the following:");
$client->Message(315, "===$zone1===");
plugin::Whisper("$item1 X $count1");
$client->Message(315, "===$zone2===");
plugin::Whisper("$item2 X $count2");
}
}
sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 9989 => 1))
{
plugin::Whisper("As promised, here are your advanced skills. Use them wisely.");
#Insert Skill Command Here <--
}
plugin::return_items(\%itemcount);
}
Hopefully I can get something working. I am going to try and put it in the player.pl file for the zone and see if once zoning into the zone if it doesn't just make it what I want.
As I said, I was really hoping to do a quest to max out all the skills later without having to write out each skill code.
Example
Code:
$client->SetSkill(#,#);
$client->SetSkill(#,#);
Thanks,
Kingmen
|
|
|
|
02-10-2013, 10:41 PM
|
Dragon
|
|
Join Date: May 2010
Posts: 965
|
|
someone needs to export the routine used by #maxskills that one is useful.
the max is 4 as prior to RoF the system was never designed for stacked items to be turned in.
|
02-10-2013, 11:08 PM
|
|
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
yeah, limiting spell casting specializations to 50 is a good idea. i hadn't considered that.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
|
02-11-2013, 02:07 AM
|
|
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
if you can set the correct race via in-game command, i'd recommend looking at the related entries for that npc your database instead of putting a perl band-aid on the issue.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
|
02-11-2013, 02:32 AM
|
Hill Giant
|
|
Join Date: Sep 2006
Posts: 112
|
|
Quote:
Originally Posted by c0ncrete
if you can set the correct race via in-game command, i'd recommend looking at the related entries for that npc your database instead of putting a perl band-aid on the issue.
|
Yeah, I was trying to do that from the beginning.... Unfortunately, I was messing with the NPC_TYPES table, and I just ended up duplicating the npc row that I wanted and I am going to just use the #dbspawn command for pre-made characters that I know work in the zone(s) that I am populating.
Thanks for all your help though, it is greatly appreciated, and you have been really helpful and quick to respond to me c0ncrete.
Thanks.
|
|
|
|
02-11-2013, 03:43 AM
|
|
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
this should take care of spell casting specialization skills correctly.
i haven't tested it yet, but the syntax is correct and the logic looks sound.
Code:
use List::Util qw(first);
# shorthand aliases for the client methods we'll be using
$CanSkill = sub { $client->CanHaveSkill(shift) };
$MaxSkill = sub { $client->MaxSkill( shift, $class, $ulevel ) };
$RawSkill = sub { $client->GetRawSkill(shift) };
$SetSkill = sub { $client->SetSkill( shift, shift ) };
# set all available skills to max value for client's current level
# NOTE: spell-casting specialization skills are handled later
foreach my $skillNum ( 0 .. 42, 48 .. 74 ) {
next unless $CanSkill->($skillNum);
$SetSkill->( $skillNum, $MaxSkill->($skillNum) );
}
# if client is a caster and can specialize
if ( $CanSkill->(43) ) {
# get current raw value for all spell-casting spec skills
my %spec = map { $_ => $RawSkill->($_) } ( 43 .. 47 );
# if one spell-casting spec skill is above 50 (main spec for caster),
# set it to the max value for the client's current level
# (this skill is deleted from hash and doesn't get calculated again)
if ( my $mainSpec = first { $spec{$_} > 50 } keys %spec ) {
$SetSkill->( $mainSpec, $MaxSkill->($mainSpec) );
delete $spec{$mainSpec};
}
# set spell-casting spec skills to max value for client's current level
# all skill levels but the first one that goes over 50 are capped at 50
foreach my $skillNum ( keys %spec ) {
next if $spec{$skillNum} == 50;
my $maxVal = $MaxSkill->($skillNum);
$SetSkill->( $skillNum, $maxVal > 50 ? 50 : $maxVal );
}
}
NOTE: oops... i forgot to include the List::Util module in my copy/paste. corrected.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Last edited by c0ncrete; 02-11-2013 at 04:08 AM..
Reason: more clarification in comments
|
|
|
|
02-11-2013, 04:46 AM
|
Demi-God
|
|
Join Date: Aug 2010
Posts: 1,742
|
|
I don't know if the emulator supports all the same features as live as far as specialization goes, but there is an AA to allow a second specialization that caps a bit higher, and the specialization caps rise as you level.
So, as an example the caps for first, second, and the rest are 256, 155, 105 at level 81.
|
02-11-2013, 01:39 PM
|
|
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
challenge accepted!
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
|
02-12-2013, 10:25 PM
|
|
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
commented, to hopefully help you sort out exactly what it is you want to remove/change.
Code:
# do this for skill number 0 through 74
foreach my $skill ( 0 .. 74 ) {
# skip to next skill if client can't have this skill
next unless $client->CanHaveSkill($skill);
# get the maximum skll level for current skill number, based on client's class and level
my $max = $client->MaxSkill( $skill, $client->GetClass(), $client->GetLevel() );
# skip to next skill unless the maximum skill level from above is higher than the client's current raw skill level
next unless $max > $client->GetRawSkill($skill);
# set the current skill level to the maximum, as determined above
$client->SetSkill( $skill, $max );
}
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
|
|
|
|
02-13-2013, 12:23 AM
|
Hill Giant
|
|
Join Date: Sep 2006
Posts: 112
|
|
Quote:
Originally Posted by c0ncrete
commented, to hopefully help you sort out exactly what it is you want to remove/change.
Code:
# do this for skill number 0 through 74
foreach my $skill ( 0 .. 74 ) {
# skip to next skill if client can't have this skill
next unless $client->CanHaveSkill($skill);
# get the maximum skll level for current skill number, based on client's class and level
my $max = $client->MaxSkill( $skill, $client->GetClass(), $client->GetLevel() );
# skip to next skill unless the maximum skill level from above is higher than the client's current raw skill level
next unless $max > $client->GetRawSkill($skill);
# set the current skill level to the maximum, as determined above
$client->SetSkill( $skill, $max );
}
|
Please forgive my ignorance, or whatever it is that I seem to be having with this. I followed your comments, and I am still unable to get this working through a few variations.
Here is the modified script:
Code:
##########
#Skills Trainer And Quest
#By Kingmen30264
##########
sub EVENT_SAY
{
my $train = quest::saylink("train");
my $advanced = quest::saylink("advanced skills");
my $trade = quest::saylink("trade");
my $free = quest::saylink("FREE");
my $items = quest::saylink("items");
my $zone1 = quest::saylink("zone1");
my $zone2 = quest::saylink("zone2");
my $item1 = quest::varlink("9989");
my $item2 = quest::varlink("9999");
my $count1 = quest::saylink("2");
my $count2 = quest::saylink("2");
my $skill = $client->GetSkill(0);
my $skill = $client->GetSkill(1);
my $skill = $client->GetSkill(2);
my $skill = $client->GetSkill(3);
my $skill = $client->GetSkill(4);
my $skill = $client->GetSkill(5);
my $skill = $client->GetSkill(6);
my $skill = $client->GetSkill(7);
my $skill = $client->GetSkill(8);
my $skill = $client->GetSkill(9);
my $skill = $client->GetSkill(10);
my $skill = $client->GetSkill(11);
my $skill = $client->GetSkill(12);
my $skill = $client->GetSkill(13);
my $skill = $client->GetSkill(14);
my $skill = $client->GetSkill(15);
my $skill = $client->GetSkill(16);
my $skill = $client->GetSkill(17);
my $skill = $client->GetSkill(18);
my $skill = $client->GetSkill(19);
my $skill = $client->GetSkill(20);
my $skill = $client->GetSkill(21);
my $skill = $client->GetSkill(22);
my $skill = $client->GetSkill(23);
my $skill = $client->GetSkill(24);
my $skill = $client->GetSkill(25);
my $skill = $client->GetSkill(26);
my $skill = $client->GetSkill(27);
my $skill = $client->GetSkill(28);
my $skill = $client->GetSkill(29);
my $skill = $client->GetSkill(30);
my $skill = $client->GetSkill(31);
my $skill = $client->GetSkill(32);
my $skill = $client->GetSkill(33);
my $skill = $client->GetSkill(34);
my $skill = $client->GetSkill(35);
my $skill = $client->GetSkill(36);
my $skill = $client->GetSkill(37);
my $skill = $client->GetSkill(38);
my $skill = $client->GetSkill(39);
my $skill = $client->GetSkill(40);
my $skill = $client->GetSkill(41);
my $skill = $client->GetSkill(42);
my $skill = $client->GetSkill(43);
my $skill = $client->GetSkill(44);
my $skill = $client->GetSkill(45);
my $skill = $client->GetSkill(46);
my $skill = $client->GetSkill(47);
my $skill = $client->GetSkill(48);
my $skill = $client->GetSkill(49);
my $skill = $client->GetSkill(50);
my $skill = $client->GetSkill(51);
my $skill = $client->GetSkill(52);
my $skill = $client->GetSkill(53);
my $skill = $client->GetSkill(54);
my $skill = $client->GetSkill(55);
my $skill = $client->GetSkill(56);
my $skill = $client->GetSkill(57);
my $skill = $client->GetSkill(58);
my $skill = $client->GetSkill(59);
my $skill = $client->GetSkill(60);
my $skill = $client->GetSkill(61);
my $skill = $client->GetSkill(62);
my $skill = $client->GetSkill(63);
my $skill = $client->GetSkill(64);
my $skill = $client->GetSkill(65);
my $skill = $client->GetSkill(66);
my $skill = $client->GetSkill(67);
my $skill = $client->GetSkill(68);
my $skill = $client->GetSkill(69);
my $skill = $client->GetSkill(70);
my $skill = $client->GetSkill(71);
my $skill = $client->GetSkill(72);
my $skill = $client->GetSkill(73);
my $skill = $client->GetSkill(74);
my $skill = $client->GetSkill(75);
my $skill = $client->GetSkill(76);
my $max = $client->MaxSkill( $skill, $client->GetClass(), $client->GetLevel() ); # get the maximum skll level for current skill number, based on client's class and level
if($text=~/Hail/i)
{
plugin::Whisper("Hi $name. My name is Skills.
I can $train you in your skills if you would like. Otherwise I might be able to teach some more $advanced.");
}
if($text=~/train/i)
{
# skip to next skill if client can't have this skill
next unless $client->CanHaveSkill($skill);
# skip to next skill unless the maximum skill level from above is higher than the client's current raw skill level
next unless $max > $client->GetRawSkill($skill);
# set the current skill level to the maximum, as determined above
$client->SetSkill( $skill, $max );
}
if($text=~/advanced skills/i)
{
plugin::Whisper("Yes, I can train you even more. I can train you so much, in fact, that when I am done, I doubt you could go further! However, I cannot merely offer my services for $free now can I?");
plugin::Whisper("No, no. But, I am in a good mood today, and I am willing to $trade you your higher skills in exchange for something.");
}
if($text=~/free/i)
{
plugin::Whisper("The only thing you will get from me for free is a swift kick up the --");
quest::emote("Skills turns his head in disgust.");
}
if($text=~/trade/i)
{
plugin::Whisper("Yes, you must do something for me for your $advanced.");
plugin::Whisper("If you wouldn't mind getting your armor a little scratched, I am going to require a few $items from some different locations.");
}
if($text=~/items/i)
{
plugin::Whisper("Ah, glad to hear that you are willing to begin your training. In that case, I am going to need the following:");
$client->Message(315, "===$zone1===");
plugin::Whisper("$item1 X $count1");
$client->Message(315, "===$zone2===");
plugin::Whisper("$item2 X $count2");
}
}
sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 9989 => 1))
{
plugin::Whisper("As promised, here are your advanced skills. Use them wisely.");
$npc->SetSkillAll(400, $client);
}
plugin::return_items(\%itemcount);
}
If I do just my $skill(#); then the NPC will not talk to me in the least. So I tried to find a parameter that WOULD work, but I am using the wrong one?
If I leave the $max = $client-> .... where you have it in the original, NPC still will not talk to me.
I don't know what I am doing wrong to be honest.
Sorry for the annoyance with this, I truly am trying to learn this the best that I can. I can do everything else just fine, spawn mobs, create tasks, etc, etc... but it just seems that any of the skill commands I get from here just either don't work, or don't wanna work. Which I am not sure.
Thanks,
Kingmen
===EDIT===
I have found a temporary work around for the skill trainer, but I am going to mess with it some more until I find a more workable command/script for it.
Here is what I have:
Code:
##########
#Skills Trainer And Quest
#By Kingmen30264
##########
sub EVENT_SAY
{
my $train = quest::saylink("train");
my $advanced = quest::saylink("advanced skills");
my $trade = quest::saylink("trade");
my $free = quest::saylink("FREE");
my $items = quest::saylink("items");
my $zone1 = quest::saylink("zone1");
my $zone2 = quest::saylink("zone2");
my $item1 = quest::varlink("9989");
my $item2 = quest::varlink("9999");
my $count1 = quest::saylink("2");
my $count2 = quest::saylink("2");
my $skill = quest::addskill(0, $ulevel = 20);
my $skill = quest::addskill(1, $ulevel = 20);
my $skill = quest::addskill(2, $ulevel = 20);
my $skill = quest::addskill(3, $ulevel = 20);
my $skill = quest::addskill(4, $ulevel = 20);
my $skill = quest::addskill(5, $ulevel = 20);
my $skill = quest::addskill(6, $ulevel = 20);
my $skill = quest::addskill(7, $ulevel = 20);
my $skill = quest::addskill(8, $ulevel = 20);
my $skill = quest::addskill(9, $ulevel = 20);
my $skill = quest::addskill(10, $ulevel = 20);
my $skill = quest::addskill(11, $ulevel = 20);
my $skill = quest::addskill(12, $ulevel = 20);
my $skill = quest::addskill(13, $ulevel = 20);
my $skill = quest::addskill(14, $ulevel = 20);
my $skill = quest::addskill(15, $ulevel = 20);
my $skill = quest::addskill(16, $ulevel = 20);
my $skill = quest::addskill(17, $ulevel = 20);
my $skill = quest::addskill(18, $ulevel = 20);
my $skill = quest::addskill(19, $ulevel = 20);
my $skill = quest::addskill(20, $ulevel = 20);
my $skill = quest::addskill(21, $ulevel = 20);
my $skill = quest::addskill(22, $ulevel = 20);
my $skill = quest::addskill(23, $ulevel = 20);
my $skill = quest::addskill(24, $ulevel = 20);
my $skill = quest::addskill(25, $ulevel = 20);
my $skill = quest::addskill(26, $ulevel = 20);
my $skill = quest::addskill(27, $ulevel = 20);
my $skill = quest::addskill(28, $ulevel = 20);
my $skill = quest::addskill(29, $ulevel = 20);
my $skill = quest::addskill(30, $ulevel = 20);
my $skill = quest::addskill(31, $ulevel = 20);
my $skill = quest::addskill(32, $ulevel = 20);
my $skill = quest::addskill(33, $ulevel = 20);
my $skill = quest::addskill(34, $ulevel = 20);
my $skill = quest::addskill(35, $ulevel = 20);
my $skill = quest::addskill(36, $ulevel = 20);
my $skill = quest::addskill(37, $ulevel = 20);
my $skill = quest::addskill(38, $ulevel = 20);
my $skill = quest::addskill(39, $ulevel = 20);
my $skill = quest::addskill(40, $ulevel = 20);
my $skill = quest::addskill(41, $ulevel = 20);
my $skill = quest::addskill(42, $ulevel = 20);
my $skill = quest::addskill(43, $ulevel = 20);
my $skill = quest::addskill(44, $ulevel = 20);
my $skill = quest::addskill(45, $ulevel = 20);
my $skill = quest::addskill(46, $ulevel = 20);
my $skill = quest::addskill(47, $ulevel = 20);
my $skill = quest::addskill(48, $ulevel = 20);
my $skill = quest::addskill(49, $ulevel = 20);
my $skill = quest::addskill(50, $ulevel = 20);
my $skill = quest::addskill(51, $ulevel = 20);
my $skill = quest::addskill(52, $ulevel = 20);
my $skill = quest::addskill(53, $ulevel = 20);
my $skill = quest::addskill(54, $ulevel = 20);
my $skill = quest::addskill(55, $ulevel = 20);
my $skill = quest::addskill(56, $ulevel = 20);
my $skill = quest::addskill(57, $ulevel = 20);
my $skill = quest::addskill(58, $ulevel = 20);
my $skill = quest::addskill(59, $ulevel = 20);
my $skill = quest::addskill(60, $ulevel = 20);
my $skill = quest::addskill(61, $ulevel = 20);
my $skill = quest::addskill(62, $ulevel = 20);
my $skill = quest::addskill(63, $ulevel = 20);
my $skill = quest::addskill(64, $ulevel = 20);
my $skill = quest::addskill(65, $ulevel = 20);
my $skill = quest::addskill(66, $ulevel = 20);
my $skill = quest::addskill(67, $ulevel = 20);
my $skill = quest::addskill(68, $ulevel = 20);
my $skill = quest::addskill(69, $ulevel = 20);
my $skill = quest::addskill(70, $ulevel = 20);
my $skill = quest::addskill(71, $ulevel = 20);
my $skill = quest::addskill(72, $ulevel = 20);
my $skill = quest::addskill(73, $ulevel = 20);
my $skill = quest::addskill(74, $ulevel = 20);
my $skill = quest::addskill(75, $ulevel = 20);
my $skill = quest::addskill(76, $ulevel = 20);
my $max = $client->MaxSkill( $skill, $client->GetClass(), $client->GetLevel() ); # get the maximum skll level for current skill number, based on client's class and level
if($text=~/Hail/i)
{
plugin::Whisper("Hi $name. My name is Skills.
I can $train you in your skills if you would like. Otherwise I might be able to teach some more $advanced.");
}
if($text=~/train/i)
{
# skip to next skill if client can't have this skill
next unless $client->CanHaveSkill($skill);
# skip to next skill unless the maximum skill level from above is higher than the client's current raw skill level
next unless $max > $client->GetRawSkill($skill);
# set the current skill level to the maximum, as determined above
$client->SetSkill( $skill, $max );
}
if($text=~/advanced skills/i)
{
plugin::Whisper("Yes, I can train you even more. I can train you so much, in fact, that when I am done, I doubt you could go further! However, I cannot merely offer my services for $free now can I?");
plugin::Whisper("No, no. But, I am in a good mood today, and I am willing to $trade you your higher skills in exchange for something.");
}
if($text=~/free/i)
{
plugin::Whisper("The only thing you will get from me for free is a swift kick up the --");
quest::emote("Skills turns his head in disgust.");
}
if($text=~/trade/i)
{
plugin::Whisper("Yes, you must do something for me for your $advanced.");
plugin::Whisper("If you wouldn't mind getting your armor a little scratched, I am going to require a few $items from some different locations.");
}
if($text=~/items/i)
{
plugin::Whisper("Ah, glad to hear that you are willing to begin your training. In that case, I am going to need the following:");
$client->Message(315, "===$zone1===");
plugin::Whisper("$item1 X $count1");
$client->Message(315, "===$zone2===");
plugin::Whisper("$item2 X $count2");
}
}
sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 9989 => 1))
{
plugin::Whisper("As promised, here are your advanced skills. Use them wisely.");
$npc->SetSkillAll(400, $client);
}
plugin::return_items(\%itemcount);
}
===EDIT 2===
After messing with it some more, here is what I have come up with so far that will work for what I am trying to do... It is VERY sloppy, but I am hoping that I can alter this through Hashes?
Code:
##########
#Skills Trainer And Quest
#By Kingmen30264
##########
sub EVENT_SAY
{
my $train = quest::saylink("train");
my $advanced = quest::saylink("advanced skills");
my $trade = quest::saylink("trade");
my $free = quest::saylink("FREE");
my $items = quest::saylink("items");
my $zone1 = quest::saylink("zone1");
my $zone2 = quest::saylink("zone2");
my $item1 = quest::varlink("9989");
my $item2 = quest::varlink("9999");
my $count1 = quest::saylink("2");
my $count2 = quest::saylink("2");
my $max = $client->MaxSkill( $skill, $client->GetClass(), $client->GetLevel() ); # get the maximum skll level for current skill number, based on client's class and level
if($text=~/Hail/i)
{
plugin::Whisper("Hi $name. My name is Skills.
I can $train you in your skills if you would like. Otherwise I might be able to teach some more $advanced.");
}
if($text=~/train/i)
{
my $skill = quest::addskill(0, $ulevel = 100);
my $skill = quest::addskill(1, $ulevel = 100);
my $skill = quest::addskill(2, $ulevel = 100);
my $skill = quest::addskill(3, $ulevel = 100);
my $skill = quest::addskill(4, $ulevel = 100);
my $skill = quest::addskill(5, $ulevel = 100);
my $skill = quest::addskill(6, $ulevel = 100);
my $skill = quest::addskill(7, $ulevel = 100);
my $skill = quest::addskill(8, $ulevel = 100);
my $skill = quest::addskill(9, $ulevel = 100);
my $skill = quest::addskill(10, $ulevel = 100);
my $skill = quest::addskill(11, $ulevel = 100);
my $skill = quest::addskill(12, $ulevel = 100);
my $skill = quest::addskill(13, $ulevel = 100);
my $skill = quest::addskill(14, $ulevel = 100);
my $skill = quest::addskill(15, $ulevel = 100);
my $skill = quest::addskill(16, $ulevel = 100);
my $skill = quest::addskill(17, $ulevel = 100);
my $skill = quest::addskill(18, $ulevel = 100);
my $skill = quest::addskill(19, $ulevel = 100);
my $skill = quest::addskill(20, $ulevel = 100);
my $skill = quest::addskill(21, $ulevel = 100);
my $skill = quest::addskill(22, $ulevel = 100);
my $skill = quest::addskill(23, $ulevel = 100);
my $skill = quest::addskill(24, $ulevel = 100);
my $skill = quest::addskill(25, $ulevel = 100);
my $skill = quest::addskill(26, $ulevel = 100);
my $skill = quest::addskill(27, $ulevel = 100);
my $skill = quest::addskill(28, $ulevel = 100);
my $skill = quest::addskill(29, $ulevel = 100);
my $skill = quest::addskill(30, $ulevel = 100);
my $skill = quest::addskill(31, $ulevel = 100);
my $skill = quest::addskill(32, $ulevel = 100);
my $skill = quest::addskill(33, $ulevel = 100);
my $skill = quest::addskill(34, $ulevel = 100);
my $skill = quest::addskill(35, $ulevel = 100);
my $skill = quest::addskill(36, $ulevel = 100);
my $skill = quest::addskill(37, $ulevel = 100);
my $skill = quest::addskill(38, $ulevel = 100);
my $skill = quest::addskill(39, $ulevel = 100);
my $skill = quest::addskill(40, $ulevel = 100);
my $skill = quest::addskill(41, $ulevel = 100);
my $skill = quest::addskill(42, $ulevel = 100);
my $skill = quest::addskill(43, $ulevel = 100);
my $skill = quest::addskill(44, $ulevel = 100);
my $skill = quest::addskill(45, $ulevel = 100);
my $skill = quest::addskill(46, $ulevel = 100);
my $skill = quest::addskill(47, $ulevel = 100);
my $skill = quest::addskill(48, $ulevel = 100);
my $skill = quest::addskill(49, $ulevel = 100);
my $skill = quest::addskill(50, $ulevel = 100);
my $skill = quest::addskill(51, $ulevel = 100);
my $skill = quest::addskill(52, $ulevel = 100);
my $skill = quest::addskill(53, $ulevel = 100);
my $skill = quest::addskill(54, $ulevel = 100);
my $skill = quest::addskill(55, $ulevel = 100);
my $skill = quest::addskill(56, $ulevel = 100);
my $skill = quest::addskill(57, $ulevel = 100);
my $skill = quest::addskill(58, $ulevel = 100);
my $skill = quest::addskill(59, $ulevel = 100);
my $skill = quest::addskill(60, $ulevel = 100);
my $skill = quest::addskill(61, $ulevel = 100);
my $skill = quest::addskill(62, $ulevel = 100);
my $skill = quest::addskill(63, $ulevel = 100);
my $skill = quest::addskill(64, $ulevel = 100);
my $skill = quest::addskill(65, $ulevel = 100);
my $skill = quest::addskill(66, $ulevel = 100);
my $skill = quest::addskill(67, $ulevel = 100);
my $skill = quest::addskill(68, $ulevel = 100);
my $skill = quest::addskill(69, $ulevel = 100);
my $skill = quest::addskill(70, $ulevel = 100);
my $skill = quest::addskill(71, $ulevel = 100);
my $skill = quest::addskill(72, $ulevel = 100);
my $skill = quest::addskill(73, $ulevel = 100);
my $skill = quest::addskill(74, $ulevel = 100);
my $skill = quest::addskill(75, $ulevel = 100);
my $skill = quest::addskill(76, $ulevel = 100);
}
if($text=~/advanced skills/i)
{
plugin::Whisper("Yes, I can train you even more. I can train you so much, in fact, that when I am done, I doubt you could go further! However, I cannot merely offer my services for $free now can I?");
plugin::Whisper("No, no. But, I am in a good mood today, and I am willing to $trade you your higher skills in exchange for something.");
}
if($text=~/free/i)
{
plugin::Whisper("The only thing you will get from me for free is a swift kick up the --");
quest::emote("Skills turns his head in disgust.");
}
if($text=~/trade/i)
{
plugin::Whisper("Yes, you must do something for me for your $advanced.");
plugin::Whisper("If you wouldn't mind getting your armor a little scratched, I am going to require a few $items from some different locations.");
}
if($text=~/items/i)
{
plugin::Whisper("Ah, glad to hear that you are willing to begin your training. In that case, I am going to need the following:");
$client->Message(315, "===$zone1===");
plugin::Whisper("$item1 X $count1");
$client->Message(315, "===$zone2===");
plugin::Whisper("$item2 X $count2");
}
}
sub EVENT_ITEM
{
if(plugin::check_handin(\%itemcount, 9989 => 1))
{
my $skill = quest::addskill(0, $ulevel = 1000);
my $skill = quest::addskill(1, $ulevel = 1000);
my $skill = quest::addskill(2, $ulevel = 1000);
my $skill = quest::addskill(3, $ulevel = 1000);
my $skill = quest::addskill(4, $ulevel = 1000);
my $skill = quest::addskill(5, $ulevel = 1000);
my $skill = quest::addskill(6, $ulevel = 1000);
my $skill = quest::addskill(7, $ulevel = 1000);
my $skill = quest::addskill(8, $ulevel = 1000);
my $skill = quest::addskill(9, $ulevel = 1000);
my $skill = quest::addskill(10, $ulevel = 1000);
my $skill = quest::addskill(11, $ulevel = 1000);
my $skill = quest::addskill(12, $ulevel = 1000);
my $skill = quest::addskill(13, $ulevel = 1000);
my $skill = quest::addskill(14, $ulevel = 1000);
my $skill = quest::addskill(15, $ulevel = 1000);
my $skill = quest::addskill(16, $ulevel = 1000);
my $skill = quest::addskill(17, $ulevel = 1000);
my $skill = quest::addskill(18, $ulevel = 1000);
my $skill = quest::addskill(19, $ulevel = 1000);
my $skill = quest::addskill(20, $ulevel = 1000);
my $skill = quest::addskill(21, $ulevel = 1000);
my $skill = quest::addskill(22, $ulevel = 1000);
my $skill = quest::addskill(23, $ulevel = 1000);
my $skill = quest::addskill(24, $ulevel = 1000);
my $skill = quest::addskill(25, $ulevel = 1000);
my $skill = quest::addskill(26, $ulevel = 1000);
my $skill = quest::addskill(27, $ulevel = 1000);
my $skill = quest::addskill(28, $ulevel = 1000);
my $skill = quest::addskill(29, $ulevel = 1000);
my $skill = quest::addskill(30, $ulevel = 1000);
my $skill = quest::addskill(31, $ulevel = 1000);
my $skill = quest::addskill(32, $ulevel = 1000);
my $skill = quest::addskill(33, $ulevel = 1000);
my $skill = quest::addskill(34, $ulevel = 1000);
my $skill = quest::addskill(35, $ulevel = 1000);
my $skill = quest::addskill(36, $ulevel = 1000);
my $skill = quest::addskill(37, $ulevel = 1000);
my $skill = quest::addskill(38, $ulevel = 1000);
my $skill = quest::addskill(39, $ulevel = 1000);
my $skill = quest::addskill(40, $ulevel = 1000);
my $skill = quest::addskill(41, $ulevel = 1000);
my $skill = quest::addskill(42, $ulevel = 1000);
my $skill = quest::addskill(43, $ulevel = 1000);
my $skill = quest::addskill(44, $ulevel = 1000);
my $skill = quest::addskill(45, $ulevel = 1000);
my $skill = quest::addskill(46, $ulevel = 1000);
my $skill = quest::addskill(47, $ulevel = 1000);
my $skill = quest::addskill(48, $ulevel = 1000);
my $skill = quest::addskill(49, $ulevel = 1000);
my $skill = quest::addskill(50, $ulevel = 1000);
my $skill = quest::addskill(51, $ulevel = 1000);
my $skill = quest::addskill(52, $ulevel = 1000);
my $skill = quest::addskill(53, $ulevel = 1000);
my $skill = quest::addskill(54, $ulevel = 1000);
my $skill = quest::addskill(55, $ulevel = 1000);
my $skill = quest::addskill(56, $ulevel = 1000);
my $skill = quest::addskill(57, $ulevel = 1000);
my $skill = quest::addskill(58, $ulevel = 1000);
my $skill = quest::addskill(59, $ulevel = 1000);
my $skill = quest::addskill(60, $ulevel = 1000);
my $skill = quest::addskill(61, $ulevel = 1000);
my $skill = quest::addskill(62, $ulevel = 1000);
my $skill = quest::addskill(63, $ulevel = 1000);
my $skill = quest::addskill(64, $ulevel = 1000);
my $skill = quest::addskill(65, $ulevel = 1000);
my $skill = quest::addskill(66, $ulevel = 1000);
my $skill = quest::addskill(67, $ulevel = 1000);
my $skill = quest::addskill(68, $ulevel = 1000);
my $skill = quest::addskill(69, $ulevel = 1000);
my $skill = quest::addskill(70, $ulevel = 1000);
my $skill = quest::addskill(71, $ulevel = 1000);
my $skill = quest::addskill(72, $ulevel = 1000);
my $skill = quest::addskill(73, $ulevel = 1000);
my $skill = quest::addskill(74, $ulevel = 1000);
my $skill = quest::addskill(75, $ulevel = 1000);
my $skill = quest::addskill(76, $ulevel = 1000);
}
{
plugin::Whisper("As promised, here are your advanced skills. Use them wisely.");
}
plugin::return_items(\%itemcount);
}
Hopefully I can clean this up some on my own. I thank those that helped me throughout this post so far in getting me this far.
Thanks,
Kingmen30264
|
|
|
|
02-13-2013, 04:54 AM
|
|
Dragon
|
|
Join Date: Dec 2009
Posts: 719
|
|
in Perl, every time you use the my keyword, you are declaring (creating) the variable that follows within the scope you are in. additionally, every time you use =, you are assigning a value to the left operand.
i don't mean this as an insult, but i would suggest you spend a little time learning some basic programming concepts before continuing further. it will likely be immensely helpful to you to be able to write and run Perl scripts outside of the emulator environment so you can test ideas or debug issues that you may have without having to launch the server or the client whatsoever.
there is some very good material freely available here to get you started:
http://www.perl.org/books/library.html
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
|
|
|
|
02-16-2013, 07:18 AM
|
Hill Giant
|
|
Join Date: Sep 2006
Posts: 112
|
|
Quote:
Originally Posted by c0ncrete
in Perl, every time you use the my keyword, you are declaring (creating) the variable that follows within the scope you are in. additionally, every time you use =, you are assigning a value to the left operand.
i don't mean this as an insult, but i would suggest you spend a little time learning some basic programming concepts before continuing further. it will likely be immensely helpful to you to be able to write and run Perl scripts outside of the emulator environment so you can test ideas or debug issues that you may have without having to launch the server or the client whatsoever.
there is some very good material freely available here to get you started:
http://www.perl.org/books/library.html
|
You were right c0ncrete, I wasn't understanding what it was that you were referring to when you showed me that script.
Since you have showed me that, I have been reading up on Perl and researching various commands to learn a little more in each "area" and in doing so, I was able to learn a few more "tricks of the trade", if you wanna call it that.
Here is what I got:
Code:
foreach my $skill (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, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76)
{
next unless $client->CanHaveSkill($skill);
my $max = $client->MaxSkill( $skill, $client->GetClass(), $ulevel );
next unless $max > $client->GetRawSkill($skill);
$client->SetSkill( $skill, $max );
}
You said that if I learned a little more about it, then I could even test the script without launcher a client, and with that, I did a little research and I found that I can use cmd to test the script(s) I compose with the following command:
It works in telling me if the syntax is right, and also lists the errors if any are present, but I still trying to find a way to write the results to a text file so I can comb through it as sometimes it scrolls off the screen. Any help on this? (Windows 7 OS)
Thanks for the link(s) to perl, they are extremely helpful.
~Kingmen
P.S. I know you know the command(s) to perl and whatnot, but I am adding this in here in case someone like myself who is new to this can see what I did, and implement it themselves. A lot of the time when I go to search for something, someone will find the answer and not post it. They will only say, "I solved it, thanks!" and not post what they did to solve it.
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 07:13 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|