NWNX:EE  8193.36.12
Object

Readme

Functions exposing additional object properties

Files

file  nwnx_object.nss
 

Classes

struct  NWNX_Object_LocalVariable
 A local variable structure. More...
 

Functions

int NWNX_Object_GetLocalVariableCount (object obj)
 Gets the count of all local variables. More...
 
struct NWNX_Object_LocalVariable NWNX_Object_GetLocalVariable (object obj, int index)
 Gets the local variable at the provided index of the provided object. More...
 
void NWNX_Object_SetPosition (object oObject, vector vPosition, int bUpdateSubareas=TRUE)
 Set oObject's position. More...
 
int NWNX_Object_GetCurrentHitPoints (object obj)
 Get an object's hit points. More...
 
void NWNX_Object_SetCurrentHitPoints (object obj, int hp)
 Set an object's hit points. More...
 
void NWNX_Object_SetMaxHitPoints (object obj, int hp)
 Adjust an object's maximum hit points. More...
 
string NWNX_Object_Serialize (object obj)
 Serialize a full object to a base64 string. More...
 
object NWNX_Object_Deserialize (string serialized)
 Deserialize the object. More...
 
string NWNX_Object_GetDialogResref (object obj)
 Gets the dialog resref. More...
 
void NWNX_Object_SetDialogResref (object obj, string dialog)
 Sets the dialog resref. More...
 
void NWNX_Object_SetAppearance (object oPlaceable, int nAppearance)
 Set oPlaceable's appearance. More...
 
int NWNX_Object_GetAppearance (object oPlaceable)
 Get oPlaceable's appearance. More...
 
int NWNX_Object_GetHasVisualEffect (object obj, int nVFX)
 Determine if an object has a visual effect. More...
 
int NWNX_Object_GetDamageImmunity (object obj, int damageType)
 Get an object's damage immunity. More...
 
void NWNX_Object_AddToArea (object obj, object area, vector pos)
 Add or move an object. More...
 
int NWNX_Object_GetPlaceableIsStatic (object obj)
 Get placeable's static setting. More...
 
void NWNX_Object_SetPlaceableIsStatic (object obj, int isStatic)
 Set placeable as static or not. More...
 
int NWNX_Object_GetAutoRemoveKey (object obj)
 Gets if a door/placeable auto-removes the key after use. More...
 
void NWNX_Object_SetAutoRemoveKey (object obj, int bRemoveKey)
 Sets if a door/placeable auto-removes the key after use. More...
 
string NWNX_Object_GetTriggerGeometry (object oTrigger)
 Get the geometry of a trigger. More...
 
void NWNX_Object_SetTriggerGeometry (object oTrigger, string sGeometry)
 Set the geometry of a trigger with a list of vertex positions. More...
 
void NWNX_Object_Export (object oObject, string sFileName, string sAlias="NWNX")
 Export an object to the UserDirectory/nwnx folder. More...
 
int NWNX_Object_GetInt (object oObject, string sVarName)
 Get oObject's integer variable sVarName. More...
 
void NWNX_Object_SetInt (object oObject, string sVarName, int nValue, int bPersist)
 Set oObject's integer variable sVarName to nValue. More...
 
void NWNX_Object_DeleteInt (object oObject, string sVarName)
 Delete oObject's integer variable sVarName. More...
 
string NWNX_Object_GetString (object oObject, string sVarName)
 Get oObject's string variable sVarName. More...
 
void NWNX_Object_SetString (object oObject, string sVarName, string sValue, int bPersist)
 Set oObject's string variable sVarName to sValue. More...
 
void NWNX_Object_DeleteString (object oObject, string sVarName)
 Delete oObject's string variable sVarName. More...
 
float NWNX_Object_GetFloat (object oObject, string sVarName)
 Get oObject's float variable sVarName. More...
 
void NWNX_Object_SetFloat (object oObject, string sVarName, float fValue, int bPersist)
 Set oObject's float variable sVarName to fValue. More...
 
void NWNX_Object_DeleteFloat (object oObject, string sVarName)
 Delete oObject's persistent float variable sVarName. More...
 
void NWNX_Object_DeleteVarRegex (object oObject, string sRegex)
 Delete any variables that match sRegex. More...
 
int NWNX_Object_GetPositionIsInTrigger (object oTrigger, vector vPosition)
 Get if vPosition is inside oTrigger's geometry. More...
 
int NWNX_Object_GetInternalObjectType (object oObject)
 Gets the given object's internal type (NWNX_OBJECT_TYPE_INTERNAL_*) More...
 
int NWNX_Object_AcquireItem (object oObject, object oItem)
 Have oObject acquire oItem. More...
 
void NWNX_Object_ClearSpellEffectsOnOthers (object oObject)
 Clear all spell effects oObject has applied to others. More...
 
