Medusa30 Posted February 27, 2013 Share Posted February 27, 2013 I tried to make a script to detect if someone is double tapping a key to trigger a spell, but it doesnt seem to work: Scriptname AsenSpiritJump extends ObjectReference {Spirit Jump Ability} import utility import game Spell Property YourSpell Auto Event OnUpdate() if TapKey(GetMappedKey("Forward")) utility.wait(0.4) if TapKey(GetMappedKey("Forward")) YourSpell.cast(Game.GetPlayer()) endif endif EndEvent Also I get this error message for building the script: Starting 1 compile threads for 1 files... Compiling "AsenSpiritJump"... g:\valve\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AsenSpiritJump.psc(10,11): GetMappedKey is not a function or does not exist g:\valve\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AsenSpiritJump.psc(10,4): TapKey is not a function or does not exist g:\valve\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AsenSpiritJump.psc(12,12): GetMappedKey is not a function or does not exist g:\valve\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AsenSpiritJump.psc(12,5): TapKey is not a function or does not exist No output generated for AsenSpiritJump, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on AsenSpiritJump Im using this SKSE http://skyrim.nexusmods.com/downloads/file.php?id=31737 (at least I hope so, cause I didnt found the installer for it and just activated it through NMM). Can you please help me? Link to comment Share on other sites More sharing options...
Ghaunadaur Posted February 27, 2013 Share Posted February 27, 2013 Get SKSE from here http://skse.silverlock.org and extract the archive to the installation folder Link to comment Share on other sites More sharing options...
Medusa30 Posted February 28, 2013 Author Share Posted February 28, 2013 Thanks, but the script is still not working. Link to comment Share on other sites More sharing options...
unuroboros Posted February 28, 2013 Share Posted February 28, 2013 Papyrus requires you to qualify the script that a function is in, unless you "import" it. GetMappedKey is in the Input script. So you need to call it with "Input.GetMappedKey", or use "import Input". Also, make 200% certain that you actually have Input.pex in your Data\Scripts folder. Link to comment Share on other sites More sharing options...
Ghaunadaur Posted February 28, 2013 Share Posted February 28, 2013 I don't really get what you're trying to do with the TapKey function. In my understanding, it's for faking, or simulating a key press by script, not for checking for an actual key press from the player. To be honest, I never made a script for checking a key to be double-tapped before. I tried, and this is what I've got so far: Scriptname AsenSpiritJump extends ReferenceAlias {Spirit Jump Ability} Spell Property YourSpell Auto int ForwardKey int counter bool KeyPressed Event OnInit() ForwardKey = Input.GetMappedKey("Forward") RegisterForKey(ForwardKey) EndEvent Event OnKeyUp(Int KeyCode, Float HoldTime) if KeyCode == ForwardKey RegisterForSingleUpdate(0.1) endif EndEvent Event OnUpdate() counter += 1 if KeyPressed != Input.IsKeyPressed(ForwardKey) KeyPressed = !KeyPressed if KeyPressed YourSpell.cast(Game.GetPlayer()) endif endif if counter <= 3 RegisterForSingleUpdate(0.1) else counter = 0 endif EndEvent For testing, I made a simple quest and put the script on an alias of the player, that's why it extends ReferenceAlias.Maybe the script needs to be tweaked a little to suit your purpose, but I hope it helps. Link to comment Share on other sites More sharing options...
Medusa30 Posted February 28, 2013 Author Share Posted February 28, 2013 (edited) Yeah, that TapKey thing was my mistake, I wanted to create a quickspell script for fast teleporting. Anyway, thank you really much Ghaunadaur & unuroboros! You helped me alot. I tweaked it a bit for my purpose: Scriptname AsenSpiritJump extends ObjectReference {Spirit Jump Ability} import utility import game import input Spell Property YourSpell Auto int ForwardKey int property counter = 0 auto bool KeyPressed Event OnInit() ForwardKey = Input.GetMappedKey("Forward") RegisterForKey(ForwardKey) EndEvent Event OnKeyUp(Int KeyCode, Float HoldTime) if KeyCode == ForwardKey && HoldTime <= 1 counter += 1 RegisterForSingleUpdate(0.01) else counter = 0 endif EndEvent Event OnUpdate() if counter == 2 YourSpell.cast(Game.GetPlayer()) counter = 0 endif if counter <= 3 RegisterForSingleUpdate(0.01) else counter = 0 endif EndEvent It works really nice: by fast tipping the forward key twice the spell (I tested with VoiceIceForm3) was fired, but walking around didnt trigger it, just as intended. BTW: when I tried to load my mod and the flash step mod into the CK for using its teleport spell for further testing, after saving my mod the game started crashing on load screen even if I remove all mods. But thats off-topic. *EDIT*Fixed my Crash issue. Edited February 28, 2013 by Medusa30 Link to comment Share on other sites More sharing options...
unuroboros Posted February 28, 2013 Share Posted February 28, 2013 I'm guessing you needed a clean save? That happens to me a lot, I keep a clean on-hand at all times now. :p I am a big fan of double-tap keybinds in other games (GW2 in particular) so I'm glad you got it worked out! Is this a mod you'll be releasing on Nexus? Link to comment Share on other sites More sharing options...
Medusa30 Posted February 28, 2013 Author Share Posted February 28, 2013 (edited) I'm guessing you needed a clean save? That happens to me a lot, I keep a clean on-hand at all times now. :P I am a big fan of double-tap keybinds in other games (GW2 in particular) so I'm glad you got it worked out! Is this a mod you'll be releasing on Nexus? Not exactly, I needed to repair my game with BOSS and TES5Edit, the save was ok. :P Me too, thats why Im doing it (I love that from GW2, SR3 and the recent Batman games :P). I was looking for mods that adds nagas (you know, those lamia nagas), but didnt find any. So I decided to do the hard work and make a naga race on my own with petrifying eyes, special abilities like flash steps (short range teleports or spirit jumps as I call them) and a couple of other gameplay twists. I wanted to manage that for the cryengine3 first, but I realized that I suck at programming, so I wanted to make a smaller project for Skyrim which is more modding friendly. ;) Edited February 28, 2013 by Medusa30 Link to comment Share on other sites More sharing options...
NeoH4x0r Posted March 29, 2013 Share Posted March 29, 2013 (edited) Papyrus requires you to qualify the script that a function is in, unless you "import" it. GetMappedKey is in the Input script. So you need to call it with "Input.GetMappedKey", or use "import Input". Also, make 200% certain that you actually have Input.pex in your Data\Scripts folder.You would also need Input.psc (otherwise your mod won't compile) -- you only need the .psc file when compiling a script.And if you want to release your mod -- you would only need to include the .pex file (unless you wanted to enable people to alter/modify your script, and then you would need to supply the .psc file as well) Edited April 4, 2013 by NeoH4x0r Link to comment Share on other sites More sharing options...
Recommended Posts