Jump to content

Custom Keybind in Papyrus Not Working


DarkWolfModding

Recommended Posts

I wanted to make a weather changer menu mod but I have ran into a speedbump, I want to have a custom keybind show the menu (F2 for non experimental weathers) and (F3 For Experimental Weathers). But I have used the OnKeyDown and OnKeyUp syntax and neither work for the keybind. I have done keybkinds for Skyrim but Fallout 4 seems to not be as easy.

 

Heres the important code of my script (so Far):

 

Event OnInit()
Notification("Weather Changer Menu: Registering Keybinds (F2) and (F3)...")
RegisterForKey(113) ;F2 Key, Non Experimental Menu
RegisterForKey(114) ;F3 Key, Experimental menu
StartTimer(1.0, 1)
wait(3)
Notification("Weather Changer Menu: Keybinds Registered...")
wait(3)
Notification("Weather Changer Menu: Initalization complete...")
Wait(3)
Notification("Weather Changer Menu: Use (F2) for Non experimental menu")
Wait(3)
Notification("Weather Changer Menu: Use (F3) for Experimental Menu")
EndEvent

Event OnQuestInit()
Notification("Weather Changer Menu: Keybind (F2) - Non Experimental Menu")
wait(3)
Notification("Weather Changer Menu: Keybind (F3) - Experimental menu")
EndEvent

Event OnTimer(int aiTimerID)
if (aiTimerID == 1)
RegisterForKey(113) ;F2 Key, Non Experimental Menu
RegisterForKey(114) ;F3 Key, Experimental menu
EndIf
EndEvent

Event OnKeyUP(int keyCode, float time)
if(keyCode == 113 && time > 1.0) ;F2 Key, Non Experimental version
MenuNonExperimental()
ElseIf(keyCode == 114 && time > 1.0); F3 Key, Use Experimental Features
MenuExperimental()
EndIf
EndEvent

Function MenuNonExperimental(Bool abMenu = True, Int aiButton = 0)
While(abMenu)
If(aiButton != -1) ;Wait For Input, Prevents issues
aiButton = Menu_Main_NonExperimental.show()
If(aiButton == 0); Commonwealth Weathers

ElseIf(aiButton == 1); DLC Far Harbor Weathers

ElseIf(aiButton == 2); DLC Nuka Wold Weathers

ElseIf(aiButton == 3);Settings Menu

ElseIf(aiButton == 4); Exit Menu
wait(2)
abMenu = False; exit menu Function
EndIf

EndIf
EndWhile
EndFunction

Function MenuExperimental(Bool abMenu = True, Int aiButton = 0)

EndFunction

 

 

 

Heres a link to the entire script if you need it: Here

 

 

PS: I'm fairly knowledgeable on papyrus, been doing it for years so you can talk programmer Talk

Link to comment
Share on other sites

I reinstalled F4SE and my mods and it works now for some reason. Must of had a weird conflict with a mod or something
Link to comment
Share on other sites

These kind of weird things happen to me a lot, phantom bugs I call them.

 

On a separate note I hope F4SE can get keypress emulation like SKSE one day

Link to comment
Share on other sites

  • Recently Browsing   0 members

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