string NWNX_Object_PeekUUID (object oObject)
 Peek at the UUID of oObject without assigning one if it does not have one. More...
 
int NWNX_Object_GetDoorHasVisibleModel (object oDoor)
 Get if oDoor has a visible model. More...
 
int NWNX_Object_GetIsDestroyable (object oObject)
 Get if oObject is destroyable. More...
 
int NWNX_Object_DoSpellImmunity (object oDefender, object oCaster, int nSpellId=-1)
 Checks for specific spell immunity. Should only be called in spellscripts. More...
 
int NWNX_Object_DoSpellLevelAbsorption (object oDefender, object oCaster, int nSpellId=-1, int nSpellLevel=-1, int nSpellSchool=-1)
 Checks for spell school/level immunities and mantles. Should only be called in spellscripts. More...
 
void NWNX_Object_SetHasInventory (object obj, int bHasInventory)
 Sets if a placeable has an inventory. More...
 
int NWNX_Object_GetCurrentAnimation (object oObject)
 Get the current animation of oObject. More...
 
int NWNX_Object_GetAILevel (object oObject)
 Gets the AI level of an object. More...
 
void NWNX_Object_SetAILevel (object oObject, int nLevel)
 Sets the AI level of an object. More...
 
string NWNX_Object_GetMapNote (object oObject, int nID=0, int nGender=0)
 Retrieves the Map Note (AKA Map Pin) from a waypoint - Returns even if currently disabled. More...
 
void NWNX_Object_SetMapNote (object oObject, string sMapNote, int nID=0, int nGender=0)
 Sets a Map Note (AKA Map Pin) to any waypoint, even if no previous map note. Only updates for clients on area-load. Use SetMapPinEnabled() as required. More...
 
int NWNX_Object_GetLastSpellCastFeat (object oObject)
 Gets the last spell cast feat of oObject. More...
 
void NWNX_Object_SetLastTriggered (object oObject, object oLast)
 Sets the last object that triggered door or placeable trap. More...
 
float NWNX_Object_GetAoEObjectDurationRemaining (object oAoE)
 Gets the remaining duration of the AoE object. More...
 
void NWNX_Object_SetConversationPrivate (object oObject, int bPrivate)
 Sets conversations started by oObject to be private or not. More...
 
void NWNX_Object_SetAoEObjectRadius (object oAoE, float fRadius)
 Sets the radius of a circle AoE object. More...
 
float NWNX_Object_GetAoEObjectRadius (object oAoE)
 Gets the radius of a circle AoE object. More...
 
int NWNX_Object_GetLastSpellCastSpontaneous (object oObject)
 Gets whether the last spell cast of oObject was spontaneous. More...
 
int NWNX_Object_GetLastSpellCastDomainLevel (object oObject)
 Gets the last spell cast domain level. More...
 
void NWNX_Object_ForceAssignUUID (object oObject, string sUUID)
 Force the given object to carry the given UUID. Any other object currently owning the UUID is stripped of it. More...
 
int NWNX_Object_GetInventoryItemCount (object oObject)
 Returns how many items are in oObject's inventory. More...
 
void NWNX_Object_OverrideSpellProjectileVFX (object oCreature, int nProjectileType=-1, int nProjectilePathType=-1, int nSpellID=-1, int bPersist=FALSE)
 Override the projectile visual effect of ranged/throwing weapons and spells. More...
 
int NWNX_Object_GetLastSpellInstant ()
 Returns TRUE if the last spell was cast instantly. This function should only be called in a spell script. More...
 
void NWNX_Object_SetTrapCreator (object oObject, object oCreator)
 Sets the creator of a trap on door, placeable, or trigger. Also changes trap Faction to that of the new Creator. More...
 
string NWNX_Object_GetLocalizedName (object oObject, int nLanguage, int nGender=0)
 Return the name of the object for nLanguage. More...
 
void NWNX_Object_SetLocalizedName (object oObject, string sName, int nLanguage, int nGender=0)
 Set the name of the object as set in the toolset for nLanguage. More...
 

Function Documentation

◆ NWNX_Object_GetLocalVariableCount()

int NWNX_Object_GetLocalVariableCount ( object  obj)

Gets the count of all local variables.

Parameters
objThe object.
Returns
The count.

Definition at line 438 of file nwnx_object.nss.

◆ NWNX_Object_GetLocalVariable()

struct NWNX_Object_LocalVariable NWNX_Object_GetLocalVariable ( object  obj,
int  index 
)

Gets the local variable at the provided index of the provided object.

Parameters
objThe object.
indexThe index.
Note
Index bounds: 0 >= index < NWNX_Object_GetLocalVariableCount().
As of build 8193.14 local variables no longer have strict ordering. this means that any change to the variables can result in drastically different order when iterating.
As of build 8193.14, this function takes O(n) time, where n is the number of locals on the object. Individual variable access with GetLocalXxx() is now O(1) though.
As of build 8193.14, this function will not return a variable if the value is the default (0/0.0/""/OBJECT_INVALID/JsonNull()) for the type. They are considered not set.
Will return type UNKNOWN for cassowary variables.
Returns
An NWNX_Object_LocalVariable struct.

Definition at line 448 of file nwnx_object.nss.

◆ NWNX_Object_SetPosition()

void NWNX_Object_SetPosition ( object  oObject,
vector  vPosition,
int  bUpdateSubareas = TRUE 
)

Set oObject's position.

Parameters
oObjectThe object.
vPositionA vector position.
bUpdateSubareasIf TRUE and oObject is a creature, any triggers/traps at vPosition will fire their events.

Definition at line 462 of file nwnx_object.nss.

◆ NWNX_Object_GetCurrentHitPoints()

int NWNX_Object_GetCurrentHitPoints ( object  obj)

Get an object's hit points.

Note
Unlike the native GetCurrentHitpoints function, this excludes temporary hitpoints.
Parameters
objThe object.
Returns
The hit points.

Definition at line 475 of file nwnx_object.nss.

◆ NWNX_Object_SetCurrentHitPoints()

void NWNX_Object_SetCurrentHitPoints ( object  obj,
int  hp 
)

Set an object's hit points.

Parameters
objThe object.
hpThe hit points.

Definition at line 485 of file nwnx_object.nss.

◆ NWNX_Object_SetMaxHitPoints()

void NWNX_Object_SetMaxHitPoints ( object  obj,
int  hp 
)

Adjust an object's maximum hit points.

Note
Will not work on PCs.
Parameters
objThe object.
hpThe maximum hit points.

Definition at line 495 of file nwnx_object.nss.

◆ NWNX_Object_Serialize()

string NWNX_Object_Serialize ( object  obj)

Serialize a full object to a base64 string.

Parameters
objThe object.
Returns
A base64 string representation of the object.
Note
includes locals, inventory, etc

Definition at line 505 of file nwnx_object.nss.

◆ NWNX_Object_Deserialize()

object NWNX_Object_Deserialize ( string  serialized)

Deserialize the object.

Note
The object will be created outside of the world and needs to be manually positioned at a location/inventory.
Parameters
serializedThe base64 string.
Returns
The object.

Definition at line 515 of file nwnx_object.nss.

◆ NWNX_Object_GetDialogResref()

string NWNX_Object_GetDialogResref ( object  obj)

Gets the dialog resref.

Parameters
objThe object.
Returns
The name of the dialog resref.

Definition at line 525 of file nwnx_object.nss.

◆ NWNX_Object_SetDialogResref()

void NWNX_Object_SetDialogResref ( object  obj,
string  dialog 
)

Sets the dialog resref.

Parameters
objThe object.
dialogThe name of the dialog resref.

Definition at line 535 of file nwnx_object.nss.

◆ NWNX_Object_SetAppearance()

void NWNX_Object_SetAppearance ( object  oPlaceable,
int  nAppearance 
)

Set oPlaceable's appearance.

Note
Will not update for PCs until they re-enter the area.
Parameters
oPlaceableThe placeable.
nAppearanceThe appearance id.

Definition at line 545 of file nwnx_object.nss.

◆ NWNX_Object_GetAppearance()

int NWNX_Object_GetAppearance ( object  oPlaceable)

Get oPlaceable's appearance.

Parameters
oPlaceableThe placeable.
Returns
The appearance id.

Definition at line 555 of file nwnx_object.nss.

◆ NWNX_Object_GetHasVisualEffect()

int NWNX_Object_GetHasVisualEffect ( object  obj,
int  nVFX 
)

Determine if an object has a visual effect.

Parameters
objThe object.
nVFXThe visual effect id.
Returns
TRUE if the object has the visual effect applied to it

Definition at line 565 of file nwnx_object.nss.

◆ NWNX_Object_GetDamageImmunity()

int NWNX_Object_GetDamageImmunity ( object  obj,
int  damageType 
)

Get an object's damage immunity.

Parameters
objThe object.
damageTypeThe damage type to check for immunity. Use DAMAGE_TYPE_* constants.
Returns
Damage immunity as a percentage.

Definition at line 577 of file nwnx_object.nss.

◆ NWNX_Object_AddToArea()

void NWNX_Object_AddToArea ( object  obj,
object  area,
vector  pos 
)

Add or move an object.

Parameters
objThe object.
areaThe area.
posThe position.

Definition at line 589 of file nwnx_object.nss.

◆ NWNX_Object_GetPlaceableIsStatic()

int NWNX_Object_GetPlaceableIsStatic ( object  obj)

Get placeable's static setting.

