There is no "elegant" way of doing it, but it can be done.
You need a seperate quest (Say MonitoringQuest) with a single optional alias assigned using "Find Matching Reference [X] In Loaded Area" withMatch condition set to "IsInDialogueWithPlayer". Add a Stage 0 marked as Start up [X] and add a script fragment that checks the alias
If you just need an immediate check, you could add a Quest Script with a Bool or even use a GlobalVariable:
Spoiler (self As Quest) As SomeQuestScript).IsInDialogue = (SomeAlias && SomeAlias.GetActorRef()
Mark the Stage 0 as [X] Completes Quest.
Then from you main quest, inject the Monitoring Quest like so:
Spoiler MonitoringQuest.Start()if (MonitoringQuest As SomeQuestScript).IsInDialogue;;;Do StuffendifMonitoringQuest.Stop()
Notice how I start and stop the quest before and after the check. Aliases are only filled when quests begin.
If you also need a reference to the Person the player is talking to:
MonitoringQuest.GetAlias(0).GetActorRef()
Should work until you call Stop()
If you want to know any time the player enters dialogue in general (and with whome), your second quest will have to continually poll the monitoring quest.
You could do it all from the Main Quest:
Spoiler Event OnUpdate() MonitoringQuest.Start() ReferenceAlias NPCRef = MonitoringQuest.GetAlias(0) As ReferenceAlias if (NPCRef && NPCRef.GetActorRef()) OnPlayerDialogue(NPCRef.GetActorRef()) endif MonitoringQuest.Stop()endEventFunction OnPlayerDialogue(ObjectReference ActorRef) ;; Do Stuff..EndFunction
Hopefully that is not your desire because polling isn't elegant. Looping scripts remain resident in save games even after a mod is disabled. Basically this technique makes your mod harder to uninstall. You will probably need to provide a mechanism for users to disable your monitoring loop before uninstalling (Say a break-out boolean check in the loop).
It is a shame that the SM Event Node "Player Activate Actor" doesn't work as it would be so much nicer to not use continuous polling.
If general notification is your goal, another method I am aware of is to edit the RACES. Most races have a magic effect associated with them. Add a custom magic effect or edit the existing magic effect(s) with a script attached. THe script would allow you to receive the OnActivate() event (which is necessary to start dialogue). Just add a tiny delay before doing the check. This second method doesn't require polling and would give you a more immediate notification, but is going to be much less compatible with mods or even DLC. For example, Dawnguard introduces new custom (DLC specific) races.
And finally, you may be able to do something with a Cloak Spell. Basically add an ability/spell to the player with an area effect. An alternative to polling with a quest that searches the currently loaded area. However a cloak spell approach may not work if the person you are speaking to is too far away (Like up on a balcony like in Dawnguard). You also have to be carefull as Spell Reistance may prevent it from working and you dont want it turning people hostile. I have heard of Cloak Spells breaking Brawls and making people attack the Player because any spell effect is considered cheating in a Brawl.