Jump to content

[LE] Getting the game to recognize the Story Manager LockPick Event


Recommended Posts

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

So therefore I should just run this once, like EVENT onInit() when the SEQ quest is run? I was thinking though that we wouldn't have to force the alias to be filled necessarily, since it is filled on a new save (where the mod wasn't installed previously). I was thinking that the quest could be stopped, cleared, restarted in some way? That might mean having the quest restarted on the game startup each time.

 

Edit: Fixed! Since the game had trouble filling aliases on a SEQ already run before, I just made a new quest and the alias filled properly

Edited by Martimius
Link to comment
Share on other sites

As for the lockpicking issue, I've had some progress with troubleshooting, I guess. In the CK, I re-added/auto-filled all the script properties for both the init and magic spell script. So at least now 100% of the time in-game the lockpick detect spell shows up, along with the magic effect. Problem is, the lockpick dialogue scene fires at completely random times, even when I haven't lockpicked anything yet. The scene fires off once, and then never again.

 

 

Scriptname SDA_LockpickMGEF extends activemagiceffect

Actor Property PlayerRef Auto
GlobalVariable Property LockPickDetectGV Auto
Scene Property SeranaDialogueAddonLockpickScene Auto
Event OnEffectStart(Actor akTarget, Actor akCaster) ;effect starts after player picks lock
If akTarget.GetDistance(PlayerRef) < 2000
Utility.Wait(1)
Debug.Notification("Lock Picked")
SeranaDialogueAddonLockpickScene.Start()
Endif
Utility.Wait(1)
LockPickDetectGV.SetValue(Game.QueryStat("Locks Picked")) ;this nullifies the effect, so it can start again after picking a lock.
EndEvent
@IshadaMeradin, I also may consider going with the SKSE route instead as it does seen at least somewhat simpler. With the RegisterForMenu command, the wiki says I have to register for a calling form. What's the best way to implement that?
Edited by Martimius
Link to comment
Share on other sites

Whatever script you want to run the OnMenuOpen or OnMenuClose events will need to have the RegisterForMenu call. Typically, the RegisterForMenu call is put in the OnInit event for the script in question. But can be utilized in other locations on the same script depending upon need.

Link to comment
Share on other sites

So basically something like this?

 

 

Event OnInit()
RegisterForMenu("Lockpicking Menu")
EndEvent
Event OnMenuClose(String Lockpicking Menu)
If MenuName == "Lockpicking Menu"
SDA_LockpickingScene.Start()
EndIf
EndEvent
Edited by Martimius
Link to comment
Share on other sites

In the most simplest form, yes. Except that you will need to change the parameter variable in the OnMenuClose event back to MenuName instead of Lockpicking Menu.

 

Successful lockpicks for containers automatically open the container, so the scene wouldn't start until after exiting the container menu or it would get paused while in the container menu. Successful lockpicks on doors automatically open them too and transition the player.

 

It may be beneficial to set a bool variable that indicates the lockpick menu has been opened, if that variable is still at that value after the container menu closes or the player finishes transitioning then do your thing. Otherwise register for a single update for a few seconds after the lockpick menu closes to reset the bool variable. The update wouldn't run till after the transition or the container menu closes thus allowing your thing to happen, else the bool variable resets for the next time.

 

Furthermore if you are wanting to distinguish between container, trap and door lockpicks you may need to use GetCurrentCrosshairRef and check that it is a container or door. Also, it may be impossible to distinguish between a successful lockpick of a trap and a close of the lockpick menu due to running out of lockpicks or just exiting early.

Link to comment
Share on other sites

If you're going the SKSE route, I would do it something like this:

 

Event OnInit()
    RegisterForMenu("Lockpicking Menu")
EndEvent

Event OnMenuClose(String menuName)
    ObjectReference LockRef = Game.GetCurrentCrosshairRef()
    
    If LockRef.IsLocked() == false 
        Utility.Wait(1)
        Debug.Notification("Lock Picked")
        SDA_LockpickingScene.Start()
    EndIf 
EndEvent
Sorry you couldn't get the other way working.
Link to comment
Share on other sites

 

If you're going the SKSE route, I would do it something like this:

 

Event OnInit()
    RegisterForMenu("Lockpicking Menu")
EndEvent

Event OnMenuClose(String menuName)
    ObjectReference LockRef = Game.GetCurrentCrosshairRef()
    
    If LockRef.IsLocked() == false 
        Utility.Wait(1)
        Debug.Notification("Lock Picked")
        SDA_LockpickingScene.Start()
    EndIf 
EndEvent
Sorry you couldn't get the other way working.

 

This is just run on a standalone quest, right? No other aliases, magic effects?

Link to comment
Share on other sites

You can put that script on pretty much anything really. You can use it on a quest you already made. Keep in mind though that if the quest is already running in your save you have to stop and start it again, either with another script or a console command to get the OnInit event to fire.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...