Parameters
objThe object.
Returns
TRUE if placeable is static.

Definition at line 601 of file nwnx_object.nss.

◆ NWNX_Object_SetPlaceableIsStatic()

void NWNX_Object_SetPlaceableIsStatic ( object  obj,
int  isStatic 
)

Set placeable as static or not.

Note
Will not update for PCs until they re-enter the area.
Parameters
objThe object.
isStaticTRUE/FALSE

Definition at line 611 of file nwnx_object.nss.

◆ NWNX_Object_GetAutoRemoveKey()

int NWNX_Object_GetAutoRemoveKey ( object  obj)

Gets if a door/placeable auto-removes the key after use.

Parameters
objThe object.
Returns
TRUE/FALSE or -1 on error.

Definition at line 621 of file nwnx_object.nss.

◆ NWNX_Object_SetAutoRemoveKey()

void NWNX_Object_SetAutoRemoveKey ( object  obj,
int  bRemoveKey 
)

Sets if a door/placeable auto-removes the key after use.

Parameters
objThe object.
bRemoveKeyTRUE/FALSE

Definition at line 631 of file nwnx_object.nss.

◆ NWNX_Object_GetTriggerGeometry()

string NWNX_Object_GetTriggerGeometry ( object  oTrigger)

Get the geometry of a trigger.

Parameters
oTriggerThe trigger object.
Returns
A string of vertex positions.

Definition at line 641 of file nwnx_object.nss.

◆ NWNX_Object_SetTriggerGeometry()

void NWNX_Object_SetTriggerGeometry ( object  oTrigger,
string  sGeometry 
)

Set the geometry of a trigger with a list of vertex positions.

Parameters
oTriggerThe trigger object.
sGeometryNeeds to be in the following format -> {x.x, y.y, z.z} or {x.x, y.y} Example Geometry: "{1.0, 1.0, 0.0}{4.0, 1.0, 0.0}{4.0, 4.0, 0.0}{1.0, 4.0, 0.0}"
Remarks
The Z position is optional and will be calculated dynamically based on terrain height if it's not provided.
The minimum number of vertices is 3.

Definition at line 651 of file nwnx_object.nss.

◆ NWNX_Object_Export()

void NWNX_Object_Export ( object  oObject,
string  sFileName,
string  sAlias = "NWNX" 
)

Export an object to the UserDirectory/nwnx folder.

Parameters
sFileNameThe filename without extension, 16 or less characters.
oObjectThe object to export. Valid object types: Creature, Item, Placeable, Waypoint, Door, Store, Trigger
sAliasThe alias of the resource directory to add the .git file to. Default: UserDirectory/nwnx

Definition at line 660 of file nwnx_object.nss.

◆ NWNX_Object_GetInt()

int NWNX_Object_GetInt ( object  oObject,
string  sVarName 
)

Get oObject's integer variable sVarName.

Parameters
oObjectThe object to get the variable from.
sVarNameThe variable name.
Returns
The value or 0 on error.

Definition at line 670 of file nwnx_object.nss.

◆ NWNX_Object_SetInt()

void NWNX_Object_SetInt ( object  oObject,
string  sVarName,
int  nValue,
int  bPersist 
)

Set oObject's integer variable sVarName to nValue.

Parameters
oObjectThe object to set the variable on.
sVarNameThe variable name.
nValueThe integer value to to set
bPersistWhen TRUE, the value is persisted to GFF, this means that it'll be saved in the .bic file of a player's character or when an object is serialized.

Definition at line 681 of file nwnx_object.nss.

◆ NWNX_Object_DeleteInt()

void NWNX_Object_DeleteInt ( object  oObject,
string  sVarName 
)

Delete oObject's integer variable sVarName.

Parameters
oObjectThe object to delete the variable from.
sVarNameThe variable name.

Definition at line 692 of file nwnx_object.nss.

◆ NWNX_Object_GetString()

string NWNX_Object_GetString ( object  oObject,
string  sVarName 
)

Get oObject's string variable sVarName.

Parameters
oObjectThe object to get the variable from.
sVarNameThe variable name.
Returns
The value or "" on error.

Definition at line 701 of file nwnx_object.nss.

◆ NWNX_Object_SetString()

void NWNX_Object_SetString ( object  oObject,
string  sVarName,
string  sValue,
int  bPersist 
)

Set oObject's string variable sVarName to sValue.

Parameters
oObjectThe object to set the variable on.
sVarNameThe variable name.
sValueThe string value to to set
bPersistWhen TRUE, the value is persisted to GFF, this means that it'll be saved in the .bic file of a player's character or when an object is serialized.

Definition at line 712 of file nwnx_object.nss.

◆ NWNX_Object_DeleteString()

void NWNX_Object_DeleteString ( object  oObject,
string  sVarName 
)

Delete oObject's string variable sVarName.

