Jump to content

Need help setting up unlock on whack


Syn3r

Recommended Posts

I'm trying to make a melee weapon attachment unlock all containers, doors, and terminals that don't require keys or passwords to unlock if possible. I have an idea to crreate a list of all items I want to unlock and have a unlock onhit script run, my question is how would I do this. I know almost nothing involving papyrus and every time I have tried to create a script I get confused.

Link to comment
Share on other sites

You'll need to add an Enchantment (a.k.a. an Object Effect) to your attachment, which itself will need a Magic Effect added to it (casting type 'Fire and Forget', delivery 'Touch'). The Magic Effect is what you attach your script to, and it should look something like this:

Event OnInit()
   Function RegisterForHitEvent(ScriptObject akTarget, ScriptObject akAggressorFilter = None, Form akSourceFilter = None, Form akProjectileFilter = None, int aiPowerFilter = -1, int aiSneakFilter = -1, int aiBashFilter = -1, int aiBlockFilter = -1, bool abMatch = true) native
EndEvent

Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string asMaterialName)
   If akTarget.GetLockLevel < 253
       akTarget.Unlock()
   EndIf
EndEvent

That 'If akTarget.GetLockLevel < 253' should mean doors that require a key, terminal or game event aren't unlocked, although you'd be better off removing it and using Creation Kit conditions on your Enchantment if you can get that to work (sometimes Creation Kit is a bit fussy as to what it determines to be a subject, target, etc).

Here are the lock level values, if you want to adjust the condition:

0 = Unlocked
25 = Novice
50 = Advanced
75 = Expert
100 = Master
251 = Barred
252 = Chained
253 = Terminal Only
254 = Inaccessible
255 = Requires Key

Edited by adb3nj
Link to comment
Share on other sites

  • Recently Browsing   0 members

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