Making New Controls?

Post » Thu Jun 21, 2012 9:36 am

Hi,
I'm new to modding, and for my first mod, I want to customize the controls in Skyrim to make it work with my own homemade controller. My goal is to have a certain key on the keyboard (One that is not already used) activate an action done by the player. For example pressing "g" would make the player do a power attack with a sword from above, and pressing "h" would make the player do a side attack with a sword, etc. Is this possible, and if so, how would I do this? Which keys are not already used?

Thanks,
-Dylan
User avatar
djimi
 
Posts: 3519
Joined: Mon Oct 23, 2006 6:44 am

Post » Thu Jun 21, 2012 9:08 am

Not really possible.

There is a topic about HotKeys for Followers, but I'm not sure it will be helpful to you? Have a read and see what you think ...

http://www.gamesas.com/topic/1374073-please-help-me-on-expanding-my-follower-hotkey-script/
User avatar
Lakyn Ellery
 
Posts: 3447
Joined: Sat Jan 27, 2007 1:02 pm

Post » Thu Jun 21, 2012 5:04 pm

You can use SKSE's IsKeyPressed to poll for input. Soon'ish, there will be input events which should prove 'cheaper'.

To do/undo something:
Spoiler
Bool bDoSomethingBool bHotkeyPressedInt iHotkey = 54 ; R-ShiftEvent OnUpdate()	If bHotkeyPressed != Input.IsKeyPressed(iHotkey)		bHotkeyPressed = !bHotkeyPressed ; Set bool to whatever it is not		If bHotkeyPressed ; Ignore key release			bDoSomething = !bDoSomething			If bDoSomething				; Do stuff			Else				; Undo stuff			EndIf		EndIf	EndIf	RegisterForSingleUpdate(0.1)EndEvent

Which keys are not already used?
That will vary greatly from player to player, thus it's best to allow rebinding.

To rebind a hotkey:
Spoiler
Int iHotkeyEvent SomeEvent()...	iHotkey = 0	iHotkey = GetNewHotkey()...EndEventInt Function GetNewHotkey(Int aiDXScanCode = 0)	Debug.Notification("Press and hold an unused key...")	Utility.Wait(1)	While !Input.IsKeyPressed(aiDXScanCode)		aiDXScanCode += 1		If aiDXScanCode == 265			aiDXScanCode = 1			Debug.Notification("Press and hold an unused key...")		EndIf	EndWhile	Debug.Notification("New key selected: " + aiDXScanCode)	Return aiDXScanCodeEndFunction
User avatar
amhain
 
Posts: 3506
Joined: Sun Jan 07, 2007 12:31 pm


Return to V - Skyrim