Difference between revisions of "Key input"
Jump to navigation
Jump to search
imported>Cid88 |
imported>Cid88 |
||
Line 40: | Line 40: | ||
::That should work perfectly, thank you. As for dual swords.. I needed that too, but just planned to make sword #2 a shield (yet in the story they are both used as sheilds/weapons as needed...). If you come up with anything let me know. :) --[[User:Bky|Bky]] 17:45, 30 May 2006 (EDT) | ::That should work perfectly, thank you. As for dual swords.. I needed that too, but just planned to make sword #2 a shield (yet in the story they are both used as sheilds/weapons as needed...). If you come up with anything let me know. :) --[[User:Bky|Bky]] 17:45, 30 May 2006 (EDT) | ||
::With the new script extender, you can easily detect key presses. | :::With the new script extender, you can easily detect key presses. | ||
http://www.elderscrolls.com/forums&p=7408689 | http://www.elderscrolls.com/forums&p=7408689 | ||
--[[User:Cid88|Cid88]] | --[[User:Cid88|Cid88]] | ||
[[Category: Useful Code]] | [[Category: Useful Code]] | ||
[[Category: Solutions]] | [[Category: Solutions]] |
Revision as of 07:36, 25 July 2006
I need to know how (and if) I can handle key input via script. I need to have both swords with ranged attacks and guns with night vision, so I need ether an alternate fire or a mode change button... but Oblivion has neither. Is there any way key input can be handled? --Bky 06:40, 30 May 2006 (EDT)
- Dragoon Wraith TALK 12:15, 30 May 2006 (EDT): Nope, there's absolutely no way to detect key presses. Luckily for you (sort of), there wasn't in Morrowind, either, and as you might imagine, this was something a lot of people wanted to do. So, your best bet is to detect something you can detect - Sneaking is easiest. Try something like this:
short sneak short switch float timer /index.php?showtopic=511998&view=findpost Begin GameMode set timer to ( timer + GetSecondsPassed ) if ( timer > 2 ) set timer to 0 set sneak to 0 elseif ( player.IsSneaking == 1 ) && ( sneak == 0 ) set switch to ( switch + 1 ) elseif ( player.IsSneaking == 0 ) && ( sneak == 1 ) set switch to ( switch + 1 ) endif if ( player.IsSneaking == 1 ) set sneak to 1 else set sneak to 0 endif if ( switch == 4 ) set switch to 0 ;switch weapon mode endif End
- Basically, "switch" gets increased every time the player hits the Ctrl key (or whatever they have "Sneak" mapped to), and if they hit it four times (I figure no one would hit Sneak four times unless they were deliberately trying to), you activate your code to switch weapon mode or night vision or whatever you're doing.
- I'm not sure how to do this, or if this is even possible, but maybe with your dual swords idea, you can have right-click set for the left-hand weapon/shield. Does anybody know?TheImperialDragon 17:20, 30 May 2006 (EDT)
- Dragoon Wraith TALK 20:26, 30 May 2006 (EDT): I have my right-click set to Cast and middle-click (the mousewheel) set to block.
- That should work perfectly, thank you. As for dual swords.. I needed that too, but just planned to make sword #2 a shield (yet in the story they are both used as sheilds/weapons as needed...). If you come up with anything let me know. :) --Bky 17:45, 30 May 2006 (EDT)
- With the new script extender, you can easily detect key presses.