Started up my server recently and am doing a lot of quest/database/code testing. Here is just a simple translocator I use for my Master Translocator NPC:
Note: The "training" option is for a not yet implemented wizard quest. PoKnowledge is blocked in the quest for my server. The #zonestart command is a custom command I added to teleport back to the start area. The translocator will teleport you to any valid short name zone you give it except PoKnowledge/Sunset Home (Which can be changed, of course.). There are no error checking in this version. Here it is:
Code:
sub EVENT_SAY {
if ($text=~/hail/i) {
if ($class =~ Wizard) {
quest::say("Greetings $name, do you seek [training] to become a High $class? Or just need to be [translocated] somewhere?");
}
else {
quest::say("Hello mortal. Do you seek to be [translocated] somewhere?");
}
}
elsif ($text=~/training/i) {
if ($class =~ Wizard) {
quest::say("I have no tasks for you today to become a High $class.");
}
}
elsif ($text=~/translocated/i) {
quest::say("State the short name of the zone you wish to go.");
$port0 = 1;
$teleName = $name;
}
else {
if ($port0 =~ 1) {
$portApproved = 1;
if ($text =~ poknowledge || $text =~ cshome) {
$portApproved = 0;
}
if ($portApproved =~ 1) {
if ($teleName =~ $name) {
quest::say("$name has been approved for translocation to $text.");
quest::say("Attempting to teleport $name to $text.");
quest::say("Remember, to teleport back to Crushbone say #zonestart.");
quest::zone($text);
}
}
else {
quest::say("Translocation to $text is not possible, $name.");
}
$port0 = 0;
$teleName = "";
}
}
}
}
sub EVENT_ATTACK {
quest::emote("laughs at you.");
quest::say("None shall defeat the mighty Elite Squads.");
}
sub EVENT_DEATH {
quest::say("This...is...impossi--");
quest::me("You hear Solusek Ro's name chanted quietly, as High Wizard Vivi's remains disappears.);
}
sub EVENT_SLAY {
quest::say("None shall fight the High Wizard Council and live to tell the tale!");
}
Hope it helps!