How to make NPC send PC a private message in convo side of chat window?

I want an NPC to send a PC a message that only that target PC (not other party members or other nearby PCs) can see and I want the message to show in the conversation part of the chat window, not in the combat message side. Is there a way to do this? (Obviously, SendMessageToPC() makes it easy to do this in the combat side of the chat window.)

Do you want just a message or do you want the entire conversation to be hidden?

SS, I was thinking just a message. Essentially, I am looking for the same functionality as SendMessageToPC(), but only broadcast to the target PC.

You probably want to look at this SetPCChatMessage()

that can clear out the message so that other players don’t see it.

I had the impression that that function only worked as part of an OnPlayerChat event. Is that not the case? Does SendMessageToPC() somehow trigger the chat event?

If a player hasn’t entered anything in the chat bar, there is no message to work with. For instance, assume I have an NPC and I want to send a message to a PC “NPC whispers that you should talk to the guard.” How would I do that using the chat event functions?

You need NWNX for that.

I was worried that was the case. Thanks, Shadooow.

however shout and probably whisper too works. SpeakString allows to specify TALK_VOLUME, but obviously not “Tell”. And another issue is that the npc cannot speak a multilanguaged line. All players will see same text - that was the reason I switched to NWNX as I needed to shout a text that would appear as A to english speaking players and B to czech speaking players.

I got the impression BW was thinking anyone supporting multiple languages would use the DLG files. More options for that sort of support can’t help but be a benefit to the game.

Anyway, I have resorted to wrapping SendMessageToPC and SpeakString in a custom function that uses the latter for “normal” messages and then uses the former for “private” messages that I don’t think other nearby PCs should be hearing. Those private messages have to show up in the combat side of the chat window, but I have them in a custom color and prefixed by the NPC name so that it’s more clear that they are private chatter. Not exactly what I wanted, but I think it will work.

PostString allows you to message just one PC, albeit not in the chat window, but at any screen location of your choice.

I am maintaning the (in my knowledge) the only multilanguaged multiplayer server for NWN. And it wouldn’t be possible without NWNX.

But some limited functionality is there. In all text fields in toolset there is the “…” button which lets you specify text in another language.

And with GFF editor you can set TLK line reference if you know how.

Ultimately putting a conversation or npc names/description into TLK is bad idea. Especially now in NWN-EE where the multilanguage support is actually worse than in 1.69 - servers using nwsync no longer have the option to provide different language TLK files.

Also there are extremely annoying issues in toolset where it messes up the TLK reference anytime you open the blueprint of creature/item/placeable/other having one. So the best solution is to get rid of tlk reference, delete it via GFF editor/letoscript-moneo and input the names in all languages you want to support manually.

Eitherway, this functionality is not something you can/should be using for the problem you want to solve. Player has its language and it cannot change during gameplay. And you cannot specify in script that the npc will speak a text from specific language either.

What you want to do can be solved by:
SendMessageToPC
PostString
NWNX and SendChatMessage function which allows to send chat message (of any volume type) to specific player.

Also there are extremely annoying issues in toolset where it messes up the TLK reference anytime you open the blueprint of creature/item/placeable/other having one.

Just because I am unfamiliar with this and it sounds like a problem I want to avoid, can you describe this, or point to a thread where someone is describing it? Are you saying that the Toolset changes the number of a string reference that was set earlier when you edit some other field in the resource?

I posted it on Beamdog’s current bug tracker. Maybe this time they decided to fix it.

2 Likes