rcoll Posted February 25, 2022 Share Posted February 25, 2022 (edited) I've written this short test script. It's basically meant to bring up a message box every 10 seconds that displays the players current dialogue target. The problem is when outside of conversation, instead of returning a Null as I expected, it returns the last person I spoke to. Would anyone mind running this code in their game so I can see if it acts the same way? Scriptname GetDialogueTargetTestScript extends Quest Actor Property Player Auto Mandatory int MyTimerID = 1 Event OnQuestInit() StartTimer(10, MyTimerID) EndEvent Event OnTimer(int aiTimerID) if (aiTimerID == MyTimerID) debug.messagebox("Player Dialogue Target Returns: " + Player.GetDialogueTarget().GetActorBase().GetName()) debug.Trace("Player Dialogue Target Returns: " + Player.GetDialogueTarget().GetActorBase().GetName()) StartTimer(10, MyTimerID) endIf EndEvent Edited February 25, 2022 by rcoll Link to comment Share on other sites More sharing options...
SKKmods Posted February 25, 2022 Share Posted February 25, 2022 Yes that happens. Best I could do is wrap it in a if (pPlayerREF.IsInScene() == true) test. BUT that does not capture non scene based hellos and such one liners. Link to comment Share on other sites More sharing options...
rcoll Posted February 25, 2022 Author Share Posted February 25, 2022 (edited) Yes that happens. Best I could do is wrap it in a if (pPlayerREF.IsInScene() == true) test. BUT that does not capture non scene based hellos and such one liners.Thanks. I had hoped it wasn't just my install. I couldn't find much info on the function and the creation kit wiki was a bit...minimal. IsInScene() could work, but yeah that isn't ideal. I'll have another comb of the wiki and see if I can find anything. EDIT: Think I might have found something in the IsInDialogueWithPlayer() function. Need to test this. Edited February 25, 2022 by rcoll Link to comment Share on other sites More sharing options...
rcoll Posted February 25, 2022 Author Share Posted February 25, 2022 (edited) Aha! It looks like it can check if the player is actually in dialogue with the target (or at all) in a sort of roundabout way by running IsInDialogueWithPlayer() on the player's current dialogue target. Scriptname GetDialogueTargetTestScript extends Quest Actor Property Player Auto Mandatory int MyTimerID = 1 Event OnQuestInit() StartTimer(10, MyTimerID) EndEvent Event OnTimer(int aiTimerID) if (aiTimerID == MyTimerID) debug.messagebox("Player Dialogue Target Returns: " + Player.GetDialogueTarget().GetActorBase().GetName() + ", Is Currently talking to Target: " + Player.GetDialogueTarget().IsInDialogueWithPlayer()) debug.Trace("Player Dialogue Target Returns: " + Player.GetDialogueTarget().GetActorBase().GetName()) StartTimer(10, MyTimerID) endIf EndEvent I have to wonder what the purpose of holding on to the last npc you spoke to would be though. I suppose it could be useful in some situations, but it really should be pointed out on the function's wiki page. Edited February 25, 2022 by rcoll Link to comment Share on other sites More sharing options...
LarannKiar Posted February 25, 2022 Share Posted February 25, 2022 I have to wonder what the purpose of holding on to the last npc you spoke to would be though. I suppose it could be useful in some situations, but it really should be pointed out on the function's wiki page. I'm not sure but maybe it's because if GetDialogueTarget() is called shortly after a Scene (or any other dialogue, Topic Info, etc..) has already been ended, it would always return false. (If GetDialogueTarget() is called by a quest script event OnStageSet and this stage was set by a "Scene On End >> Set parent quest stage", the dialogue would end by the time the function is actually called by the quest script). I think the game engine clears the dialogue target after a short time though. Link to comment Share on other sites More sharing options...
rcoll Posted March 6, 2022 Author Share Posted March 6, 2022 (edited) UPDATE: Turns out IsInDialogueWithPlayer() will not pickup hellos and one-liners either :sweat: It will also return false in a scene with multiple actors when your Dialogue Target starts talking to someone else, so IsInScene() would be the better choice here I think. Actually now that I think about it, hellos and one-liners don't actually need to be picked up for what I'm trying to do anyway. I'll need to do some testing with IsOnScene() though, as the Scene mechanic can be a bit odd at times. For greater context: I'm trying to have the game tell whether a dialogue scene is currently playing, for an issue I'm having with another mod.Player.IsInScene() works when I'm talking to one npc. But in a scene with multiple actors, when the dialogue shifts to npcs talking to eachother, Player.IsInScene() returns False (the initial scene has ended, and the game transitioned to another scene that doesn't include the player) until the player is involved in the conversation again. I'm not sure but maybe it's because if GetDialogueTarget() is called shortly after a Scene (or any other dialogue, Topic Info, etc..) has already been ended, it would always return false. (If GetDialogueTarget() is called by a quest script event OnStageSet and this stage was set by a "Scene On End >> Set parent quest stage", the dialogue would end by the time the function is actually called by the quest script). I think the game engine clears the dialogue target after a short time though. Ah that would make sense. It looks like the game does clear npc's dialogue targets after about 20-30 seconds, but the player's seems to just stick. Maybe it just takes longer though...Another interesting quirk I've noticed is that the player's target will change to themself when they say random lines in the world (or gasp for air when they run out of breath), meaning it will take even longer to clear. Edited March 7, 2022 by rcoll Link to comment Share on other sites More sharing options...
LarannKiar Posted March 7, 2022 Share Posted March 7, 2022 UPDATE: Turns out IsInDialogueWithPlayer() will not pickup hellos and one-liners either :sweat: It will also return false in a scene with multiple actors when your Dialogue Target starts talking to someone else, so IsInScene() would be the better choice here I think. Actually now that I think about it, hellos and one-liners don't actually need to be picked up for what I'm trying to do anyway. Another interesting quirk I've noticed is that the player's target will change to themself when they say random lines in the world (or gasp for air when they run out of breath), meaning it will take even longer to clear. Different Dialogue Subtypes have different dialogue targets. See Quest tabs: Player Dialogue - PlayerCommand dialogue - Command targetCombat - Combat targetFavors - PlayerDetection - Player (I guess..)Misc - depends on the Topic. (i.e. NoticeCorpse - the body is the "dialogue target"). For greater context: I'm trying to have the game tell whether a dialogue scene is currently playing, for an issue I'm having with another mod.Player.IsInScene() works when I'm talking to one npc. But in a scene with multiple actors, when the dialogue shifts to npcs talking to eachother, Player.IsInScene() returns False (the initial scene has ended, and the game transitioned to another scene that doesn't include the player) until the player is involved in the conversation again. You might want to keep the dialogue target in a variable until the scene ends. When it ends, clear the variable. Actor DialogueTarget Event OnTimer(int aiTimerID) (...) Actor PlayerRef = Game.GetPlayer() If PlayerRef.IsInScene() DialogueTarget = PlayerRef.GetDialogueTarget() Scene PlayerScene = PlayerRef.GetCurrentScene() RegisterForRemoteEvent(PlayerScene, "OnEnd") EndIf (...) EndEvent Event Scene.OnEnd(Scene akSender) DialogueTarget = None EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts