Jump to content

How to Block 100% Help!


HailHell

Recommended Posts

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

Scriptname L00VScBlock extends form

actorbase 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)
endif
EndEvent

 

 

i put the register for key here since this script already works.-------------------------------------------------

 

Scriptname L00VPlayerSC extends actor
objectreference property L00VDieRef01 auto

L00VScBlock property firstScript Auto

Event 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()
endif
EndEvent

Link to comment
Share on other sites

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 by Arron Dominion
Link to comment
Share on other sites

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 by HailHell
Link to comment
Share on other sites

  • Recently Browsing   0 members

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