Parameters
oObjectThe object to delete the variable from.
sVarNameThe variable name.

Definition at line 723 of file nwnx_object.nss.

◆ NWNX_Object_GetFloat()

float NWNX_Object_GetFloat ( object  oObject,
string  sVarName 
)

Get oObject's float variable sVarName.

Parameters
oObjectThe object to get the variable from.
sVarNameThe variable name.
Returns
The value or 0.0f on error.

Definition at line 732 of file nwnx_object.nss.

◆ NWNX_Object_SetFloat()

void NWNX_Object_SetFloat ( object  oObject,
string  sVarName,
float  fValue,
int  bPersist 
)

Set oObject's float variable sVarName to fValue.

Parameters
oObjectThe object to set the variable on.
sVarNameThe variable name.
fValueThe float value to to set
bPersistWhen TRUE, the value is persisted to GFF, this means that it'll be saved in the .bic file of a player's character or when an object is serialized.

Definition at line 743 of file nwnx_object.nss.

◆ NWNX_Object_DeleteFloat()

void NWNX_Object_DeleteFloat ( object  oObject,
string  sVarName 
)

Delete oObject's persistent float variable sVarName.

Parameters
oObjectThe object to delete the variable from.
sVarNameThe variable name.

Definition at line 754 of file nwnx_object.nss.

◆ NWNX_Object_DeleteVarRegex()

void NWNX_Object_DeleteVarRegex ( object  oObject,
string  sRegex 
)

Delete any variables that match sRegex.

Note
It will only remove variables set by NWNX_Object_Set{Int|String|Float}()
Parameters
oObjectThe object to delete the variables from.
sRegexThe regular expression, for example .*Test.* removes every variable that has Test in it.

Definition at line 763 of file nwnx_object.nss.

◆ NWNX_Object_GetPositionIsInTrigger()

int NWNX_Object_GetPositionIsInTrigger ( object  oTrigger,
vector  vPosition 
)

Get if vPosition is inside oTrigger's geometry.

Note
The Z value of vPosition is ignored.
Parameters
oTriggerThe trigger.
vPositionThe position.
Returns
TRUE if vPosition is inside oTrigger's geometry.

Definition at line 772 of file nwnx_object.nss.

◆ NWNX_Object_GetInternalObjectType()

int NWNX_Object_GetInternalObjectType ( object  oObject)

Gets the given object's internal type (NWNX_OBJECT_TYPE_INTERNAL_*)

Parameters
oObjectThe object.
Returns
The object's type (NWNX_OBJECT_TYPE_INTERNAL_*)

Definition at line 785 of file nwnx_object.nss.

◆ NWNX_Object_AcquireItem()

int NWNX_Object_AcquireItem ( object  oObject,
object  oItem 
)

Have oObject acquire oItem.

Note
Useful to give deserialized items to an object, may not work if oItem is already possessed by an object.
Parameters
oObjectThe object receiving oItem, must be a Creature, Placeable, Store or Item
oItemThe item.
Returns
TRUE on success.

Definition at line 795 of file nwnx_object.nss.

◆ NWNX_Object_ClearSpellEffectsOnOthers()

void NWNX_Object_ClearSpellEffectsOnOthers ( object  oObject)

Clear all spell effects oObject has applied to others.

Parameters
oObjectThe object that applied the spell effects.

Definition at line 806 of file nwnx_object.nss.

◆ NWNX_Object_PeekUUID()

string NWNX_Object_PeekUUID ( object  oObject)

Peek at the UUID of oObject without assigning one if it does not have one.

Parameters
oObjectThe object
Returns
The UUID or "" when the object does not have or cannot have an UUID

Definition at line 814 of file nwnx_object.nss.

◆ NWNX_Object_GetDoorHasVisibleModel()

int NWNX_Object_GetDoorHasVisibleModel ( object  oDoor)

Get if oDoor has a visible model.

Parameters
oDoorThe door
Returns
TRUE if oDoor has a visible model

Definition at line 824 of file nwnx_object.nss.

◆ NWNX_Object_GetIsDestroyable()

int NWNX_Object_GetIsDestroyable ( object  oObject)

Get if oObject is destroyable.

Parameters
oObjectThe object
Returns
TRUE if oObject is destroyable.

Definition at line 834 of file nwnx_object.nss.

◆ NWNX_Object_DoSpellImmunity()

int NWNX_Object_DoSpellImmunity ( object  oDefender,
object  oCaster,
int  nSpellId = -1 
)

Checks for specific spell immunity. Should only be called in spellscripts.

Parameters
oDefenderThe object defending against the spell.
oCasterThe object casting the spell.
nSpellIdThe casted spell id. Default value is -1, which corrresponds to the normal game behaviour.
Returns
-1 if defender has no immunity, 2 if the defender is immune

