FloatingTextStringOnCreature(string, object, int)
Briefly displays ambient text above targets head and puts it in the chat log.
- Message to display.
- Creature to display the message over.
- If this is TRUE then only creatures in the same faction as oCreatureToFloatAbove will see the floating text, and only if they are within range (30 meters). (Default: TRUE)
Displays ambient text that floats up into the air above the target creature's head and fades out. It also displays it in the chat log like SendMessageToPC. Unlike SpeakString, the creatures name isn't displayed before the text. However, the visibility of the text is limited (see Remarks below).
If bBroadcastToFaction is TRUE, the targeted creature and its faction within 30 meters will see the text. If bBroadcastToFaction is FALSE, then only the targeted creature will see it. This is useful to message the entire PCs party about something happening to one of their members (player or companion).
This function seems to be most useful for notifying PCs (and possibly their party) of in game effects (detections, environmental perceptions, etc), and not as a way to facilitate PC-to-creature communication. For instance, if a PC passes a Listen check they could be notified via Ambient Text (*You hear footsteps coming down the hall*). Other uses could include Onomatopoeia originating from the PC (*Snap!*, *Cough!*, *Hick!*) and brief game feedback (simulate an overheard conversation, time from a sundial, item status, etc).
This function will only work on creatures thus not work on placeable objects of any kind, and text targeted to NPCs will never be visible to non-party PCs. You can simulate text coming from a sign, sundial, or any other placeable object by assigning oCreatureToFloatAbove as the PC you want to notify, as long as the PC is near to the object when the text will appear.
You can change the color of the text shown using StringToRGBString.
// The sundial only works during the day. If it is
// day, the sundial will display the time only above
// the PC's head.
// get the user, assume it is a PC
object oPC = GetLastUsedBy();
// Check to see if it is day
// Initialize variables
int nHour = GetTimeHour();
string sTime = IntToString(nHour) + " o'clock";
// Display time only above the PC's head
FloatingTextStringOnCreature(sTime, oPC, FALSE);
// If it is night, tell player he can't determine time
FloatingTextStringOnCreature("There is no sun to cast " + "a shadow on the sundial.",
FloatingTextStrRefOnCreature SpeakString StringToRGBString SendMessageToPC
author: Ryan Hunt, editor: Charles Feduke, additional contributor(s): Erik Jones, Douglas Appelt