Jump to content

Play audio with hotkey


Volitio

Recommended Posts

Pretty easy. Setting up a hotkey is quite easy. Just create an empty quest (run once, start game enabled), add a quest script, and make it look something like this:

Scriptname MyHotkeyScript Extends Quest

Int Property MyKey Auto
Sound Property MySound Auto

Event OnInit()

     RegisterForSingleUpdate(1.0)

EndEvent

Event OnUpdate()

     RegisterForMyKey()

EndEvent

Event OnKeyDown(Int KeyCode)

     If KeyCode == MyKey

          MySound.Play()

     EndIf

EndEvent

Function RegisterForMyKey()

    RegisterForKey(MyKey)

EndFunction 

Be sure to fill those properties. MyKey will be based on a number from this list of DXScanCodes.

 

Then create a reference alias for the player (forced, cell - (any), target (PlayerRef)), and add this script to that alias:

Scriptname MyPlayerAliasScript Extends ReferenceAlias

Event OnPlayerLoadGame()

     (GetOwningQuest() as MyHotkeyScript).RegisterForMyKey()

EndEvent

That's all there is to it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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