Definition at line 844 of file nwnx_object.nss.

◆ NWNX_Object_DoSpellLevelAbsorption()

int NWNX_Object_DoSpellLevelAbsorption ( object  oDefender,
object  oCaster,
int  nSpellId = -1,
int  nSpellLevel = -1,
int  nSpellSchool = -1 
)

Checks for spell school/level immunities and mantles. Should only be called in spellscripts.

Parameters
oDefenderThe object defending against the spell.
oCasterThe object casting the spell.
nSpellIdThe casted spell id. Default value is -1, which corrresponds to the normal game behaviour.
nSpellLevelThe level of the casted spell. Default value is -1, which corrresponds to the normal game behaviour.
nSpellSchoolThe school of the casted spell (SPELL_SCHOOL_* constant). Default value is -1, which corrresponds to the normal game behaviour.
Returns
-1 defender no immunity. 2 if immune. 3 if immune, but the immunity has a limit (example: mantles)

Definition at line 855 of file nwnx_object.nss.

◆ NWNX_Object_SetHasInventory()

void NWNX_Object_SetHasInventory ( object  obj,
int  bHasInventory 
)

Sets if a placeable has an inventory.

Parameters
objThe placeable.
bHasInventoryTRUE/FALSE
Note
Only works on placeables.

Definition at line 868 of file nwnx_object.nss.

◆ NWNX_Object_GetCurrentAnimation()

int NWNX_Object_GetCurrentAnimation ( object  oObject)

Get the current animation of oObject.

Note
The returned value will be an engine animation constant, not a NWScript ANIMATION_ constant. See: https://github.com/nwnxee/unified/blob/master/NWNXLib/API/Constants/Animation.hpp
Parameters
oObjectThe object
Returns
-1 on error or the engine animation constant

Definition at line 878 of file nwnx_object.nss.

◆ NWNX_Object_GetAILevel()

int NWNX_Object_GetAILevel ( object  oObject)

Gets the AI level of an object.

Parameters
oObjectThe object.
Returns
The AI level (AI_LEVEL_* -1 to 4).

Definition at line 888 of file nwnx_object.nss.

◆ NWNX_Object_SetAILevel()

void NWNX_Object_SetAILevel ( object  oObject,
int  nLevel 
)

Sets the AI level of an object.

Parameters
oObjectThe object.
nLevelThe level to set (AI_LEVEL_* -1 to 4).

Definition at line 898 of file nwnx_object.nss.

◆ NWNX_Object_GetMapNote()

string NWNX_Object_GetMapNote ( object  oObject,
int  nID = 0,
int  nGender = 0 
)

Retrieves the Map Note (AKA Map Pin) from a waypoint - Returns even if currently disabled.

Parameters
oObjectThe Waypoint object
nIDThe Language ID (default English)
nGender0 = Male, 1 = Female

Definition at line 908 of file nwnx_object.nss.

◆ NWNX_Object_SetMapNote()

void NWNX_Object_SetMapNote ( object  oObject,
string  sMapNote,
int  nID = 0,
int  nGender = 0 
)

Sets a Map Note (AKA Map Pin) to any waypoint, even if no previous map note. Only updates for clients on area-load. Use SetMapPinEnabled() as required.

Parameters
oObjectThe Waypoint object
sMapNoteThe contents to set as the Map Note.
nIDThe Language ID (default English)
nGender0 = Male, 1 = Female

Definition at line 920 of file nwnx_object.nss.

◆ NWNX_Object_GetLastSpellCastFeat()

int NWNX_Object_GetLastSpellCastFeat ( object  oObject)

Gets the last spell cast feat of oObject.

Note
Should be called in a spell script.
Parameters
oObjectThe object.
Returns
The feat ID, or 65535 when not cast by a feat, or -1 on error.

Definition at line 931 of file nwnx_object.nss.

◆ NWNX_Object_SetLastTriggered()

void NWNX_Object_SetLastTriggered ( object  oObject,
object  oLast 
)

Sets the last object that triggered door or placeable trap.

Note
Should be retrieved with GetEnteringObject.
Parameters
oObjectDoor or placeable object
oLastObject that last triggered trap.

Definition at line 941 of file nwnx_object.nss.

◆ NWNX_Object_GetAoEObjectDurationRemaining()

float NWNX_Object_GetAoEObjectDurationRemaining ( object  oAoE)

Gets the remaining duration of the AoE object.

Parameters
oAoEThe AreaOfEffect object.
Returns
The remaining duration, in seconds, or the zero on failure.

Definition at line 951 of file nwnx_object.nss.

◆ NWNX_Object_SetConversationPrivate()

void NWNX_Object_SetConversationPrivate ( object  oObject,
int  bPrivate 
)

Sets conversations started by oObject to be private or not.

