PDA

View Full Version : Skills quest


knight-mare
08-18-2014, 03:27 PM
So here a quest script i put together for a skill up NPC
http://pastebin.com/xFgexccX

first day i set him up he worked perfect i tested him etc (level by level) and my skills went up

now hes dead to the world
when i run questerrors i get this
script error: qst_npc_999248::EVENT_ITEM

chrsschb
08-29-2014, 02:52 PM
Syntax looks fine to me.

sub EVENT_SAY
{
if($text =~/Hail/i)
{
quest::say("Greetings $name. If you want me to set your skills for you, please say so and I will give you my [pricelist]. If you want me to [heal] you, please say so and I will do it for free.");
}

if($text=~/pricelist/i)
{
quest::say("I can set all skills to the following skill levels : level 20 = 10 pp // level 40 = 40 pp // level 60 = 80 pp // level 80 = 160 pp // level 100 = 320 pp // level 120 = 640 pp // level 150 = 1280 pp // level 200 = 2560 pp // level 250 = 5000 pp");
}

if($text=~/heal/i)
{
quest::selfcast(13);
}
}

sub EVENT_ITEM
{
if($platinum == 10)
{
quest::setallskills (20);
}

if($platinum == 40)
{
quest::setallskills (40);
}

if($platinum == 80)
{
quest::setallskills (60);
}

if($platinum == 160)
{
quest::setallskills (80);
}

if($platinum == 320)
{
quest::setallskills(100);
}

if($platinum == 640)
{
quest::setallskills(120);
}

if($platinum == 1280)
{
quest::setallskills(150);
}

if($platinum == 2560)
{
quest::setallskills(200);
}

if($platinum == 5000)
{
quest::setallskills(250);
}
}

However consider expanding your code to use character level and class skill max values. For instance if your character is level 34 wizard, this code would give max skills for a level 34 wizard. You can place it inside any if statement with your predetermined prerequisites.


{
my $CharClass = $client->GetClass();
for ($skillid = 0; $skillid < 74; $skillid++)
{
my $SkillValue = $client->MaxSkill($skillid, $CharClass, $ulevel);
$client->SetSkill($skillid, $SkillValue);
}
}

knight-mare
06-21-2015, 12:49 PM
anyone any idea why this would not work? NPC responds to players and takes money but dose not give skills

NatedogEZ
06-21-2015, 03:58 PM
you are using.. "setallskills" and it should just be.. "setallskill"


When you are stumped, best bet is to check the wiki.

http://wiki.eqemulator.org/p?Ultimate_Perl_Reference&frm=Main

knight-mare
06-24-2015, 06:19 PM
sooo this is now quest

sub EVENT_SAY
{
if($text =~/Hail/i)
{
quest::say("Greetings $name. If you want me to set your skills for you, please say so and I will give you my [pricelist].");
}

if($text=~/pricelist/i)
{quest::say("I can set all skills to the following skill levels : level 20 = 10 pp // level 40 = 40 pp // level 60 = 80 pp // level 80 = 160 pp // level 100 = 320 pp // level 120 = 640 pp // level 150 = 1280 pp // level 200 = 2560 pp // level 250 = 5000 pp");}
}
}

sub EVENT_ITEM
{
if($platinum == 10)
{
quest::setallskill (20) ;
}
if($platinum == 40)
{
quest::setallskill (40);
}
if($platinum == 80)
{
quest::setallskill (60);
}
if($platinum == 160)
{
quest::setallskill (80);
}
if($platinum == 320)
{
quest::setallskill (100);
}
if($platinum == 640)
{
quest::setallskill (120);
}
if($platinum == 1280)
{
quest::setallskill (150);
}
if($platinum == 2560)
{
quest::setallskill (200);
}
if($platinum == 5000)
{
quest::setallskill (250);
}
}

should all work? but itg dosnt ...he gobbles plat and gives no skills :S

provocating
06-24-2015, 07:01 PM
Getting it to where it is easier to read. Still responding to hails?

sub EVENT_SAY
{
if($text =~/Hail/i)
{
quest::say("Greetings $name. If you want me to set your skills for you, please say so and I will give you my [pricelist].");
}

if($text=~/pricelist/i)
{
quest::say("I can set all skills to the following skill levels : level 20 = 10 pp // level 40 = 40 pp // level 60 = 80 pp // level 80 = 160 pp // level 100 = 320 pp // level 120 = 640 pp // level 150 = 1280 pp // level 200 = 2560 pp // level 250 = 5000 pp");}
}
}

sub EVENT_ITEM
{
if($platinum == 10)
{
quest::setallskill(20);
}
if($platinum == 40)
{
quest::setallskill(40);
}
if($platinum == 80)
{
quest::setallskill(60);
}
if($platinum == 160)
{
quest::setallskill(80);
}
if($platinum == 320)
{
quest::setallskill(100);
}
if($platinum == 640)
{
quest::setallskill(120);
}
if($platinum == 1280)
{
quest::setallskill(150);
}
if($platinum == 2560)
{
quest::setallskill(200);
}
if($platinum == 5000)
{
quest::setallskill(250);
}
}

Kingly_Krab
06-24-2015, 07:07 PM
There was an extra }, try this: sub EVENT_SAY {
my %h = (10 => 20,
40 => 40,
80 => 60,
160 => 80,
320 => 100,
640 => 120,
1280 => 150,
2560 => 200,
5000 => 250);
if($text =~/Hail/i) {
quest::say("Greetings $name. If you want me to set your skills for you, please say so and I will give you my " . quest::saylink("price list", 1) . ".");
} elsif($text=~/Price List/i) {
quest::say("I can set all skills to the following skill levels:");
quest::say("Level $h{$_}: " . quest::saylink($_, 1) . " Platinum") for (sort {$a <=> $b} @{[keys %h]});
} elsif ($text!~/Hail/i && $text!~/Price List/i && $text ~~ @{[keys %h]} && $client->TakeMoneyFromPP(($text * 1000), 1)) {
quest::setallskill($h{$text});
}
}

Shendare
06-24-2015, 07:13 PM
Such elegance you bring to otherwise crude and simple code, KK.

Kingly_Krab
06-24-2015, 07:16 PM
Yeah, just realized it didn't have saylinks so I added them. Not sure if making it more complex is elegant, but okay, haha.

Shendare
06-24-2015, 07:19 PM
So clicking the saylink for one of the options would take the money out of the character's inventory, as opposed to waiting for them to give it in a trade window. Clever and efficient, though likely less expected to the players.

Kingly_Krab
06-24-2015, 07:43 PM
Yeah, just the way I write things, it's more efficient to just take it all in one sweep.

knight-mare
06-25-2015, 08:08 AM
King your awsome.... any idea on this one?

knight-mare
06-25-2015, 08:10 AM
scratch that list bit... i completely bust second one so need to fix it