RandomName

From NWN Lexicon
Jump to: navigation, search



RandomName(int)

Generates a random name.

string RandomName(
    int nNameType = NAME_FIRST_GENERIC_MALE
);

Parameters

nNameType

NAME_*

Description

Generate a random name.



Remarks

Use RandomName(int) as the string inside of SetName() function to create a random name for a NPC.

//Use this custom function in a NPC script to set a random name if that creature is not undead or a playable race.
void RandomNameNPC(object oCreature)
{
    //Set this variable in the creatures variable properties to disable this feature
    if (GetLocalInt(OBJECT_SELF, "DISABLE_RANDOM_NAME") == 1) return;
    //If we are any of these racial types set a random name
    switch (GetRacialType(OBJECT_SELF))
    {
        case RACIAL_TYPE_ABERRATION:
        case RACIAL_TYPE_ANIMAL:
        case RACIAL_TYPE_BEAST:
        case RACIAL_TYPE_CONSTRUCT:
        case RACIAL_TYPE_DRAGON:
        case RACIAL_TYPE_ELEMENTAL:
        case RACIAL_TYPE_FEY:
        case RACIAL_TYPE_GIANT:
        case RACIAL_TYPE_HUMANOID_GOBLINOID:
        case RACIAL_TYPE_HUMANOID_MONSTROUS:
        case RACIAL_TYPE_HUMANOID_ORC:
        case RACIAL_TYPE_HUMANOID_REPTILIAN:
        case RACIAL_TYPE_MAGICAL_BEAST:
        case RACIAL_TYPE_OOZE:
        case RACIAL_TYPE_OUTSIDER:
        case RACIAL_TYPE_SHAPECHANGER:
        case RACIAL_TYPE_VERMIN: SetName(OBJECT_SELF, RandomName(NAME_ANIMAL));
        break;
    }
}


Version

1.67

See Also

constants: 

NAME_* Constants



 author: Tom Cassiotis, editor: Mistress