Note
ActionStartConversation()'s bPrivateConversation parameter will overwrite this flag.
Parameters
oObjectThe object.
bPrivateTRUE/FALSE.

Definition at line 961 of file nwnx_object.nss.

◆ NWNX_Object_SetAoEObjectRadius()

void NWNX_Object_SetAoEObjectRadius ( object  oAoE,
float  fRadius 
)

Sets the radius of a circle AoE object.

Parameters
oAoEThe AreaOfEffect object.
fRadiusThe radius, must be bigger than 0.0f.

Definition at line 971 of file nwnx_object.nss.

◆ NWNX_Object_GetAoEObjectRadius()

float NWNX_Object_GetAoEObjectRadius ( object  oAoE)

Gets the radius of a circle AoE object.

Parameters
oAoEThe AreaOfEffect object.
Returns
The radius or 0.0f on error

Definition at line 980 of file nwnx_object.nss.

◆ NWNX_Object_GetLastSpellCastSpontaneous()

int NWNX_Object_GetLastSpellCastSpontaneous ( object  oObject)

Gets whether the last spell cast of oObject was spontaneous.

Note
Should be called in a spell script.
Parameters
oObjectThe object.
Returns
true if the last spell was cast spontaneously

Definition at line 990 of file nwnx_object.nss.

◆ NWNX_Object_GetLastSpellCastDomainLevel()

int NWNX_Object_GetLastSpellCastDomainLevel ( object  oObject)

Gets the last spell cast domain level.

Note
Should be called in a spell script.
Parameters
oObjectThe object.
Returns
Domain level of the cast spell, 0 if not a domain spell

Definition at line 1000 of file nwnx_object.nss.

◆ NWNX_Object_ForceAssignUUID()

void NWNX_Object_ForceAssignUUID ( object  oObject,
string  sUUID 
)

Force the given object to carry the given UUID. Any other object currently owning the UUID is stripped of it.

Parameters
oObjectThe object
sUUIDThe UUID to force

Definition at line 1010 of file nwnx_object.nss.

◆ NWNX_Object_GetInventoryItemCount()

int NWNX_Object_GetInventoryItemCount ( object  oObject)

Returns how many items are in oObject's inventory.

Parameters
oObjectA creature, placeable, item or store.
Returns
Returns a count of how many items are in oObject's inventory.

Definition at line 1019 of file nwnx_object.nss.

◆ NWNX_Object_OverrideSpellProjectileVFX()

void NWNX_Object_OverrideSpellProjectileVFX ( object  oCreature,
int  nProjectileType = -1,
int  nProjectilePathType = -1,
int  nSpellID = -1,
int  bPersist = FALSE 
)

Override the projectile visual effect of ranged/throwing weapons and spells.

Parameters
oCreatureThe creature.
nProjectileTypeA NWNX_OBJECT_SPELL_PROJECTILE_TYPE_* constant or -1 to remove the override.
nProjectilePathTypeA "PROJECTILE_PATH_TYPE_*" constant or -1 to ignore.
nSpellIDA "SPELL_*" constant. -1 to ignore.
bPersistWhether the override should persist to the .bic file (for PCs).
Note
Persistence is enabled after a server reset by the first use of this function. Recommended to trigger on a dummy target OnModuleLoad to enable persistence. This will override all spell projectile VFX from oCreature until the override is removed.

Definition at line 1028 of file nwnx_object.nss.

◆ NWNX_Object_GetLastSpellInstant()

int NWNX_Object_GetLastSpellInstant ( )

Returns TRUE if the last spell was cast instantly. This function should only be called in a spell script.

Note
To initialize the hooks used by this function it is recommended to call this function once in your module load script.
Returns
TRUE if the last spell was instant.

Definition at line 1040 of file nwnx_object.nss.

◆ NWNX_Object_SetTrapCreator()

void NWNX_Object_SetTrapCreator ( object  oObject,
object  oCreator 
)

Sets the creator of a trap on door, placeable, or trigger. Also changes trap Faction to that of the new Creator.

Note
Triggers (ground traps) will instantly update colour (Green/Red). Placeable/doors will not change if client has already seen them.
Parameters
oObjectDoor, placeable or trigger (trap) object
oCreatorThe new creator of the trap. Any non-creature creator will assign OBJECT_INVALID (similar to toolset-laid traps)

Definition at line 1047 of file nwnx_object.nss.

◆ NWNX_Object_GetLocalizedName()

string NWNX_Object_GetLocalizedName ( object  oObject,
int  nLanguage,
int  nGender = 0 
)

Return the name of the object for nLanguage.

Parameters
oObjectan object
nLanguageA PLAYER_LANGUAGE constant.
nGenderGender to use, 0 or 1.
Returns
The localized string.

Definition at line 1055 of file nwnx_object.nss.

◆ NWNX_Object_SetLocalizedName()

