HailHell Posted February 9, 2015 Author Share Posted February 9, 2015 So it doesn't have to be in the same script yes? Link to comment Share on other sites More sharing options...
Mattiewagg Posted February 10, 2015 Share Posted February 10, 2015 You can register for a key in scirptA from scriptB: Scriptname ScriptA Extends Quest Event OnKeyDown(Int keycode) If keycode == 17 ;do stuff EndIf EndEvent Scriptname scriptB Extends ReferenceAlias scriptA property firstScript Auto;must fill this property Event OnInit() firstScript.RegisterForKey(17) EndEvent Link to comment Share on other sites More sharing options...
HailHell Posted February 10, 2015 Author Share Posted February 10, 2015 NICE Link to comment Share on other sites More sharing options...
HailHell Posted February 10, 2015 Author Share Posted February 10, 2015 not working :/ Link to comment Share on other sites More sharing options...
ArronDominion Posted February 10, 2015 Share Posted February 10, 2015 What part is not working, and what is your error message? (Make sure you are using SKSE if are not currently) Link to comment Share on other sites More sharing options...
HailHell Posted February 10, 2015 Author Share Posted February 10, 2015 No error, it just doesn't work and yes i am using the latest version of skse. Link to comment Share on other sites More sharing options...
ArronDominion Posted February 10, 2015 Share Posted February 10, 2015 Where is your logic failing exactly (since there is a logic error somewhere)? Link to comment Share on other sites More sharing options...
HailHell Posted February 10, 2015 Author Share Posted February 10, 2015 Scriptname L00VScBlock extends formactorbase property playerref auto Event OnKeyDown(int keycode) If KeyCode == 17 Debug.messagebox("A registered key has been pressed") playerref.SetInvulnerable() utility.wait(1.0) playerref.SetInvulnerable(false) endifEndEvent i put the register for key here since this script already works.------------------------------------------------- Scriptname L00VPlayerSC extends actorobjectreference property L00VDieRef01 autoL00VScBlock property firstScript AutoEvent OnEnterBleedout() firstScript.RegisterForKey(17) int randomnumber1 = Utility.RandomInt(1, 10) Float base = Game.GetPlayer().GetBaseActorValue("health") Float current = Game.GetPlayer().GetActorValue("Health") Float x = (base - current) / randomnumber1 game.getplayer().RestoreActorValue("Health", x) game.getplayer().moveto(L00VDieRef01) Game.FadeOutGame(false, true, 5.0, 5.0) debug.messagebox("ranbomnumber1 = " + randomnumber1) if randomnumber1 <= 5 Game.GetPlayer().RemoveAllItems() endifEndEvent Link to comment Share on other sites More sharing options...
ArronDominion Posted February 11, 2015 Share Posted February 11, 2015 (edited) Think about when you're block will be registered for in this case. When your character enters bleedout, the key press will be listened for, when it is too late. It is better to use a different event that will be activated sooner. On another note, your script for the key down will cause the vulnerability status to change potentially while the key is still pressed. Edit: This script also registers for key 17 instead of pulling the block key necessarily(what if someone binds the key elsewhere) Edited February 11, 2015 by Arron Dominion Link to comment Share on other sites More sharing options...
HailHell Posted February 11, 2015 Author Share Posted February 11, 2015 (edited) what do you mean it will be too late? what does the registerforkey actually do then, i thought it just registers the key to be expected in general not for a specific period of time. Anyway would onchange combat state event work? And i am looking out for the message box to show me that the script is actually running, same with the key, polishing comes at the end when the framework is done and stable in my opinion. Edited February 11, 2015 by HailHell Link to comment Share on other sites More sharing options...
Recommended Posts