ReplaceObjectTexture( object, string, string )

From NWN Lexicon
Jump to: navigation, search
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.

If the texture has already been replaced, sOld must still match the original texture name for this to work properly.

Remarks

This can replace any texture for all clients. It may 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.

It works best with non-material, simple textures.

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

Static placeable objects are not affected by this function at all.

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