void NWNX_Object_SetLocalizedName ( object  oObject,
string  sName,
int  nLanguage,
int  nGender = 0 
)

Set the name of the object as set in the toolset for nLanguage.

Note
You may have to SetName(oObject, "") for the translated string to show.
Parameters
oObjectan object
sNameNew value to set
nLanguageA PLAYER_LANGUAGE constant.
nGenderGender to use, 0 or 1.

Definition at line 1067 of file nwnx_object.nss.

Variable Documentation

◆ NWNX_OBJECT_LOCALVAR_TYPE_UNKNOWN

const int NWNX_OBJECT_LOCALVAR_TYPE_UNKNOWN = 0

Definition at line 12 of file nwnx_object.nss.

◆ NWNX_OBJECT_LOCALVAR_TYPE_INT

const int NWNX_OBJECT_LOCALVAR_TYPE_INT = 1

Definition at line 13 of file nwnx_object.nss.

◆ NWNX_OBJECT_LOCALVAR_TYPE_FLOAT

const int NWNX_OBJECT_LOCALVAR_TYPE_FLOAT = 2

Definition at line 14 of file nwnx_object.nss.

◆ NWNX_OBJECT_LOCALVAR_TYPE_STRING

const int NWNX_OBJECT_LOCALVAR_TYPE_STRING = 3

Definition at line 15 of file nwnx_object.nss.

◆ NWNX_OBJECT_LOCALVAR_TYPE_OBJECT

const int NWNX_OBJECT_LOCALVAR_TYPE_OBJECT = 4

Definition at line 16 of file nwnx_object.nss.

◆ NWNX_OBJECT_LOCALVAR_TYPE_LOCATION

const int NWNX_OBJECT_LOCALVAR_TYPE_LOCATION = 5

Definition at line 17 of file nwnx_object.nss.

◆ NWNX_OBJECT_LOCALVAR_TYPE_JSON

const int NWNX_OBJECT_LOCALVAR_TYPE_JSON = 6

Definition at line 18 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_INVALID

const int NWNX_OBJECT_TYPE_INTERNAL_INVALID = -1

Definition at line 24 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_GUI

const int NWNX_OBJECT_TYPE_INTERNAL_GUI = 1

Definition at line 25 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_TILE

const int NWNX_OBJECT_TYPE_INTERNAL_TILE = 2

Definition at line 26 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_MODULE

const int NWNX_OBJECT_TYPE_INTERNAL_MODULE = 3

Definition at line 27 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_AREA

const int NWNX_OBJECT_TYPE_INTERNAL_AREA = 4

Definition at line 28 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_CREATURE

const int NWNX_OBJECT_TYPE_INTERNAL_CREATURE = 5

Definition at line 29 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_ITEM

const int NWNX_OBJECT_TYPE_INTERNAL_ITEM = 6

Definition at line 30 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_TRIGGER

const int NWNX_OBJECT_TYPE_INTERNAL_TRIGGER = 7

Definition at line 31 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_PROJECTILE

const int NWNX_OBJECT_TYPE_INTERNAL_PROJECTILE = 8

Definition at line 32 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_PLACEABLE

const int NWNX_OBJECT_TYPE_INTERNAL_PLACEABLE = 9

Definition at line 33 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_DOOR

const int NWNX_OBJECT_TYPE_INTERNAL_DOOR = 10

Definition at line 34 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_AREAOFEFFECT

const int NWNX_OBJECT_TYPE_INTERNAL_AREAOFEFFECT = 11

Definition at line 35 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_WAYPOINT

const int NWNX_OBJECT_TYPE_INTERNAL_WAYPOINT = 12

Definition at line 36 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_ENCOUNTER

const int NWNX_OBJECT_TYPE_INTERNAL_ENCOUNTER = 13

Definition at line 37 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_STORE

const int NWNX_OBJECT_TYPE_INTERNAL_STORE = 14

Definition at line 38 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_PORTAL

const int NWNX_OBJECT_TYPE_INTERNAL_PORTAL = 15

Definition at line 39 of file nwnx_object.nss.

◆ NWNX_OBJECT_TYPE_INTERNAL_SOUND

const int NWNX_OBJECT_TYPE_INTERNAL_SOUND = 16

Definition at line 40 of file nwnx_object.nss.

◆ NWNX_OBJECT_SPELL_PROJECTILE_TYPE_DEFAULT

const int NWNX_OBJECT_SPELL_PROJECTILE_TYPE_DEFAULT = 6

Definition at line 46 of file nwnx_object.nss.

◆ NWNX_OBJECT_SPELL_PROJECTILE_TYPE_USE_PATH

const int NWNX_OBJECT_SPELL_PROJECTILE_TYPE_USE_PATH = 7

Definition at line 47 of file nwnx_object.nss.