View Full Version : GM Portrait change in Chat Window (NPC portaits Idea?)

Lord Kavos
December 27th, 2014, 15:19
I found some ideas for changing the GM token in the chat window, so I worked out a basic extension to do that.

(Actually one my players sent me the image of the DM from the old D&D cartoons & thought it would be cool for me to use...)

Got me thinking, if you could change it, could you then use it for NPCs too?

Not sure if could be simple extension, or a core change...thought i'd throw the idea out here & see if anyone has any ideas on how it could work.

It would be cool to link it to the NPC bubbles that change the speaker in chat, but that's probably a core mechanic change & would be a wish list item maybe...

Here's my extension if it helps.

December 27th, 2014, 15:32
Images appearing the chat window need to be static ruleset (or extension) icon resources. So, you could change the chat icon through an extension (for different NPC speakers, etc.) but you'd always be limited to a preset number of icons defined in the ruleset/extension.

To link it to a speaker you'd need some way of mapping the speaker name to one of these pre-defined icon resources.

January 4th, 2015, 06:15
My idea for this was to actually have the NPC portrait set using code similar to the PC portraits (a portrait/token setup like the PC)... then tweak the code for GM chat to use the NPC portrait when the GM has that ID. Seems like it wouldn't be too bad to do, basically bring the code from PC portraits over to the NPC... and then change the chat stuff a bit.

January 4th, 2015, 06:22
... and then change the chat stuff a bit.
That's the problem - as I mentioned above, you can't change the chat icon dynamically. It has to be a pre-defined graphical resource in the ruleset (or an extension). You have to use an icon: http://www.fantasygrounds.com/refdoc/icon.xcp which references a graphics file within a ruleset or an extension, not outside of those or any other FG graphic resource - i.e. you can't use portraits, tokens, images - it has to be an icon resource: refer to the "icon" entry in the "message data structure" section here: http://www.fantasygrounds.com/refdoc/Comm.xcp

As mentioned above, you could make a bunch of pre-defined icons, but you would be limited to just those icons.

January 4th, 2015, 06:41
The player portraits change dynamically.. I don't see why this couldn't be made to work the same way.

January 4th, 2015, 06:53
The player portraits change dynamically.. I don't see why this couldn't be made to work the same way.
Hhhmmm, you've got a good point there...

January 4th, 2015, 07:05
It appears that the PC portraits are generated automatically, if the relevant <portraitset> parameters are set: http://www.fantasygrounds.com/refdoc/portraitset.xcp

This is very specific to the portrait allocation for PCs and uses the player side identity to generate the token.

As this is something that is built into the base FG application, and is specific to player portraits, I don't think it will be possible to use this to generate GM portraits dynamically.

Lord Kavos
January 4th, 2015, 09:12
Is it possible to write an extension that allows choice of a portrait?

You would only need 4-5 portraits for an adventure (usually), and if you could place them in the same folder & have some functionality to select them in fg?

Lord Kavos
January 4th, 2015, 09:16
[QUOTE=Trenloe;195781 As mentioned above, you could make a bunch of pre-defined icons, but you would be limited to just those icons.[/QUOTE]

Could you define these icons, rename the images to match the names of these files? As I said above would need some functionality to select between them...

January 4th, 2015, 17:29
Could you define these icons, rename the images to match the names of these files? As I said above would need some functionality to select between them...
Yes, but you would have to put them in an extension. i.e. repackage your extension each time you change the icon graphics file.

Then, as you say, there would need to be code that recognizes some keyword/markup in the chat text that ties it to a specific icon resource.

January 5th, 2015, 02:16
I'm tapped into this whole issue primarily not for the chat window issues (that's kinda a side benefit) but because I need my NPCs to use a HEX mask instead of a square image for tokens. I'm not sure that 4 or 5 images would be enough.. but it actually doesn't matter because if you can do 4 or 5 you can do all your NPCs.

It is sounding like it could be tough to pull off. I'm getting that the PC images are tied to their ID... hrm.. it changes when I have multiple PCs ... seems like there should be a way to come at this that will work.

January 5th, 2015, 02:22
Experiment with the <portraitset> values I mentioned above. Look at graphics\graphics_portraits.xml

July 26th, 2016, 23:04
Sorry to rez this zombie thread, but this would be an excellent feature to have. When the players have these beautiful portraits down the chat frame and the multiple NPC's they are interacting with all say GM, it feels like something is wrong or broken.

I'm not very familiar with extension dev (though i ought to start), it seems like if a hook can be called, it could hook in when a chat bubble is selected or the "speak as" command is initiated, it mimics the portraitselectioncontrol and sets the GM with a new portrait, loaded into memory at the moment from the NPC selected. I will have to do some light extension dev reading.

July 27th, 2016, 00:16
@sturtus - see my comments earlier in this thread. The GM's icon cannot be the dynamic, the best you can do is have a preset number of icons defined in the extension and change those.

July 27th, 2016, 18:46
Adding to the feature requests!

April 21st, 2017, 10:32
Resurrecting this thread from the dead again to provide a workaround!

While there may not be a way to dynamically change the DM icon, a somewhat-clunky but functional workaround is to load up a second instance of Fantasy Grounds (which I think many DMs usually have running anyway, to see what their players see), log in as a player (not as DM), and just have a blank "NPC" character sheet ready. Then if the party starts chatting with Elminster, on this guest FG window I activate the blank NPC sheet, change the name to Elminster and select the Elminster portrait pic that I've prepared in advance. Essentially, a new PC named Elminster joins the party temporarily, and by chatting through him on the guest screen, his portrait shows up in the chat window next to whatever he says. (You could also set up multiple NPC sheets in advance and have their names and portraits already set.)

Since players can control multiple PCs, you can even open a second PC sheet on the guest window and have multiple NPCs talking with portraits. (Just be sure to click the NPC you are speaking as before chatting!)

If you want to get even trickier, you can also set up Story/Note pages in advance with pre-typed dialogue, and as long as you click back-and-forth between your various NPCs properly, you can carry out a fully portraited conversation this way. Two things: you must designate speakers with any pre-typed dialogue, or it just shows up as "Guest". And secondly, you need to make sure the active NPC sheet matches the designated speaker name, or it will show the wrong portrait next to the name. On the attached image, you can see what happens when I don't do these two things properly.

It's not perfect, but I think it works pretty well! Players will see NPC portraits show up at top in the "party" area, but really that's the only thing they should notice that's out of the ordinary. :)


April 21st, 2017, 19:50
Very clever!

April 22nd, 2017, 00:20
+1 for making Elminster a halfling.