SetDescription(object, string, int)

From NWN Lexicon
Revision as of 04:28, 19 September 2021 by Shadguy (talk | contribs) (Remarks: applied patch template)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sets the description of an object.

void SetDescription(
    object oObject,
    string sNewDescription = "",
    int bIdentified = TRUE


The object for which you are changing the description.
The new description that oObject will use. (Default: "")
For items, use the specified string as the description when the item is identified. (Default: TRUE)


Sets the description of an object. This function works on player characters, creatures, placeables, items, doors, and triggers.


If sNewDescription is not provided (or explicitly specified as an empty string ("")), the description will revert to the object's original description. If you want to "blank" a description the best option is a single space - " "

bIdentified is only used if oObject is an item. Setting bIdentified to TRUE will set the identified description, setting this to FALSE will set the unidentified description.

You can change the color of the text shown using StringToRGBString and other special strings.

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.

This function was updated in 1.74.8154 of NWN:EE.

In 1.69 the limit of this function was 8KB of text. This has now been increased in 1.74.8154 to 128KB of text. However please be wary of setting a large amount since the player loads it from the server every time it is viewed.




// Part of the code for the OnClientEnter event used on Realms of Mythology PW. 
// Checks to see if the incoming new character has kept the default racial description. 
// Not a good idea to do on a RP PW with a sassy scripting geek!  If their description is the default
// one it is time to sass them!
void main()
    // The object that just entered
    object oPlayer = GetEnteringObject();<br />
    // Check to see if this is a new or returning character.  We only need to check the character 
    // description the very first time they enter.
        // Keep track of if they took the default description
        int bTookDefaultDesc = FALSE;
        // What is their description
        string sCharDesc = GetDescription(oPlayer);
        // What race are they?
            // dwarf
            case 0:
                // Compare the tlk file description (defined in racialtypes.2da) against the character's
                // description.  If they are a perfect match, it is time to sass them!
                if(sCharDesc == GetStringByStrRef(8157))
                {   bTookDefaultDesc = TRUE;    }
            // elf
            case 1:
                if(sCharDesc == GetStringByStrRef(8158))
                {   bTookDefaultDesc = TRUE;    }
            // gnome
            case 2:
                if(sCharDesc == GetStringByStrRef(8159))
                {   bTookDefaultDesc = TRUE;    }
            // halfling
            case 3:
                if(sCharDesc == GetStringByStrRef(8160))
                {   bTookDefaultDesc = TRUE;    }
            // half elf
            case 4:
                if(sCharDesc == GetStringByStrRef(8161))
                {   bTookDefaultDesc = TRUE;    }
            // half orc
            case 5:
                if(sCharDesc == GetStringByStrRef(8162))
                {   bTookDefaultDesc = TRUE;    }
            // human
            case 6:
                if(sCharDesc == GetStringByStrRef(8163))
                {   bTookDefaultDesc = TRUE;    }
        } // switch(GetRacialType(oPlayer)))
        // Deal with them if they were stupid
        if(TRUE == bTookDefaultDesc)
            // Scold the player
              "(( Shame on you!  Logging into a RP server and using the default racial description. ))");
            // Set the character's description
              "(( I am a lazy bum who has no interest in taking a few minutes to bring a bit of life to my character. ))");
        } // if(TRUE == bTookDefaultDesc)
        // Set the test flag so this check is only done once.
    }  // if(FALSE == GetCampaignInt... 
} // END of void main()

See Also


GetDescription StringToRGBString

author: Mistress, contributor: Cereborn