Jump to content

Papyrus: check if player is currently in any kind of conversation


Dutchygamer

Recommended Posts

I've been using the Hardcore_HC_EncumbranceEffect_CastScript to apply periodic radiation damage to the player as an addiction effect. This all works well, until it applies the effect during a conversation with an NPC. The radiation gets applied correctly, but the conversion and NPC just... breaks. You get stuck in the conversation window with no way to continue or exit, and walking away and returning to the NPC just returns to the broken conversation window. As far as I've tested this is permanent; even switching cells doesn't seem to fix the NPC.

 

Now I've read about the VATS Freeze Fix mod (https://www.nexusmods.com/fallout4/mods/27674) which adds an enqueing system for ingestibles during VATS, which will then apply these after VATS has ended.

Inspired by this, I want to try to do the same for Hardcore_HC_EncumbranceEffect_CastScript (or better said, my own copy of it). However, I am unable to find if there is actually any way to detect from Papyrus script whether the player is in conversation with anyone.

 

Is what I'm looking for possible at all? I have F4SE available to me if that offers the functionality I'm looking for.

Link to comment
Share on other sites

I have used Player.IsInScene() to test for conversation.

 

It does not detect single interaction topics like settler "lets trade", Utility.IsInMenuMode() will trap that endpoint.

 

IsInScene is also apparently a condition, but never used it.
Link to comment
Share on other sites

Unless scripted queing is so vital here, then Spell / Mgef Conditions could be used to block actual final effect: IsInDialogueCamera (seems to work) and IsPlayerInConversation (don't know). This way no new script needs be added.

Edited by hereami
Link to comment
Share on other sites

Thanks for all the quick answers! I've managed to cook up the following which seems to work perfectly:

Function TryCastSpellAndStartTimer()
	if IsBoundGameObjectAvailable() ;is effect still running on a legit object?
        actor actorRef = GetTargetActor()
        var isInVATS = (Game.IsMovementControlsEnabled()) == false
        var isInScene = actorRef.IsInScene()
        var isInTrade = Utility.IsInMenuMode()

        ; player should not be in VATS, not be in a conversation and not be trading
        If (!isInVATS && !isInScene && !isInTrade)
            CastSpellAndStartTimer()
        ; if so, put on the queue and retry after a second
        Else
            StartTimer(1, equipDelayTimerId)
        EndIf
    EndIf
EndFunction

When in conversations it no longer triggers the effect, and afterwards it does.

 

Unless scripted queing is so vital here, then Spell / Mgef Conditions could be used to block actual final effect: IsInDialogueCamera (seems to work) and IsPlayerInConversation (don't know). This way no new script needs be added.

Could be a solution as well. However, as the original script (and my current version) also displays a small notification when it triggers, it is odd that it displays the notification when no damage occurs.

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...