GetRacialType

From NWN Lexicon



Contents

[edit] GetRacialType(object)

Determines the race of a creature.

int GetRacialType(
    object oCreature
);

[edit] Parameters

oCreature

The creature whose race we are interested in.


[edit] Description

Returns the racial type (RACIAL_TYPE_*) of oCreature and RACIAL_TYPE_INVALID If oCreature is invalid.



[edit] Remarks

this is most useful, no, the best function, if only, for getting thier race. It mearly returns a value from the racialtypes.2da file, and so new races can be added in sucessfully.

This is widly used in most conversations, and places where race relations comes into play. Giving a special conversation option to cirtain races, and getting NPC's to react accordingly according to race, it usually a good way to add some depth to a world.


[edit] Known Bugs

1.64 makes sure that RACIAL_TYPE_INVALID is returned for any invalid object type when using this function.


[edit] Version

1.64

[edit] Example

// Area transition script
// Dwarves go to "MORIA",
// Everybody else goes to the default transition
// (I know, stupid example, but still...)
void main()
{
    object oPC=GetClickingObject();
 
    object oTarget;
 
    if (GetRacialType(oPC)==RACIAL_TYPE_DWARF)
    {
        oTarget = GetObjectByTag("MORIA");
    }
    else
    {
        oTarget = GetTransitionTarget(OBJECT_SELF);
    }
    AssignCommand(oPC, JumpToObject(oTarget));
}

[edit] See Also

constants: 

RACIAL_TYPE_* Constants



 author: Tom Cassiotis, editor: Jasperre, additional contributor(s): Lilac Soul, Jasperre
 

Personal tools
Categories