SetName(object, string)
From NWN Lexicon
Set the name of an object.
Contents |
[edit] Parameters
- oObject
- The object whose name is to be changed.
- sNewName
- The new name to give oObject.
[edit] Description
Set the name of oObject to sNewName. oObject can be a creature, placeable, item, or door.
[edit] Remarks
This will not work on player objects.
Setting an object's name to "" will make the object revert back to using the name it had originally had before any SetName() calls were made on the object.
[edit] Version
1.67
[edit] Example
// Tag-based script for an intelligent weapon. When the weapon is activated, // this will create a generic invisible object for the PC to talk to, but will // rename it to match the weapon that triggered the event. #include "x2_inc_switches" void main() { // Make sure this is the OnAtivateItem event if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return; object oPC = GetItemActivator(); // The player character using the item object oItem = GetItemActivated(); // The item being used object oInvis = CreateObject(OBJECT_TYPE_PLACEABLE, "x2_plc_intwp", GetLocation(oPC)); // Set the name of the invisible object to that of the item SetName(oInvis, GetName(oItem)); // Start the conversation AssignCommand(oPC, ActionStartConversation(oInvis, GetTag(oItem))); }
[edit] See Also
functions: | GetName |
author: Mistress