PDA

View Full Version : Detect and Convert Disallowed Race/Class


Neiv
11-30-2008, 05:53 PM
I thought I'd submit this for others who might use it. I have asked (and have seen asked) in this forum about how to limit the available classes/races of PCs for a custom world. The standard answer is to turn off newer expansions; but in a custom world like mine, that does not really solve the issue (since some classes/races are disallowed in my world that are part of the older expansions, and some newer classes/races are allowed). To solve that problem, I have created my own tutorial zone using the Nektulos, and have written a script (inspired by Trevius' Reward script) for the main quest NPC in the zone. Since my version of Nektulos has no zone exits, it works perfectly for this (players cannot leave until they complete the quests and are rebound [quest:rebind(zone_id,x,y,z)] and zoned to a new starting zone at the end by the main quest NPC).

I don't know whether something like this has been written before; but if it, has I have not seen it. I'm including only the Detect and Convert script; not the rest of the quest scripts (they can be anything you want them to be in your own tutorial). The Detect and Convert script works this way:

1. Player creates character at character-creation screen (any race/class)

2. Player enters custom tutorial (just be sure to enter the new start zone for all players in the Variables table of the DB and that is where everyone will go)

3. Player passes by the main quest NPC, entering his proximity; NPC coaxes player to come speak with him.

4. Player hails NPC and is told he is of an unacceptable race/class, and that he will be unable to advance in the world as that race/class.

5. NPC instructs player to enter an acceptable race/class, whereupon NPC changes player race/class to the new race/class (you can adjust the script to conform to your own acceptable races/classes).

6. Players are now able to complete quests in the Tutorial and be ported to their new home.

Here 'tis . . .

#############
#Quest Name: Tutorial Conversion to Allowable PC Race-Class
#Author: Neiv
#NPCs Involved: 1
#Items Involved: 0
#################
###NPC 1
#Name: Stagadar (can be any NPC)
#Race: N/A
#Location: N/A
#Level: N/A
#Type: N/A
#Loot: N/A
#############

sub EVENT_SPAWN
{
$x = $npc->GetX();
$y = $npc->GetY();
quest::set_proximity($x - 90, $x + 90, $y - 90, $y + 90);
}

sub EVENT_ENTER
{
quest::say("You will do well, $name, to speak with me. Come closer, target me and press 'H'.");
}

sub EVENT_SAY
{
if($text=~/hail/i)
{
if(($class ne 'Shaman' && $class ne 'Magician' && $class ne 'Wizard' && $class ne 'Enchanter' && $class ne 'Cleric' && $class ne 'Shadow Knight' && $class ne 'Druid' && $class ne 'Necromancer') && ($race ne 'Iksar' && $race ne 'Troll' && $race ne 'Ogre' && $race ne 'Dark Elf' && $race ne 'Froklok' && $race ne 'Gnome' && $race ne 'Vah Shir'))

#Allows the following: (($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord') && ($race == 'Human' || $race == 'Barbarian' || $race == 'Erudite' || $race == 'High Elf' || $race == 'Wood Elf' || $race == 'Half Elf' || $race == 'Dwarf' || $race == 'Halfling'))
{
quest::say("Hail, $name. I am Stagadar, known in Ronilav as a great help to the free peoples of the Realm. I am here as your [tutor].");
}
else
{
quest::say("Your race-class combination is unacceptable in our world, $name. You look to be some sort of $race - $class. Acceptable races are Human, Barbarian, Erudite, High Elf, Wood Elf, Half Elf, Dwarf, and Hafling. Acceptable classes are Warrior, Paladin, Ranger, Monk, Bard, Rogue, Beastlord, and Berserker. No other races and classes are able to advance in our world. If you need to change race or class, tell me the race or class you would like to be. If you need to change both, tell me first the race you would like to be. After that matter has been settled, you can tell me the class you would like to be separately. Be aware that each time I change your race or class you will be removed from this world for a brief period.");
}
}
if($text=~/human/i)
{
quest::permarace(1);
}
if($text=~/barbarian/i)
{
quest::permarace(2);
}
if($text=~/erudite/i)
{
quest::permarace(3);
}
if($text=~/high elf/i)
{
quest::permarace(5);
}
if($text=~/wood elf/i)
{
quest::permarace(4);
}
if($text=~/half elf/i)
{
quest::permarace(7);
}
if($text=~/dwarf/i)
{
quest::permarace(8);
}
if($text=~/halfling/i)
{
quest::permarace(11);
}
if($text=~/warrior/i)
{
quest::permaclass(1);
}
if($text=~/paladin/i)
{
quest::permaclass(3);
}
if($text=~/ranger/i)
{
quest::permaclass(4);
}
if($text=~/monk/i)
{
quest::permaclass(7);
}
if($text=~/bard/i)
{
quest::permaclass(8);
}
if($text=~/rogue/i)
{
quest::permaclass(9);
}
if($text=~/beastlord/i)
{
quest::permaclass(15);
}
if($text=~/berserker/i)
{
quest::permaclass(16);
}
}

Yeormom
11-30-2008, 07:16 PM
Thanks for sharing!