152 lines
6.7 KiB
Plaintext
152 lines
6.7 KiB
Plaintext
////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// Markshire's Nomenclature //
|
|
// //
|
|
// By Thrym of Markshire 5/21/06 //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// FUNCTION: //
|
|
// The Nomenclature is an include file placed in the spawn script //
|
|
// nw_c2_default9 designed to assign a name to a generic NPC who may //
|
|
// wander towns, roads, shops, etc. //
|
|
// //
|
|
// Utilizing both SetName and RandomName the system will name the NPC in //
|
|
// one of two ways ... //
|
|
// //
|
|
// "SET_NAME": By setting the variable "SET_NAME" on the NPC and //
|
|
// assigning it a string the creature will rename itself upon spawning. //
|
|
// This is handy for DM's and builders to create more precisely named //
|
|
// creatures for the palette and then generize them upon spawn. //
|
|
// //
|
|
// eg. Ancient White Dragon in the Creator becomes White Dragon on Spawn. //
|
|
// //
|
|
// "SET_NAME" = "RANDOM": By setting the same variable to the name "RANDOM" //
|
|
// the NPC then is given a random name generated by RACE and GENDER using //
|
|
// the RandomName function. //
|
|
// //
|
|
// eg. Male Dwarven Villager in the creator becomes Gloigan on spawn //
|
|
// this time and perhaps Rufus on the next spawned Villager. //
|
|
// //
|
|
// "NAME_TYPE": Setting this int variable to "1" will cause a Full Name //
|
|
// to be generated if the "SET_NAME" is set to "RANDOM". //
|
|
// //
|
|
// eg. Male Dwarven Villager becomes Gloigan Stonecutter or Rufus Mason. //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//void main (){}
|
|
|
|
///// FUNCTION DECLARATIONS ////////////////////////////////////////////////////
|
|
|
|
// Generates a Random First Name
|
|
// based on Race and Gender
|
|
// For all Standard PC Races and Animals
|
|
string ms_RandomFirstName(object oNPC = OBJECT_SELF);
|
|
|
|
// Generates a Random Last Name
|
|
// based on Race For all
|
|
// Standard PC Races and Animals
|
|
string ms_RandomLastName(object oNPC = OBJECT_SELF);
|
|
|
|
// Function designed to read the variable
|
|
// "SET_NAME" and assign a new name to the NPC
|
|
// If the variable is set to "RANDOM" a
|
|
// random name is assigned.
|
|
// A second variable can be assigned to
|
|
// have the random name be a random Full Name.
|
|
void ms_Nomenclature(object oNPC = OBJECT_SELF);
|
|
|
|
|
|
///// FUNCTIONS ////////////////////////////////////////////////////////////////
|
|
|
|
void ms_Nomenclature(object oNPC = OBJECT_SELF)
|
|
{
|
|
string sRandomName = GetLocalString(oNPC, "SET_NAME");
|
|
string sTitle = GetLocalString(oNPC, "TITLE");
|
|
string sPostfix = GetLocalString(oNPC, "POSTFIX");
|
|
|
|
if (sRandomName != "")
|
|
{
|
|
if (sRandomName == "RANDOM")
|
|
{
|
|
switch (GetLocalInt(oNPC, "NAME_TYPE"))
|
|
{
|
|
case 1: sRandomName = sTitle + " " + ms_RandomFirstName(oNPC) + " " + ms_RandomLastName(oNPC); break;
|
|
default: sRandomName = sTitle + " " + ms_RandomFirstName(oNPC); break;
|
|
}
|
|
}
|
|
|
|
SetName(oNPC, (sRandomName));
|
|
return;
|
|
}
|
|
}
|
|
|
|
string ms_RandomFirstName(object oNPC = OBJECT_SELF)
|
|
{
|
|
int Gender = GetGender(oNPC);
|
|
int Race = GetRacialType(oNPC);
|
|
|
|
string Name;
|
|
|
|
switch (Race)
|
|
{
|
|
case RACIAL_TYPE_ANIMAL: Name = RandomName(0); break;
|
|
case RACIAL_TYPE_DWARF:
|
|
switch (Gender)
|
|
{ default: Name = RandomName(2); break;
|
|
case GENDER_FEMALE: Name = RandomName(3); break; } break;
|
|
case RACIAL_TYPE_ELF:
|
|
switch (Gender)
|
|
{ default: Name = RandomName(5); break;
|
|
case GENDER_FEMALE: Name = RandomName(6); break; } break;
|
|
case RACIAL_TYPE_GNOME:
|
|
switch (Gender)
|
|
{ default: Name = RandomName(8); break;
|
|
case GENDER_FEMALE: Name = RandomName(9); break; } break;
|
|
case RACIAL_TYPE_HALFELF:
|
|
switch (Gender)
|
|
{ default: Name = RandomName(11); break;
|
|
case GENDER_FEMALE: Name = RandomName(12); break; } break;
|
|
case RACIAL_TYPE_HALFLING:
|
|
switch (Gender)
|
|
{ default: Name = RandomName(14); break;
|
|
case GENDER_FEMALE: Name = RandomName(15); break; } break;
|
|
case RACIAL_TYPE_HALFORC:
|
|
switch (Gender)
|
|
{ default: Name = RandomName(17); break;
|
|
case GENDER_FEMALE: Name = RandomName(18); break; } break;
|
|
case RACIAL_TYPE_HUMAN:
|
|
switch (Gender)
|
|
{ default: Name = RandomName(20); break;
|
|
case GENDER_FEMALE: Name = RandomName(21); break; } break;
|
|
default:
|
|
switch (Gender)
|
|
{ default: Name = RandomName(-1); break;
|
|
case GENDER_FEMALE: Name = RandomName(0); break; } break;
|
|
}
|
|
|
|
return Name;
|
|
}
|
|
|
|
string ms_RandomLastName(object oNPC = OBJECT_SELF)
|
|
{
|
|
int Race = GetRacialType(oNPC);
|
|
|
|
string Name;
|
|
|
|
switch (Race)
|
|
{
|
|
case RACIAL_TYPE_DWARF: Name = RandomName(4); break;
|
|
case RACIAL_TYPE_ELF: Name = RandomName(7); break;
|
|
case RACIAL_TYPE_GNOME: Name = RandomName(10); break;
|
|
case RACIAL_TYPE_HALFELF: Name = RandomName(13); break;
|
|
case RACIAL_TYPE_HALFLING: Name = RandomName(16); break;
|
|
case RACIAL_TYPE_HALFORC: Name = RandomName(19); break;
|
|
case RACIAL_TYPE_HUMAN: Name = RandomName(22); break;
|
|
default: Name = RandomName(1); break;
|
|
}
|
|
|
|
return Name;
|
|
}
|