Difference between revisions of "ReplaceObjectTexture"

From NWN Lexicon
Jump to: navigation, search
m (remove TOC)
Line 1: Line 1:
 
__NOTOC__{{NWNEE}}Replace individual textures on objects at runtime.  
 
__NOTOC__{{NWNEE}}Replace individual textures on objects at runtime.  
 
 
<nwscript>
 
<nwscript>
 
void ReplaceObjectTexture(
 
void ReplaceObjectTexture(
Line 8: Line 7:
 
);
 
);
 
</nwscript>
 
</nwscript>
 
 
 
===Parameters===
 
===Parameters===
 
; oObject
 
; oObject
 
: An object to update a texture.
 
: An object to update a texture.
 
 
; sOld
 
; sOld
 
: The old texture to replace.
 
: The old texture to replace.
 
 
; sNew
 
; sNew
 
: The new texture.  Specifying sNew = "" will restore the original texture.
 
: The new texture.  Specifying sNew = "" will restore the original texture.
  
 +
===Description===
  
===Description===
 
 
Replace's oObject's texture sOld with sNew.  Specifying sNew = "" will restore the original texture.  If sNew cannot be found, the original texture will be restored.  sNew must refer to a simple texture, not PLT.
 
Replace's oObject's texture sOld with sNew.  Specifying sNew = "" will restore the original texture.  If sNew cannot be found, the original texture will be restored.  sNew must refer to a simple texture, not PLT.
  
 
===Remarks===
 
===Remarks===
{{stub section}}
 
  
 +
This can replace any texture for all clients. It can be done frequently enough to mimic movement (eg; altering a "object tile" texture to show a moving landscape), or to do some useful swaps of terrain (such as snow appearing when it is snowing on top of placeable objects in the area).
 +
 +
It is per-object so a loop must be done if replacing multiple objects of the same kind.
 +
 +
Obviously the texture must be appropriate, and using the wrong texture file to replace one can have unforeseen consequences.
  
 
===Version===
 
===Version===
[https://steamcommunity.com/games/704450/announcements/detail/2724067792533337541  1.80.8193.14]
+
{{8193.14}}
  
 
===Example===
 
===Example===

Revision as of 14:58, 9 August 2020

Nwnee logo.jpg Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.
Replace individual textures on objects at runtime.
void ReplaceObjectTexture(
    object oObject,
    string sOld,
    string sNew = ""
);

Parameters

oObject
An object to update a texture.
sOld
The old texture to replace.
sNew
The new texture. Specifying sNew = "" will restore the original texture.

Description

Replace's oObject's texture sOld with sNew. Specifying sNew = "" will restore the original texture. If sNew cannot be found, the original texture will be restored. sNew must refer to a simple texture, not PLT.

Remarks

This can replace any texture for all clients. It can be done frequently enough to mimic movement (eg; altering a "object tile" texture to show a moving landscape), or to do some useful swaps of terrain (such as snow appearing when it is snowing on top of placeable objects in the area).

It is per-object so a loop must be done if replacing multiple objects of the same kind.

Obviously the texture must be appropriate, and using the wrong texture file to replace one can have unforeseen consequences.

Version

This function was added in 1.80.8193.14 of NWN:EE.

Example

Information icon.png This article is in need of examples. You can help the NWN Lexicon by showing how to use this code effectively.


See Also

functions: SetTextureOverride()



 author: Shadguy