NWN2Wiki
Advertisement
// Display floaty text above the specified creature.
// The text will also appear in the chat buffer of each player that receives the
// floaty text.
// - sStringToDisplay: String
// - oCreatureToFloatAbove
// - bBroadcastToFaction: If this is TRUE then only creatures in the same faction
//   as oCreatureToFloatAbove
//   will see the floaty text, and only if they are within range (30 metres).
void FloatingTextStringOnCreature(
   string sStringToDisplay, 
   object oCreatureToFloatAbove, 
   int bBroadcastToFaction = TRUE, 
   float fDuration = 5.0
);


Note: The description of this function was not complete in the toolset. The fDuration parameter was added

The description in the toolset omits the following parameters after fDuration: int nStartColor, int nEndColor, float fSpeed, and vector vDirection.

The color constants in the toolset are valid parameters for nStartColor and nEndColor. They are used to simulate a fadeout effect when set to different colors.

It is possible to change both the color and style of sStringToDisplay as it appears in the Player's message box. The string that floats over the character and the string in the box can actually be two different colors, by using NWN2's innate style editing.

Omitting the spaces between < and >, so that it will appear properly on this page.

"< b >Some Text< /b >" would read as Some Text. "< i >Some Text< /i >" would read as Some Text.

Colors are a little different because this style modifications do not use NWN2's color constants. It derives its naming convention from this list. A full list of the colors used in NWN2 can be found in the NWN2_Colors.2da file.

The good news is that whereas NWN1 required you to enter a hexadecimal value, NWN2 will take a name. For example if I wanted text that was brick colored I would write my string as:

"<color=firebrick>Some Text</color>"

Also, remember that you cannot use these around functions. <color=blue>GetName(oPC)</color> will not compile. The correct way to change the color of a string called by a function would be: "<color=blue>" + GetName(oPC) + "</color>", or when linking multiple strings together, "<color=blue>" + GetName(oPC) + " colors the string.</color>". The idea is to treat the style coding as you would any normal string

These style conventions are not limited to this function. NWN2 uses them all over the place. You can use them in strrefs or in item names for example.

Note: The function omits curly braces and any text between them; pipe signs ('|') do not appear in the output either, nor does any text between pairs of pipes. Something to be aware of when using the function for debug output...

Advertisement