Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Scripts/Source/MantellaMCM.psc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Event OnOptionHighlight (Int optionID)
SetInfoText("Periodically reminds the player it is their turn to speak / input text.")

elseIf optionID == oid_keymapStartAddHotkey
SetInfoText("Either starts a conversation or adds an NPC to a conversation.")
SetInfoText("Either starts a conversation or adds an NPC to a conversation. Press & hold on an NPC to remove them. Press while targeting one npc and release while targeting another to start a radiant conversation. ")
elseIf optionID == oid_keymapPromptHotkey
SetInfoText("Opens the text prompt or starts the mic recording depending on the context and the microphone options above. \nDefault: H")
elseIf optionID == oid_keymapEndHotkey
Expand Down
49 changes: 43 additions & 6 deletions Scripts/Source/MantellaRepository.psc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ bool property NPCdebugSelectModeEnabled auto
int property HttpPort auto


MantellaConversation conversation

event OnInit()
conversation = Quest.GetQuest("MantellaConversation") as MantellaConversation
assignDefaultSettings(0, true)
endEvent

Expand Down Expand Up @@ -267,24 +270,22 @@ bool function restartMantellaExe()
; Check the corresponding commented out OnUpdate at the beginning of the script.
EndFunction

Actor startConversationKeyDownTargetedActor
Event OnKeyDown(int KeyCode)
;this function was previously in MantellaListener Script back in Mantella 0.9.2
;this ensures the right key is pressed and only activated while not in menu mode
if !utility.IsInMenuMode()
if KeyCode == MantellaStartHotkey
Actor targetRef = (Game.GetCurrentCrosshairRef() as actor)
if (targetRef) ;If we have a target under the crosshair, cast sepll on it
MantellaSpell.cast(PlayerRef, targetRef)
;Utility.Wait(0.5)
endIf
startConversationKeyDownTargetedActor = targetRef
endIf
elseIf KeyCode == MantellaListenerTextHotkey
If(!microphoneEnabled) ;Otherwise, try to open player text input if microphone is off
MantellaConversation conversation = Quest.GetQuest("MantellaConversation") as MantellaConversation
if(conversation.IsRunning())
conversation.GetPlayerTextInput()
endIf
elseIf (useHotkeyToStartMic)
MantellaConversation conversation = Quest.GetQuest("MantellaConversation") as MantellaConversation
if(conversation.IsRunning())
conversation.sendRequestForVoiceTranscribe()
endIf
Expand All @@ -297,7 +298,6 @@ Event OnKeyDown(int KeyCode)
MantellaEndSpell.cast(PlayerRef)
endIf
elseIf KeyCode == MantellaCustomGameEventHotkey
MantellaConversation conversation = Quest.GetQuest("MantellaConversation") as MantellaConversation
if(conversation.IsRunning())
UIExtensions.InitMenu("UITextEntryMenu")
UIExtensions.OpenMenu("UITextEntryMenu")
Expand All @@ -316,4 +316,41 @@ Event OnKeyDown(int KeyCode)
endIf
endIf
endIf
endEvent



Event OnKeyUp(int KeyCode, Float HoldTime)
Float longPressTime = 0.6
;this function was previously in MantellaListener Script back in Mantella 0.9.2
if !utility.IsInMenuMode()
if KeyCode == MantellaStartHotkey
Actor targetRef = (Game.GetCurrentCrosshairRef() as actor)

; Add the actor to the conversation that was targeted when the key was pressed
if targetRef == none || targetRef == startConversationKeyDownTargetedActor && startConversationKeyDownTargetedActor != none
if (HoldTime < longPressTime)
MantellaSpell.cast(PlayerRef, startConversationKeyDownTargetedActor)
Else
MantellaRemoveNpcSpell.cast(PlayerRef, startConversationKeyDownTargetedActor)
endif
endif

; Add the actor to the conversation that was targeted when the key was let go
if targetRef != none && startConversationKeyDownTargetedActor == none
if (HoldTime < longPressTime)
MantellaSpell.cast(PlayerRef, targetRef)
Else
MantellaRemoveNpcSpell.cast(PlayerRef, targetRef)
endif
endif

; Start a radiant conversation, if the target of the keyDown is different from keyUp
if targetRef != none && startConversationKeyDownTargetedActor != none && startConversationKeyDownTargetedActor != targetRef && !conversation.IsRunning()
MantellaSpell.cast(startConversationKeyDownTargetedActor, targetRef)
endif

startConversationKeyDownTargetedActor = none
endIf
endIf
endEvent