Table of Contents

Class NwObject

Namespace
Anvil.API
Assembly
NWN.Anvil.dll

Base class for all world entities (game objects) and containers (modules, areas).

public abstract class NwObject : IEquatable<NwObject>
Inheritance
NwObject
Implements
Derived
Inherited Members
Extension Methods

Fields

ObjectId

The ID of this object instance. Not persistent, changes after every spawn of the object.
See UUID for a persistent unique ID for objects.

Properties

Description

Gets or sets the description for this object.

HasUUID

Gets a value indicating whether this object has an assigned UUID.

IsValid

Gets a value indicating whether this is a valid object.

LocalVariables

Gets all local variables assigned on this object.

Name

Gets or sets the name of this object.

OriginalDescription

Gets the original description for this object as defined in the toolset.

ResRef

Gets the resource reference used to create this object.

Tag

Gets or sets the tag for this object.

UUID

Gets the globally unique identifier for this object.

Methods

AddActionToQueue(Action)

Inserts the function call aCommand into the Action Queue, ensuring the calling object will perform actions in a particular order.

AssertObjectValid()
ClearActionQueue(bool)

Clear all the object's actions.

  • No return value, but if an error occurs, the log file will contain "ClearAllActions failed.".
  • clearCombatState: if true, this will immediately clear the combat state on a creature, which will stop the combat music and allow them to rest, engage in dialog, or other actions that they would normally have to wait for.
ClearEventSubscriptions()

Clears any event subscriptions associated with this object.

Equals(NwObject?)

Indicates whether the current object is equal to another object of the same type.

Equals(object?)

Determines whether the specified object is equal to the current object.

FindObjectsOfType<T>()

Locates all objects of the specified type.

FindObjectsWithTag(params string[])

Locates all objects of that have the specified tag.

FindObjectsWithTag<T>(params string[])

Locates all objects of the specified type that have the specified tag.

ForceRefreshUUID()
GetEventScript(EventScriptType)

Gets the script assigned to run for the specified object event.

GetHashCode()

Serves as the default hash function.

GetObjectVariable<T>(string)

Gets the specified object variable for this object.

IsEventLocked(EventScriptType)

Gets a value indicating whether the event script can be modified for the specified event.

PeekUUID()

Attempts to get the UUID of this object, if assigned.

SerializeToJson(bool)

Serializes this game object to a json representation

SetEventScript(EventScriptType, string?)

Sets the script to be run on the specified object event.

SpeakString(string, TalkVolume, bool)

Instructs this object to speak.

ToString()

The ID of this object as a string. Can be used in ParseObject(string) while the object is alive.
This cannot be used across server restarts. See UUID for a persistent unique identifier.

TryGetUUID(out Guid)

Attempts to get the UUID for this object, assigning a new ID if it does not already exist.

WaitForObjectContext()

Notifies then awaits for this object to become the current active object for the purpose of implicitly assigned values (e.g. effect creators).
If the current active object is already this object, then the code runs immediately. Otherwise, it will be run with all other closures.
This is the async equivalent of AssignCommand in NWScript.

Operators

operator ==(NwObject?, NwObject?)
implicit operator uint(NwObject?)
operator !=(NwObject?, NwObject?)