PDA

View Full Version : Spell/Disc scriber


Apoc.Index
08-17-2011, 03:12 AM
Ok, so I have gotten to hang of makeing quests. However my spell scriber and disc trainer dont appear to be working properly
Here is the Disc trainer script:
sub EVENT_SAY {

if ($text =~/Hail/i)
{ quest::say("Hello! Would you like me to set all your Discs?"); }

if($text=~/Discs/i)
{quest::traindiscs();}


}
}

And here is the spell scriber script (Thanks trev)

#A conversation to Scribe ALL spells For Player (up to curr. level)
sub EVENT_SAY {

if ($text =~/hail/i) {
quest::say ("Good day to you, $name. Would you like me to teach you all of your [spells]? Or maybe you are a [bard] in need of music lessons?"); }

if ($text =~/bard/i) {
quest::say ("Yes, normally you would think of a bard as being an adept student of music. For some reason, these lands slow the music learning ability to such an extent that I am willing to use my magic to train their abilities. Are you [ready] to learn?"); }

if ($text =~/ready/i) {
quest::say ("Listen closely as the essence of music fills your soul!");
quest::addskill(12,255);
quest::addskill(41,255);
quest::addskill(49,255);
quest::addskill(54,255);
quest::addskill(70,255); }

if ($text =~/spells/i) {
quest::say ("Good, stand where you are while I begin your lessons");
quest::scribespells(); }

}

Kingmen30264
08-17-2011, 04:22 AM
quest::scribespells(); }
{quest::traindiscs();} <----- Did not specify level range



I just created a spell and disc trainer today, and here is my script for it. It's not the best one, but it should help you a little.



#####
#NPC: Galmoran (Tomes and Quests NPC)
#Author: Warlore
#####

sub EVENT_SAY
{

my $tomes = quest::saylink("Tomes");
my $spells = quest::saylink("Spells");
my $learn = quest::saylink("learn");
my $knowing = quest::saylink("knowing");


if($text=~/Hail/i)
{
plugin::Whisper("Hi there $name, I am Galmoran, keeper of [$tomes] and [$spells]. How can I help you today?");
}
elsif($text=~/tomes/i)
{
plugin::Whisper("Yes, I know all the Tomes in the land. Just let me know if you wish to [$learn] them as well.");
}
elsif($text=~/spells/i)
{
plugin::Whisper("Spells, So many in the land. Would you be interesting in [$knowing] a few?");
}
elsif($text=~/learn/i)
{
quest::traindiscs($ulevel);
}
elsif($text=~/knowing/i)
{
quest::scribespells($ulevel);
}
}



Here I used $ulevel to determine what level the spells should be scribe to, but you can always change it to something like:


{
quest::scribespells(75, 1);
}


OR


{
quest::scribespells($ulevel); <----- Determines players level and scribes all spells TO that level (Think this is what you're wanting)
}


Hope this helps. :)

Apoc.Index
08-17-2011, 01:00 PM
Ok, thanks for the reply! I edited the code
quest::scribespells(); } to reflect (75, 1)

However even after changing that, the NPC still would not do the spells.
is there a chance I am missing a file somewhere for the DB to know what spells to scribe?

Note, I also directly tried your code and had the same result, that is why I am thinking I am missing spell file somewhere.

****Solved the issue, there were more syntax errors that I was missing**** Sorry.

Kingmen30264
08-17-2011, 04:31 PM
Here is your quest, I redid it a little to make it all work together properly.




sub EVENT_SAY
{
if ($text =~/Hail/i)
{
quest::say("Hello! Would you like me to set all your [Discs]?");
quest::say ("Good day to you, $name. Would you like me to teach you all of your [spells]? Or maybe you are a [bard] in need of music lessons?"); #A conversation to Scribe ALL spells For Player (up to curr. level)
}
elsif($text=~/Discs/i)
{
quest::traindiscs($ulevel); #Trainsdiscs to the users CURRENT Level
}
elsif ($text =~/bard/i)
{
quest::say ("Yes, normally you would think of a bard as being an adept student of music. For some reason, these lands slow the music learning ability to such an extent that I am willing to use my magic to train their abilities. Are you [ready] to learn?");
}
elsif ($text =~/ready/i)
{
quest::say ("Listen closely as the essence of music fills your soul!");
quest::addskill(12,255);
quest::addskill(41,255);
quest::addskill(49,255);
quest::addskill(54,255);
quest::addskill(70,255);
}
elsif ($text =~/spells/i)
{
quest::say ("Good, stand where you are while I begin your lessons");
quest::scribespells($ulevel);
}
}


Maybe this will help a little. I am not too sure of the double sub EVENT_SAY, but I know you can make it do what you want with only one.

I tested the script on my server and it works the way it should.

A side note for $ulevel, if someone already knows the spells UP to that level, and they go up and accidentally tells him "Spells" again, it will not relearn all the spells. Should there be an error with spells not working properly, you can add another line that will unscribe their spells, and then they can rescribe them should a spell or two not be in the book.


quest::unscribespells()