GetName(object, int)
Retrieves the name of an object.
Parameters
- oObject
- Object who's name is sought.
- bOriginalName
- If set to TRUE any new name specified via SetName() is ignored and the original object's name is returned instead. (Default: FALSE)
Description
Returns the first and last name of oObject. In the case of creatures, returns first and last names together as single concatenated string (with a space provided in the middle).
Remarks
For most objects GetName() returns their usual name field. This includes otherwise inaccessible objects like stores or waypoints which can be useful for debugging.
For items, GetName() returns the identified name, whether or not the item is identified. That name is not what a player would see. To return a generic name for an unidentified item, the example may be useful.
Version
This function was updated in 1.88.8193.36 of NWN:EE. Fixed GetName() description in nwscript.nss.
Example
void main()
{
object oPC = GetFirstPC();
// Get the nearest item
object oItem = GetNearestObject(OBJECT_TYPE_ITEM, oPC);
if ( GetIdentified(oItem) )
SendMessageToPC(oPC, "The item nearest you: "+GetName(oItem));
else
{
int nBaseType = GetBaseItemType(oItem);
string sGenericName = GetStringByStrRef(StringToInt(Get2DAString("baseitems", "Name", nBaseType)));
SendMessageToPC(oPC, "The item nearest you: "+sGenericName);
}
}
See Also
functions: |
author: Kristian Markon, editor: Lilac Soul, Mistress, additional contributor(s): Simon Damberger, Lilac Soul