Table of Contents

Class NwGameObject

Namespace
Anvil.API
Assembly
NWN.Anvil.dll

Base class for all entities in areas.

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

Properties

ActiveEffects

Gets all effects (permanent and temporary) that are active on this game object.

AnimationState

Gets the current animation state of this object.

Area

Gets the area this object is currently in.

CasterLevel

Gets the caster level of this object.

HP

Gets or sets the current HP for this object.

HighlightColor

Gets or sets the highlight color of this object.

IsDestroyable

Gets or sets if this object is destroyable.

IsInConversation

Gets a value indicating whether this object is in a conversation.

IsListening

Gets or sets if this object should be listening for chat patterns, via the listen pattern system.

IsRaiseable

Gets or sets if this object is raiseable.

IsSelectableWhenDead

Gets or sets if this object is selectable when dead.

Location

Gets or sets the location of this object.

MaxHP

Gets or sets the maximum HP for this object. Returns 0 if this object has no defined HP.

MouseCursor

Gets or sets the mouse cursor for this object.

PlotFlag

Gets or sets a value indicating whether the plot flag is enabled.

PortraitId

Gets or sets the PortraitId of this (game object).

PortraitResRef

Gets or sets the Portrait ResRef for this object.

Position

Gets or sets the local area position of this GameObject.

Rotation

Gets or sets the world rotation for this object.

TransitionTarget

Gets or sets the transition target for this object.

UiDiscoveryFlags

Gets or sets flags for controlling Ui discovery of this object.

Useable

Gets or sets a value indicating whether this object should be useable (clickable).

VisibilityOverride

Gets or sets the global visiblity override for this object.

VisibleDistance

Gets or sets the distance that this object will become visible to clients (default 45.0).
This is still subject to other limitations, such as perception ranges for creatures.

VisualTransform

Gets the base visual transform for this object.
Use GetVisualTransform(ObjectVisualTransformDataScope) to get the visual transform for other scopes for this object.

Methods

ActionCastSpellAt(NwSpell, Location, MetaMagic, bool, ProjectilePathType, bool, NwClass?, bool, int)

Casts a spell at an location.

ActionCastSpellAt(NwSpell, NwGameObject, MetaMagic, bool, int, ProjectilePathType, bool, NwClass?, bool)

Casts a spell at an object.

ActionJumpToLocation(Location)

Jumps this object to the specified location.
Unlike the Location setter, this method will compute a safe location when teleporting, and may not equal the location specified.

ActionWait(TimeSpan)

Instructs this object to do nothing for the specified duration, before continuing with the next item in the action queue.

ApplyEffect(EffectDuration, Effect, TimeSpan)

Applies the specified effect to this game object.

ClearObjectAnimationOverride(string)

Clears the specified animation override, restoring the original.

Clone(Location, string?, bool)

Creates a copy of this game object.

Destroy()

Destroys this object (irrevocably).

Distance(NwGameObject)

Returns the distance to the target.
If you only need to compare the distance, you can compare the squared distance using DistanceSquared(NwGameObject) to avoid a costly sqrt operation.

DistanceSquared(NwGameObject)

Returns the squared distance to the target.

EndConversation()

Immediately ends this GameObject's current conversation.

FaceToObject(NwGameObject)

Rotates this object to face towards target.

FaceToPoint(Vector3)

Rotates this object to face a position.

GetColor(ColorChannel)

Gets the color for the specified color channel.

GetLocalizedName(PlayerLanguage, Gender)

Gets the localized string for this object in the specified language.

GetNearestCreatures()

Returns the creatures closest to this object.

GetNearestCreatures(CreatureTypeFilter)

Returns the creatures closest to this object, matching the specified criteria.

GetNearestCreatures(CreatureTypeFilter, CreatureTypeFilter)

Returns the creatures closest to this object, matching all of the specified criteria.

GetNearestCreatures(CreatureTypeFilter, CreatureTypeFilter, CreatureTypeFilter)

Returns the creatures closest to this object, matching all of the specified criteria.

GetNearestObjectsByType<T>()

Gets the nearest object that is of the specified type.

GetVisualTransform(ObjectVisualTransformDataScope)

Gets the visual transform of this object for the specified scope.

HasLineOfSight(NwGameObject)

Gets whether this object has a direct line of sight to the specified object (not blocked by any geometry).

PeekUUID()

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

PlayAnimation(Animation, float, bool, TimeSpan)

Plays the specified animation.

PlaySound(string)

Plays the specified sound as mono audio from the location of this object.

PlaySoundByStrRef(StrRef, bool)

Plays a sound associated with a string reference (strRef).
The sound comes out as a mono sound sourcing from the location of the object running the command.
If runAsAction is False, then the sound is played instantly.

RemoveEffect(Effect)

Removes the specified effect from this game object.

ReplaceObjectAnimation(string, string)

Replaces the specified animation with an override.
Use ClearObjectAnimationOverride(string) to clear the override.

ReplaceObjectTexture(string, string)

Replaces the specified texture with a new texture on this object only.

ResetMaterialShaderUniforms()

Resets all material shader parameter overrides on this object.

ResetMaterialShaderUniforms(string)

Resets all material shader parameter overrides for the specified material on this object.

The material on the object to be reset.
ResetMaterialShaderUniforms(string, string)

Resets the specified material shader parameter override for the specified material.

The material on the object to be reset. The parameter override to reset.
RollSavingThrow(SavingThrow, int, SavingThrowType, NwGameObject?)

Performs a saving throw against the given dc.

Serialize()
SetColor(ColorChannel, int)

Sets the color for the specified color channel.

SetFacing(float)

Rotates this object to face the specified facing angle.

SetIsDestroyable(bool, bool, bool)
SetListenPattern(string, int)

Sets a listen pattern for this object, assigning a pattern number that is accessible from the related object's OnConversation event.

SetLocalizedName(string, PlayerLanguage, Gender)

Sets the localized string for this object in the specified language.

SetMaterialShaderUniform(string, string, int)

Sets a material shader uniform override.

SetMaterialShaderUniform(string, string, Vector4)

Sets a material shader uniform override.

SetMaterialShaderUniform(string, string, float)

Sets a material shader uniform override.

SetTextBubbleOverride(ObjectUiTextBubbleOverride, string)

Sets a text override for the hover/tab-highlight text of this object.

Events

OnAcquireItem

Triggered whenever an NwItem is added to NwGameObject inventory.

OnChatMessageSend

Called when a chat message is about to be sent by an object.

OnDisarmWeapon
OnDispelMagicApply

Called when a DispelMagicAll(int) or DispelMagicBest(int) effect is applied to an object.

OnEffectApply

Called when an effect is about to be applied to a creature.

OnEffectRemove

Called when an effect is about to be removed from a creature.

OnHeal
OnSpellBroadcast
OnSpellCast
OnSpellInterrupt
OnUnacquireItem

Triggered when a NwItem is removed from a NwCreature's inventory.
This event is also fired when an item stack is destroyed when combining with another item stack.