PDA

View Full Version : Race/class change + teleporter..


deaddraqear
04-05-2011, 01:06 AM
First off, I'm new and I'm very sure there is a WAY easier way to write this, but I don't know how to do it.. but w/e..

Anyway, it all worked just fine until I tried getting the teleports in.. Now, whenever I hail npc, she just turns to me but says nothing.. Any suggestions?



#############
#Quest Name: Human Race/Class Choice
#Author: KMFW
#NPCs Involved: 1
#Items Involved: 0
#################
###NPC 1
#Name: Tar Cordell
#Race: N/A
#Location: N/A
#Level: N/A
#Type: N/A
#Loot: N/A
#############


sub EVENT_SAY
{
my $help = quest::saylink("help");
my $race1 = quest::saylink("race");
my $class = quest::saylink("class");
my $barbarian = quest::saylink("barbarian");
my $erudite = quest::saylink("erudite");
my $woodelf = quest::saylink("wood elf");
my $highelf = quest::saylink("high elf");
my $darkelf = quest::saylink("dark elf");
my $halfelf = quest::saylink("halfelf");
my $dwarf = quest::saylink("dwarf");
my $troll = quest::saylink("troll");
my $ogre = quest::saylink("ogre");
my $halfling = quest::saylink("halfling");
my $gnome = quest::saylink("gnome");
my $iksar = quest::saylink("iksar");
my $froglok = quest::saylink("froglok");
my $drakkin = quest::saylink("drakkin");
my $cleric = quest::saylink("cleric");
my $enchanter = quest::saylink("enchanter");
my $magician = quest::saylink("magician");
my $monk = quest::saylink("monk");
my $necromancer = quest::saylink("necromancer");
my $paladin = quest::saylink("paladin");
my $rogue = quest::saylink("rogue");
my $shadowknight = quest::saylink("shadowknight");
my $warrior = quest::saylink("warrior");
my $wizard = quest::saylink("wizard");
my $home = quest::saylink("Go home");

if($text=~/hail/i)
{
if($race eq 'Human')
{
quest::say("Hello $name, I am here to $help humans in their training. Be advised, human bards, druids and rangers are not welcome in this world.");
}
else
{
quest::say("Ahh, hello $race. I cannot be of assistance to you at this time. Please seek out your current race trainer, who will surely be able to assist you in your race - class preferences. Be well.");
}
}
if($text=~/help/i)
{
if($race eq 'Human')
{
quest::say("I can change your $race1 or your $class. Be advised, both choices will remove you from this world for a short time. After all, you are being reborn. Upon returning to this world, return to me or your new race trainer, for further assistance. I can also send you $home");
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/race/i)
{
if($race eq 'Human')
{
quest::say("I can change you into any of the other races, besides Vah Shir. Your choices are $highelf, $erudite, $woodelf, $halfling, $barbarian, $gnome, $drakkin, $troll, $ogre, $halfelf, $dwarf, $iksar, $froglok and $darkelf.");
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/high elf/i)
{
if($race eq 'Human')
{
quest::permarace(5);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/dwarf/i)
{
if($race eq 'Human')
{
quest::permarace(8);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/wood elf/i)
{
if($race eq 'Human')
{
quest::permarace(4);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/halfling/i)
{
if($race eq 'Human')
{
quest::permarace(11);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/barbarian/i)
{
if($race eq 'Human')
{
quest::permarace(2);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/gnome/i)
{
if($race eq 'Human')
{
quest::permarace(12);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/drakkin/i)
{
if($race eq 'Human')
{
quest::permarace(522);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/troll/i)
{
if($race eq 'Human')
{
quest::permarace(9);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/ogre/i)
{
if($race eq 'Human')
{
quest::permarace(10);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/half elf/i)
{
if($race eq 'Human')
{
quest::permarace(17);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/froglok/i)
{
if($race eq 'Human')
{
quest::permarace(330);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/iksar/i)
{
if($race eq 'Human')
{
quest::permarace(128);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/erudite/i)
{
if($race eq 'Human')
{
quest::permarace(3);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/dark elf/i)
{
if($race eq 'Human')
{
quest::permarace(6);
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/class/i)
{
if($race eq 'Human')
{
quest::say("I can change you into the following classes; $wizard, $necromancer, $warrior, $cleric, $enchanter, $magician, $rogue, $shadowknight, $paladin and $monk.");
}
else
{
quest::say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/wizard/i)
{
if($race eq 'Human')
{
quest::setstat(0,75);
quest::setstat(1,90);
quest::setstat(2,75);
quest::setstat(3,75);
quest::setstat(4,110);
quest::setstat(5,75);
quest::setstat(6,75);
quest::permaclass(12);
}
else
{
quest:say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/necromancer/i)
{
if($race eq 'Human')
{
quest::setstat(0,75);
quest::setstat(1,80);
quest::setstat(2,75);
quest::setstat(3,85);
quest::setstat(4,110);
quest::setstat(5,75);
quest::setstat(6,75);
quest::permaclass(11);
}
else
{
quest:say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/warrior/i)
{
if($race eq 'Human')
{
quest::setstat(0,85);
quest::setstat(1,110);
quest::setstat(2,80);
quest::setstat(3,75);
quest::setstat(4,75);
quest::setstat(5,75);
quest::setstat(6,75);
quest::permaclass(1);
}
else
{
quest:say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/cleric/i)
{
if($race eq 'Human')
{
quest::setstat(0,80);
quest::setstat(1,85);
quest::setstat(2,75);
quest::setstat(3,75);
quest::setstat(4,75);
quest::setstat(5,110);
quest::setstat(6,75);
quest::permaclass(2);
}
else
{
quest:say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/enchanter/i)
{
if($race eq 'Human')
{
quest::setstat(0,75);
quest::setstat(1,75);
quest::setstat(2,75);
quest::setstat(3,75);
quest::setstat(4,90);
quest::setstat(5,75);
quest::setstat(6,110);
quest::permaclass(14);
}
else
{
quest:say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/magician/i)
{
if($race eq 'Human')
{
quest::setstat(0,75);
quest::setstat(1,90);
quest::setstat(2,75);
quest::setstat(3,75);
quest::setstat(4,110);
quest::setstat(5,75);
quest::setstat(6,75);
quest::permaclass(13);
}
else
{
quest:say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/rogue/i)
{
if($race eq 'Human')
{
quest::setstat(0,100);
quest::setstat(1,75);
quest::setstat(2,85);
quest::setstat(3,90);
quest::setstat(4,75);
quest::setstat(5,75);
quest::setstat(6,75);
quest::permaclass(9);
}
else
{
quest:say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/shadowknight/i)
{
if($race eq 'Human')
{
quest::setstat(0,85);
quest::setstat(1,100);
quest::setstat(2,75);
quest::setstat(3,75);
quest::setstat(4,85);
quest::setstat(5,75);
quest::setstat(6,80);
quest::permaclass(5);
}
else
{
quest:say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/paladin/i)
{
if($race eq 'Human')
{
quest::setstat(0,85);
quest::setstat(1,100);
quest::setstat(2,75);
quest::setstat(3,75);
quest::setstat(4,75);
quest::setstat(5,80);
quest::setstat(6,85);
quest::permaclass(3);
}
else
{
quest:say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/monk/i)
{
if($race eq 'Human')
{
quest::setstat(0,80);
quest::setstat(1,80);
quest::setstat(2,105);
quest::setstat(3,85);
quest::setstat(4,75);
quest::setstat(5,75);
quest::setstat(6,75);
quest::permaclass(7);
}
else
{
quest:say("I'm sorry $race, but you must speek with your race trainer.");
}
}
if($text=~/go home/i)
{
if(($race eq 'Human') && ($class eq 'Cleric'))
{
quest::movepc(2, 603.198, -132.003, -14);
}
if(($race eq 'Human') && ($class eq 'Paladin'))
{
quest::movepc(2, -678.183, -202.713, -14)
}
if(($race eq 'Human') && ($class eq 'Monk'))
{
quest::movepc(2, 301.081, 341.925, 0)
}
if(($race eq 'Human') && ($class eq 'Rogue'))
{
quest::movepc(2, 148.978 30.997 -31)
}
if(($race eq 'Human') && ($class eq 'Warrior'))
{
quest::movepc(1, -551.646, 56.166, 0)
}
if(($race eq 'Human') && ($class eq 'Wizard'))
{
quest::movepc(1, -674.143, 314.821, 0)
}
if(($race eq 'Human') && ($class eq 'Magician'))
{
quest::movepc(1, -665.487, 326.763, 1)
}
if(($race eq 'Human') && ($class eq 'Enchanter'))
{
quest::movepc(1, -664.904, 300.932, 1)
}
if(($race eq 'Human') && ($class eq 'Necromancer'))
{
quest::movepc(45, -303.112, 299.525, -41.969)
}
if(($race eq 'Human') && ($class eq 'Shadowknight'))
{
quest::movepc(45, -370.828, 429.554, -41.969)
}
}
}

ChaosSlayerZ
04-05-2011, 02:21 AM
First off, I'm new and I'm very sure there is a WAY easier way to write this, but I don't know how to do it.. but w/e..

Anyway, it all worked just fine until I tried getting the teleports in.. Now, whenever I hail npc, she just turns to me but says nothing.. Any suggestions?

when npc turns to you on hail but doesn't respond, it usually means there is some sort error in script that breaks the execution sequence - like missing (;) or wrong order/number of brackets, or incorrectly combination of IF and Else statements.

try breaking your script down to basic parts and get the min working, and then start adding piece by piece till it breaks again.

PS - wrong forum section btw - this section is for ORIGINAL LIVE quests only

deaddraqear
04-05-2011, 02:29 AM
Ahh, I apologize on wrong section, thank you for point that out, wont happen again..

I have broke it all down many times, and the error happens when i set add this at the bottom.. ive tried adding ; to end of movepc(x, x, x, x); ... I've added only 1 if((race) && (class)) and it works, I add a 2nd, it fails.. This basic sort of scripting not able to recognize 2 different if statements with multiple variables u think?


if($text=~/go home/i)
{
if(($race eq 'Human') && ($class eq 'Cleric'))
{
quest::movepc(2, 603.198, -132.003, -14)
}
if(($race eq 'Human') && ($class eq 'Paladin'))
{
quest::movepc(2, -678.183, -202.713, -14)
}
if(($race eq 'Human') && ($class eq 'Monk'))
{
quest::movepc(2, 301.081, 341.925, 0)
}
if(($race eq 'Human') && ($class eq 'Rogue'))
{
quest::movepc(2, 148.978 30.997 -31)
}
if(($race eq 'Human') && ($class eq 'Warrior'))
{
quest::movepc(1, -551.646, 56.166, 0)
}
if(($race eq 'Human') && ($class eq 'Wizard'))
{
quest::movepc(1, -674.143, 314.821, 0)
}
if(($race eq 'Human') && ($class eq 'Magician'))
{
quest::movepc(1, -665.487, 326.763, 1)
}
if(($race eq 'Human') && ($class eq 'Enchanter'))
{
quest::movepc(1, -664.904, 300.932, 1)
}
if(($race eq 'Human') && ($class eq 'Necromancer'))
{
quest::movepc(45, -303.112, 299.525, -41.969)
}
if(($race eq 'Human') && ($class eq 'Shadowknight'))
{
quest::movepc(45, -370.828, 429.554, -41.969)
}
}

lerxst2112
04-05-2011, 03:42 AM
Since all of those are testing for human, it would probably be easier to troubleshoot if you did something like this:

if($race eq 'Human')
{
if($class eq 'Cleric')
{
...
}
etc...
}

joligario
04-05-2011, 03:56 AM
And you need semicolons after each quest command.

deaddraqear
04-05-2011, 05:47 PM
Cant get npc to port, she will respond to all messages up until the teleport texts.. Copy/paste the exact teleport lines into a new npc, and he ports me just fine... so w/e..

Thx for the help on the checks and semicolons.. =)

pepsiphreak79
11-27-2011, 10:55 AM
Did you really get this working this is amazing Im setting up a private home server for me and my wifeand our kids and i want to use this to override class race restrictions...

Can you Please post whats needed to use this code on here?

like

dir/Filename.ext
code

dir/Filename.ext
code

I would love you forever lol

pepsiphreak79
11-28-2011, 11:47 PM
got it working but not ay teleporting