Anvil
Anvil.API.NwGameObject Class Referenceabstract

Base class for all entities in areas. More...

+ Inheritance diagram for Anvil.API.NwGameObject:
+ Collaboration diagram for Anvil.API.NwGameObject:

Public Member Functions

async Task ActionCastSpellAt (NwSpell spell, Location target, MetaMagic metaMagic=MetaMagic.Any, bool cheat=false, ProjectilePathType projectilePathType=ProjectilePathType.Default, bool instant=false, NwClass? spellClass=null, bool spontaneousCast=false, int domainLevel=0)
 Casts a spell at an location. More...
 
async Task ActionCastSpellAt (NwSpell spell, NwGameObject target, MetaMagic metaMagic=MetaMagic.Any, bool cheat=false, int domainLevel=0, ProjectilePathType projectilePathType=ProjectilePathType.Default, bool instant=false, NwClass? spellClass=null, bool spontaneousCast=false)
 Casts a spell at an object. More...
 
async Task ActionJumpToLocation (Location 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. More...
 
async Task ActionWait (TimeSpan duration)
 Instructs this object to do nothing for the specified duration, before continuing with the next item in the action queue. More...
 
void ApplyEffect (EffectDuration durationType, Effect effect, TimeSpan duration=default)
 Applies the specified effect to this game object. More...
 
void ClearObjectAnimationOverride (string anim)
 Clears the specified animation override, restoring the original. More...
 
abstract NwGameObject Clone (Location location, string? newTag=null, bool copyLocalState=true)
 Creates a copy of this game object. More...
 
virtual void Destroy ()
 Destroys this object (irrevocably). More...
 
float Distance (NwGameObject target)
 Returns the distance to the target.
If you only need to compare the distance, you can compare the squared distance using DistanceSquared to avoid a costly sqrt operation. More...
 
float DistanceSquared (NwGameObject target)
 Returns the squared distance to the target. More...
 
async void EndConversation ()
 Immediately ends this GameObject's current conversation. More...
 
Task FaceToObject (NwGameObject target)
 Rotates this object to face towards target. More...
 
virtual async Task FaceToPoint (Vector3 point)
 Rotates this object to face a position. More...
 
int GetColor (ColorChannel colorChannel)
 Gets the color for the specified color channel. More...
 
IEnumerable< NwCreatureGetNearestCreatures ()
 Returns the creatures closest to this object. More...
 
IEnumerable< NwCreatureGetNearestCreatures (CreatureTypeFilter filter1)
 Returns the creatures closest to this object, matching the specified criteria. More...
 
IEnumerable< NwCreatureGetNearestCreatures (CreatureTypeFilter filter1, CreatureTypeFilter filter2)
 Returns the creatures closest to this object, matching all of the specified criteria. More...
 
IEnumerable< NwCreatureGetNearestCreatures (CreatureTypeFilter filter1, CreatureTypeFilter filter2, CreatureTypeFilter filter3)
 Returns the creatures closest to this object, matching all of the specified criteria. More...
 
IEnumerable< T > GetNearestObjectsByType< T > ()
 Gets the nearest object that is of the specified type. More...
 
VisualTransform GetVisualTransform (ObjectVisualTransformDataScope scope)
 Gets the visual transform of this object for the specified scope. More...
 
bool HasLineOfSight (NwGameObject target)
 Gets whether this object has a direct line of sight to the specified object (not blocked by any geometry).
More...
 
override? Guid PeekUUID ()
 Attempts to get the UUID of this object, if assigned. More...
 
async Task PlayAnimation (Animation animation, float animSpeed, bool queueAsAction=false, TimeSpan duration=default)
 Plays the specified animation. More...
 
async Task PlaySound (string soundName)
 Plays the specified sound as mono audio from the location of this object. More...
 
async Task PlaySoundByStrRef (StrRef strRef, bool runAsAction=true)
 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. More...
 
void RemoveEffect (Effect effect)
 Removes the specified effect from this game object. More...
 
void ReplaceObjectAnimation (string anim, string newAnim)
 Replaces the specified animation with an override.
Use ClearObjectAnimationOverride to clear the override. More...
 
void ReplaceObjectTexture (string texture, string newTexture)
 Replaces the specified texture with a new texture on this object only. More...
 
void ResetMaterialShaderUniforms ()
 Resets all material shader parameter overrides on this object. More...
 
void ResetMaterialShaderUniforms (string material)
 Resets all material shader parameter overrides for the specified material on this object.

Parameters
materialThe material on the object to be reset.
More...
 
void ResetMaterialShaderUniforms (string material, string param)
 Resets the specified material shader parameter override for the specified material.

Parameters
materialThe material on the object to be reset.
paramThe parameter override to reset.
More...
 
SavingThrowResult RollSavingThrow (SavingThrow savingThrow, int dc, SavingThrowType saveType, NwGameObject? saveVs=null)
 Performs a saving throw against the given dc. More...
 
abstract ? byte[] Serialize ()
 
void SetColor (ColorChannel colorChannel, int newColor)
 Sets the color for the specified color channel. More...
 
async Task SetFacing (float facing)
 Rotates this object to face the specified facing angle. More...
 
async Task SetIsDestroyable (bool destroyable, bool raiseable=true, bool selectableWhenDead=false)
 Sets whether this object is destroyable. More...
 
void SetListenPattern (string pattern, int patternNumber)
 Sets a listen pattern for this object, assigning a pattern number that is accessible from the related object's OnConversation event. More...
 
void SetMaterialShaderUniform (string material, string param, float value)
 Sets a material shader uniform override. More...
 
void SetMaterialShaderUniform (string material, string param, int value)
 Sets a material shader uniform override. More...
 
void SetMaterialShaderUniform (string material, string param, Vector4 value)
 Sets a material shader uniform override. More...
 
void SetTextBubbleOverride (ObjectUiTextBubbleOverride mode, string text)
 Sets a text override for the hover/tab-highlight text of this object. More...
 
- Public Member Functions inherited from Anvil.API.NwObject
async Task AddActionToQueue (System.Action action)
 Inserts the function call aCommand into the Action Queue, ensuring the calling object will perform actions in a particular order. More...
 
async Task ClearActionQueue (bool clearCombatState=false)
 Clear all the object's actions. More...
 
void ClearEventSubscriptions ()
 Clears any event subscriptions associated with this object. More...
 
bool Equals (NwObject? other)
 
override bool Equals (object? obj)
 
void ForceRefreshUUID ()
 
string GetEventScript (EventScriptType eventType)
 Gets the script assigned to run for the specified object event. More...
 
override int GetHashCode ()
 
GetObjectVariable< T > (string name)
 Gets the specified object variable for this object. More...
 
bool IsEventLocked (EventScriptType eventType)
 Gets a value indicating whether the event script can be modified for the specified event. More...
 
Json SerializeToJson (bool saveObjectState)
 Serializes this game object to a json representation More...
 
void SetEventScript (EventScriptType eventType, string? script)
 Sets the script to be run on the specified object event. More...
 
async Task SpeakString (string message, TalkVolume talkVolume=TalkVolume.Talk, bool queueAsAction=false)
 Instructs this object to speak. More...
 
override string ToString ()
 The ID of this object as a string. Can be used in StringExtensions.ParseObject while the object is alive.
This cannot be used across server restarts. See UUID for a persistent unique identifier. More...
 
bool TryGetUUID (out Guid uid)
 Attempts to get the UUID for this object, assigning a new ID if it does not already exist.
More...
 
async Task 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. More...
 

Protected Member Functions

abstract void AddToArea (CNWSArea area, float x, float y, float z)
 
CloneInternal< T > (Location location, string? newTag, bool copyLocalState)
 
- Protected Member Functions inherited from Anvil.API.NwObject
 NwObject (ICGameObject gameObject)
 
void AssertObjectValid ()
 

Properties

IEnumerable< Effect >? ActiveEffects [get]
 Gets all effects (permanent and temporary) that are active on this game object. More...
 
AnimationState AnimationState [get]
 Gets the current animation state of this object. More...
 
NwAreaArea [get]
 Gets the area this object is currently in. More...
 
int CasterLevel [get]
 Gets the caster level of this object. More...
 
Color HighlightColor [get, set]
 Gets or sets the highlight color of this object. More...
 
int HP [get, set]
 Gets or sets the current HP for this object. More...
 
bool IsInConversation [get]
 Gets a value indicating whether this object is in a conversation. More...
 
bool IsListening [get, set]
 Gets or sets if this object should be listening for chat patterns, via the listen pattern system. More...
 
virtual ? Location Location [get, set]
 Gets or sets the location of this object. More...
 
int MaxHP [get, set]
 Gets or sets the maximum HP for this object. Returns 0 if this object has no defined HP. More...
 
MouseCursor MouseCursor [get, set]
 Gets or sets the mouse cursor for this object. More...
 
Action< ModuleEvents.OnAcquireItemOnAcquireItem
 
Action< OnChatMessageSendOnChatMessageSend
 
Action< OnDisarmWeaponOnDisarmWeapon
 
Action< OnDispelMagicApplyOnDispelMagicApply
 
Action< OnEffectApplyOnEffectApply
 
Action< OnEffectRemoveOnEffectRemove
 
Action< OnHealOnHeal
 
Action< OnSpellBroadcastOnSpellBroadcast
 
Action< OnSpellCastOnSpellCast
 
Action< OnSpellInterruptOnSpellInterrupt
 
Action< ModuleEvents.OnUnacquireItemOnUnacquireItem
 
bool PlotFlag [get, set]
 Gets or sets a value indicating whether the plot flag is enabled. More...
 
PortraitTableEntry???? PortraitId [get, set]
 Gets or sets the PortraitId of this (game object). More...
 
string PortraitResRef [get, set]
 Gets or sets the Portrait ResRef for this object. More...
 
virtual Vector3 Position [get, set]
 Gets or sets the local area position of this GameObject. More...
 
virtual float Rotation [get, set]
 Gets or sets the world rotation for this object. More...
 
NwGameObjectTransitionTarget [get, set]
 Gets or sets the transition target for this object. More...
 
ObjectUiDiscovery UiDiscoveryFlags [get, set]
 Gets or sets flags for controlling Ui discovery of this object. More...
 
bool Useable [get, set]
 Gets or sets a value indicating whether this object should be useable (clickable). More...
 
VisibilityMode VisibilityOverride [get, set]
 Gets or sets the global visiblity override for this object. More...
 
float VisibleDistance [get, set]
 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. More...
 
VisualTransform VisualTransform [get]
 Gets the base visual transform for this object.
Use GetVisualTransform to get the visual transform for other scopes for this object. More...
 
- Properties inherited from Anvil.API.NwObject
string Description [get, set]
 Gets or sets the description for this object. More...
 
static EventService EventService = null! [get]
 
bool HasUUID [get]
 Gets a value indicating whether this object has an assigned UUID. More...
 
bool IsValid [get]
 Gets a value indicating whether this is a valid object. More...
 
IEnumerable< ObjectVariableLocalVariables [get]
 Gets all local variables assigned on this object. More...
 
string Name [get, set]
 Gets or sets the name of this object. More...
 
static Lazy< ObjectVisibilityService > ObjectVisibilityService = null! [get]
 
string OriginalDescription [get]
 Gets the original description for this object as defined in the toolset. More...
 
static ResourceManager ResourceManager = null! [get]
 
string ResRef [get]
 Gets the resource reference used to create this object. More...
 
string Tag [get, set]
 Gets or sets the tag for this object. More...
 
Guid UUID [get]
 Gets the globally unique identifier for this object. More...
 
static VirtualMachine VirtualMachine = null! [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from Anvil.API.NwObject
static IEnumerable< T > FindObjectsOfType< T > ()
 Locates all objects of the specified type. More...
 
static IEnumerable< NwObjectFindObjectsWithTag (params string[] tags)
 Locates all objects of that have the specified tag. More...
 
static IEnumerable< T > FindObjectsWithTag< T > (params string[] tags)
 Locates all objects of the specified type that have the specified tag. More...
 
static implicit operator uint (NwObject? gameObject)
 
static bool operator!= (NwObject? left, NwObject? right)
 
static bool operator== (NwObject? left, NwObject? right)
 
- Public Attributes inherited from Anvil.API.NwObject
readonly uint 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. More...
 

Detailed Description

Base class for all entities in areas.

Member Function Documentation

◆ ActionCastSpellAt() [1/2]

async Task Anvil.API.NwGameObject.ActionCastSpellAt ( NwSpell  spell,
Location  target,
MetaMagic  metaMagic = MetaMagic.Any,
bool  cheat = false,
ProjectilePathType  projectilePathType = ProjectilePathType.Default,
bool  instant = false,
NwClass spellClass = null,
bool  spontaneousCast = false,
int  domainLevel = 0 
)
inline

Casts a spell at an location.

Parameters
spellThe spell to cast.
targetThe target for the spell.
metaMagicMetamagic that should be applied to the spell.
cheatIf true, this object doesn't have to be able to cast the spell.
projectilePathTypeThe type of projectile path to use for this spell.
instantIf true, the spell is cast immediately.
spellClassIf specified, the spell will be cast using that class specifically. Null will use spell abilities instead.
spontaneousCastIf true, the creature will attempt to cast the given spell spontaneously. Requires class parameter is set to a valid class with spontaneous cast spells.
domainLevelSpecifies the spell level if the spell is to be cast as a domain spell.

◆ ActionCastSpellAt() [2/2]

async Task Anvil.API.NwGameObject.ActionCastSpellAt ( NwSpell  spell,
NwGameObject  target,
MetaMagic  metaMagic = MetaMagic.Any,
bool  cheat = false,
int  domainLevel = 0,
ProjectilePathType  projectilePathType = ProjectilePathType.Default,
bool  instant = false,
NwClass spellClass = null,
bool  spontaneousCast = false 
)
inline

Casts a spell at an object.

Parameters
spellThe spell to cast.
targetThe target for the spell.
metaMagicMetamagic that should be applied to the spell. If class is specified, cannot be MetaMagic.Any.
cheatIf true, this object doesn't have to be able to cast the spell. Ignored if class is specified.
domainLevelSpecifies the spell level if the spell is to be cast as a domain spell.
projectilePathTypeThe type of projectile path to use for this spell.
instantIf true, the spell is cast immediately.
spellClassIf specified, the spell will be cast using that class specifically. Null will use spell abilities instead.
spontaneousCastIf true, the creature will attempt to cast the given spell spontaneously. Requires class parameter is set to a valid class with spontaneous cast spells.

◆ ActionJumpToLocation()

async Task Anvil.API.NwGameObject.ActionJumpToLocation ( Location  location)
inline

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.

Parameters
locationThe location to attempt to jump to.

◆ ActionWait()

async Task Anvil.API.NwGameObject.ActionWait ( TimeSpan  duration)
inline

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

Parameters
durationThe time to wait.

◆ ApplyEffect()

void Anvil.API.NwGameObject.ApplyEffect ( EffectDuration  durationType,
Effect  effect,
TimeSpan  duration = default 
)
inline

Applies the specified effect to this game object.

Parameters
durationTypeThe duration type to apply with this effect.
effectThe effect to apply.
durationIf duration type is EffectDuration.Temporary, the duration of this effect.

◆ ClearObjectAnimationOverride()

void Anvil.API.NwGameObject.ClearObjectAnimationOverride ( string  anim)
inline

Clears the specified animation override, restoring the original.

Parameters
animThe name of the original animation to clear.

◆ Clone()

abstract NwGameObject Anvil.API.NwGameObject.Clone ( Location  location,
string?  newTag = null,
bool  copyLocalState = true 
)
pure virtual

Creates a copy of this game object.

Parameters
locationThe location to create the cloned object.
newTagA new tag to assign the cloned object.
copyLocalStateIf true, will clone all local variables, effects, action queue and transition info (triggers, doors) for the object.
Returns
The newly cloned copy of the item.

Implemented in Anvil.API.NwWaypoint, Anvil.API.NwTrigger, Anvil.API.NwStore, Anvil.API.NwSound, Anvil.API.NwPlaceable, Anvil.API.NwItem, Anvil.API.NwEncounter, Anvil.API.NwDoor, Anvil.API.NwCreature, and Anvil.API.NwAreaOfEffect.

◆ Destroy()

virtual void Anvil.API.NwGameObject.Destroy ( )
inlinevirtual

Destroys this object (irrevocably).

Reimplemented in Anvil.API.NwEncounter.

◆ Distance()

float Anvil.API.NwGameObject.Distance ( NwGameObject  target)
inline

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

Parameters
targetThe other object to calculate distance from.
Returns
The distance in game units, or -1 if the target is in a different area.

◆ DistanceSquared()

float Anvil.API.NwGameObject.DistanceSquared ( NwGameObject  target)
inline

Returns the squared distance to the target.

Parameters
targetThe other object to calculate distance from.
Returns
The squared distance in game units, or -1 if the target is in a different area.

◆ EndConversation()

async void Anvil.API.NwGameObject.EndConversation ( )
inline

Immediately ends this GameObject's current conversation.

◆ FaceToObject()

Task Anvil.API.NwGameObject.FaceToObject ( NwGameObject  target)
inline

Rotates this object to face towards target.

Parameters
targetThe target object to face.

◆ FaceToPoint()

virtual async Task Anvil.API.NwGameObject.FaceToPoint ( Vector3  point)
inlinevirtual

Rotates this object to face a position.

Parameters
pointThe position to face towards.

Reimplemented in Anvil.API.NwStationary.

◆ GetColor()

int Anvil.API.NwGameObject.GetColor ( ColorChannel  colorChannel)
inline

Gets the color for the specified color channel.

Note
A chart of available colors can be found here: https://nwnlexicon.com/index.php?title=Color_Charts
Parameters
colorChannelThe color channel that you want to get the color value of.
Returns
The current color index value of the specified channel.

◆ GetNearestCreatures() [1/4]

IEnumerable<NwCreature> Anvil.API.NwGameObject.GetNearestCreatures ( )
inline

Returns the creatures closest to this object.

◆ GetNearestCreatures() [2/4]

IEnumerable<NwCreature> Anvil.API.NwGameObject.GetNearestCreatures ( CreatureTypeFilter  filter1)
inline

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

Parameters
filter1A filter created using CreatureTypeFilter.

◆ GetNearestCreatures() [3/4]

IEnumerable<NwCreature> Anvil.API.NwGameObject.GetNearestCreatures ( CreatureTypeFilter  filter1,
CreatureTypeFilter  filter2 
)
inline

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

Parameters
filter1A filter created using CreatureTypeFilter.
filter2A 2nd filter created using CreatureTypeFilter.

◆ GetNearestCreatures() [4/4]

IEnumerable<NwCreature> Anvil.API.NwGameObject.GetNearestCreatures ( CreatureTypeFilter  filter1,
CreatureTypeFilter  filter2,
CreatureTypeFilter  filter3 
)
inline

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

Parameters
filter1A filter created using CreatureTypeFilter.
filter2A 2nd filter created using CreatureTypeFilter.
filter3A 3rd filter created using CreatureTypeFilter.

◆ GetNearestObjectsByType< T >()

IEnumerable<T> Anvil.API.NwGameObject.GetNearestObjectsByType< T > ( )
inline

Gets the nearest object that is of the specified type.

Template Parameters
TThe type of object to search.
Type Constraints
T :NwGameObject 

◆ GetVisualTransform()

VisualTransform Anvil.API.NwGameObject.GetVisualTransform ( ObjectVisualTransformDataScope  scope)
inline

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

Parameters
scopeThe transform scope to get.

◆ HasLineOfSight()

bool Anvil.API.NwGameObject.HasLineOfSight ( NwGameObject  target)
inline

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

Note
This is an expensive function and may degrade performance if used frequently.
Parameters
targetThe target object to perform the line of sight check against.
Returns
true if this object has line of sight on the target, otherwise false.

◆ PeekUUID()

override? Guid Anvil.API.NwGameObject.PeekUUID ( )
inlinevirtual

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

Returns
The UUID if assigned, otherwise no value.

Implements Anvil.API.NwObject.

◆ PlayAnimation()

async Task Anvil.API.NwGameObject.PlayAnimation ( Animation  animation,
float  animSpeed,
bool  queueAsAction = false,
TimeSpan  duration = default 
)
inline

Plays the specified animation.

Parameters
animationConstant value representing the animation to play.
animSpeedSpeed to play the animation.
queueAsActionIf true, enqueues animation playback in the object's action queue.
durationDuration to keep animating. Not used in fire and forget animations.

◆ PlaySound()

async Task Anvil.API.NwGameObject.PlaySound ( string  soundName)
inline

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

Parameters
soundNameThe name of the sound to play.

◆ PlaySoundByStrRef()

async Task Anvil.API.NwGameObject.PlaySoundByStrRef ( StrRef  strRef,
bool  runAsAction = true 
)
inline

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.

Parameters
strRefString reference number of the sound to play.
runAsActionDetermines if this is an action that can be stacked on the action queue.

The strRef values for sounds can be found in the file dialog.tlk in the NWN install directory.

◆ RemoveEffect()

void Anvil.API.NwGameObject.RemoveEffect ( Effect  effect)
inline

Removes the specified effect from this game object.

Parameters
effectThe existing effect instance.

◆ ReplaceObjectAnimation()

void Anvil.API.NwGameObject.ReplaceObjectAnimation ( string  anim,
string  newAnim 
)
inline

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

Parameters
animThe animation to replace.
newAnimThe replacement animation.

◆ ReplaceObjectTexture()

void Anvil.API.NwGameObject.ReplaceObjectTexture ( string  texture,
string  newTexture 
)
inline

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

Parameters
textureThe texture to be replaced.
newTextureThe replacement texture.

◆ ResetMaterialShaderUniforms() [1/3]

void Anvil.API.NwGameObject.ResetMaterialShaderUniforms ( )
inline

Resets all material shader parameter overrides on this object.

◆ ResetMaterialShaderUniforms() [2/3]

void Anvil.API.NwGameObject.ResetMaterialShaderUniforms ( string  material)
inline

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

Parameters
materialThe material on the object to be reset.

◆ ResetMaterialShaderUniforms() [3/3]

void Anvil.API.NwGameObject.ResetMaterialShaderUniforms ( string  material,
string  param 
)
inline

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

Parameters
materialThe material on the object to be reset.
paramThe parameter override to reset.

◆ RollSavingThrow()

SavingThrowResult Anvil.API.NwGameObject.RollSavingThrow ( SavingThrow  savingThrow,
int  dc,
SavingThrowType  saveType,
NwGameObject saveVs = null 
)
inline

Performs a saving throw against the given dc.

Parameters
savingThrowThe type of saving throw to make (Fortitude/Reflex/Will).
dcDifficulty class.
saveTypeThe sub-type of this save (Mind effect, etc).
saveVsThe creature this object is making the save against.
Exceptions
ArgumentOutOfRangeExceptionThrown if savingThrow is not Fortitude, Reflex, or Will.
Returns
The result of the saving throw.

◆ SetColor()

void Anvil.API.NwGameObject.SetColor ( ColorChannel  colorChannel,
int  newColor 
)
inline

Sets the color for the specified color channel.

Note
A chart of available colors can be found here: https://nwnlexicon.com/index.php?title=Color_Charts
Parameters
colorChannelThe color channel to modify.
newColorThe color channel's new color index.

◆ SetFacing()

async Task Anvil.API.NwGameObject.SetFacing ( float  facing)
inline

Rotates this object to face the specified facing angle.

Parameters
facingThe angle to face.

◆ SetIsDestroyable()

async Task Anvil.API.NwGameObject.SetIsDestroyable ( bool  destroyable,
bool  raiseable = true,
bool  selectableWhenDead = false 
)
inline

Sets whether this object is destroyable.

Parameters
destroyableIf false, this creature does not fade out on death, but sticks around as a corpse.
raiseableIf true, this creature can be raised via resurrection.
selectableWhenDeadIf true, this creature is selectable after death.

◆ SetListenPattern()

void Anvil.API.NwGameObject.SetListenPattern ( string  pattern,
int  patternNumber 
)
inline

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

Parameters
patternThe pattern to match the message against. This is not regex, but a custom pattern format. See the remarks for more info.
patternNumberThe pattern number to assign, on a successful match.

Pattern Format:
** will match zero or more characters
*w one or more whitespace
*n one or more numeric
*p one or more punctuation
*a one or more alphabetic
| is or
( and ) can be used for block.

Setting a creature to listen for "**" will match any string
Telling him to listen for "**funk**" will match any string that contains the word "funk".
"**(bash|open|unlock)**(chest|door)**" will match strings like "open the door please" or "he just bashed that chest!"

◆ SetMaterialShaderUniform() [1/3]

void Anvil.API.NwGameObject.SetMaterialShaderUniform ( string  material,
string  param,
float  value 
)
inline

Sets a material shader uniform override.

Parameters
materialThe material on the object to modify.
paramThe parameter to override.
valueThe new parameter value.

◆ SetMaterialShaderUniform() [2/3]

void Anvil.API.NwGameObject.SetMaterialShaderUniform ( string  material,
string  param,
int  value 
)
inline

Sets a material shader uniform override.

Parameters
materialThe material on the object to modify.
paramThe parameter to override.
valueThe new parameter value.

◆ SetMaterialShaderUniform() [3/3]

void Anvil.API.NwGameObject.SetMaterialShaderUniform ( string  material,
string  param,
Vector4  value 
)
inline

Sets a material shader uniform override.

Parameters
materialThe material on the object to modify.
paramThe parameter to override.
valueThe new parameter value.

◆ SetTextBubbleOverride()

void Anvil.API.NwGameObject.SetTextBubbleOverride ( ObjectUiTextBubbleOverride  mode,
string  text 
)
inline

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

Parameters
modeHow the text should be applied.
textThe text override.

Property Documentation

◆ ActiveEffects

IEnumerable<Effect>? Anvil.API.NwGameObject.ActiveEffects
get

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

◆ AnimationState

AnimationState Anvil.API.NwGameObject.AnimationState
get

Gets the current animation state of this object.

◆ Area

NwArea? Anvil.API.NwGameObject.Area
get

Gets the area this object is currently in.

◆ CasterLevel

int Anvil.API.NwGameObject.CasterLevel
get

Gets the caster level of this object.

A creature will return the caster level of their currently cast spell or ability, or the item's caster level if an item was used.
A placeable will return an automatic caster level: floor(10, (spell innate level * 2) - 1)
An Area of Effect object will return the caster level that was used to create the Area of Effect.
Otherwise, returns 0

◆ HighlightColor

Color Anvil.API.NwGameObject.HighlightColor
getset

Gets or sets the highlight color of this object.

◆ HP

int Anvil.API.NwGameObject.HP
getset

Gets or sets the current HP for this object.

◆ IsInConversation

bool Anvil.API.NwGameObject.IsInConversation
get

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

◆ IsListening

bool Anvil.API.NwGameObject.IsListening
getset

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

◆ Location

virtual ? Location Anvil.API.NwGameObject.Location
getset

Gets or sets the location of this object.

◆ MaxHP

int Anvil.API.NwGameObject.MaxHP
getset

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

◆ MouseCursor

MouseCursor Anvil.API.NwGameObject.MouseCursor
getset

Gets or sets the mouse cursor for this object.

◆ PlotFlag

bool Anvil.API.NwGameObject.PlotFlag
getset

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

◆ PortraitId

PortraitTableEntry???? Anvil.API.NwGameObject.PortraitId
getset

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

When this property is set to null, the ID will be set to NWScript.PORTRAIT_INVALID (65535).
When this property is invalid, the portrait from PortraitResRef will be used instead.

◆ PortraitResRef

string Anvil.API.NwGameObject.PortraitResRef
getset

Gets or sets the Portrait ResRef for this object.

Setting this property will automatically set PortraitId to invalid, ensuring this property is used instead.

◆ Position

virtual Vector3 Anvil.API.NwGameObject.Position
getset

Gets or sets the local area position of this GameObject.

◆ Rotation

virtual float Anvil.API.NwGameObject.Rotation
getset

Gets or sets the world rotation for this object.

◆ TransitionTarget

NwGameObject? Anvil.API.NwGameObject.TransitionTarget
getset

Gets or sets the transition target for this object.

◆ UiDiscoveryFlags

ObjectUiDiscovery Anvil.API.NwGameObject.UiDiscoveryFlags
getset

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

◆ Useable

bool Anvil.API.NwGameObject.Useable
getset

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

◆ VisibilityOverride

VisibilityMode Anvil.API.NwGameObject.VisibilityOverride
getset

Gets or sets the global visiblity override for this object.

◆ VisibleDistance

float Anvil.API.NwGameObject.VisibleDistance
getset

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

VisualTransform Anvil.API.NwGameObject.VisualTransform
get

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


The documentation for this class was generated from the following files: