FloatingTextStringOnCreature bug

I didn’t understand why sometimes messages didn’t show in my scripts, and I found out that FloatingTextStringOnCreature only works on PCs (NPCs, even if they joined the party and are controlled by the player, won’t be considered as PC).
The workaround is quite easy though: just replace FloatingTextStringOnCreature(sStringToDisplay, oCreatureToFloatAbove, bBroadcastToFaction, nStartColor, nEndColor, fSpeed, vDirection) with
AssignCommand(oCreature, SpeakString("<color=???> + sStringToDisplay + "</color>")
This is not an ideal solution though, as you lose the change in colors (from nStartColor to nEndColor - in addition, you also need to use strings and not numbers for the colors) and you can’t set how long the text will float above the character.

That’s intended behaviour:

This function will not work on placeable objects of any kind, and text targeted to NPCs will never be visible to PCs.

Strange…

Which is the reason of my post :wink:

you could set bBroadcastToFaction TRUE

so when controlling a companion, the player will see the message … but it will print twice to chat. Once for the companion and again for the PC

i consider this a bug and prefer the SpeakString() method myself,

/iirc

Will SpeakString provide a floating text above the head though?

it appears, but doesn’t float up (iirc)

for color I do things like this

AssignCommand(oTarget, SpeakString("<c=#99BB00>Dazed !</c>"));

@kevL_s doesn’t NwN2 have StringToRGBString()? In NwN the function StringToRGBString(string sStringToColour, string sColourCode) takes two strings as its parameters and returns a colour encoded string. Which is why I made this simple html page for downloading.

TR

i don’t see StringToRGBString() in nwscript.nss or the stock #includes

but there is Nwn2_Colors.2da that maps the standard (web) colornames to hex values.

eg, AliceBlue=F0F8FF

usually I use colornames, but for whatever reason went with hex when adding mind-affected states into spellscripts: Dazed, Confused, Stunned, etc etc …

it’s simple enough to use pseudo-html. don’t know if it accepts octal tho,

If not it should be simple enough to write a routine to do so. Here are the actual values I used for that html document. (table made using markdown)

Octal Denary Hex
0 0 00
1 36 24
2 73 49
3 109 6D
4 146 92
5 182 B6
6 219 DB
7 255 FF

TR

1 Like