Jump to content

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


Recommended Posts

Is there a proper way for the game to recognize when the player has just finished lock-picking a container, so that a follower would comment on it? I tried making a scene for a quest under the Story Manager Event "Lock Pick", and also added the respective quest node to Lock Pick SM Event Node. None of these resulted in the follower commenting whenever I would lockpick a container.


Help would be appreciated.






Link to comment
Share on other sites

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

I use SM a lot, but not lock pick. But I did have a look at all the events a while ago to see what might be useful. The lock pick one seems to have most people beaten, largely because there is no vanilla game example. I expect you have googled all the baffled references!

I presumed from the way other events work you create two alias' in your quest one for actor (From event -> actor) and one for a lock (From event Lock Pick -> Lock object), the problem then is how you get the SM to communicate info to the quest. Incidently I presume you need these to fill the OnStoryPickLock quest script which is run by a quest called from the Lock Pick event.

On the SM node conditions the actor is easy its just GetISID on player set to run on event data (actor). Where I ran out of ideas was which condition to use for the Lock to run on event data (lock object). I gave up and never got onto the quest itself.

I hope this adds at least something to the general baffling nature of this SM event; but all my presumptions could be wrong!

Link to comment
Share on other sites

One possible solution:

Use SKSE, register for the "Lockpicking Menu". You can use a start game enabled quest or one that you start by some other means, so long as it is active for the duration that you want this to work. When the menu is closed, register for a very small update and use GetCurrentCrosshairRef coupled with IsLocked to confirm whether the object is still locked or not. If not, trigger your dialog. If you are afraid that the user might move the crosshair off of the container, you can try using GetCurrentCrosshairRef from inside the OnMenuClose event. I am not certain what the result might be but it is worth testing, however.

Link to comment
Share on other sites

IsharaMeradin's suggestion is a good one. If you don't want to use SKSE though, you could instead use RegisterForTrackedStatsEvent(). I assume your follower is one that you made, so you can put the script directly on the actor:

 

 

 

Scriptname MyModLockPickTopicScript extends Actor 

Actor Property PlayerRef Auto 
Topic Property LockPickDialogue Auto

Event OnInit() 
    RegisterForTrackedStatsEvent()
EndEvent 

Event OnTrackedStatsEvent(String asStat, Int aiStatValue)
    If asStat == "Locks Picked" && Self.GetDistance(PlayerRef) < 2000
        Utility.Wait(1)
        ;Debug.Notification("Lock Picked")
        Self.Say(LockPickDialogue)
    Endif 
EndEvent

If it's a vanilla follower, you could instead use a reference alias pointing at your follower:

Scriptname MyModLockPickTopicScript extends ReferenceAlias 


Actor Property PlayerRef Auto 
Topic Property LockPickDialogue Auto


Event OnInit() 
    RegisterForTrackedStatsEvent()
EndEvent 


Event OnTrackedStatsEvent(String asStat, Int aiStatValue)
    If asStat == "Locks Picked" && Self.GetActorReference().GetDistance(PlayerRef) < 2000
        Utility.Wait(1)
        ;Debug.Notification("Lock Picked")
        Self.GetActorReference().Say(LockPickDialogue)
    Endif 
EndEvent

Name the script something more unique to your mod. Using SKSE as IsharaMeradin suggested would be better for performance though because OnTrackedStatsEvent fires for all stats, and there's a lot of them: https://www.creationkit.com/index.php?title=ListOfTrackedStats
Edited by dylbill
Link to comment
Share on other sites

Hey, I had another thought. To detect lock picking without using SKSE, you can make a new spell ability and a new Global Variable and compare GetPCMiscStat "Locks Picked" to the global variable.

So, put the condition GetPCMiscStat Locks Picked != LockPickDetectGV (Check the UseGlobal box and choose the Global Variable you made. I named it LockPickDetectGV )

Also put the condition GetDistance Player < 2000

On the spell ability

 

Put the spell ability on your follower

 

Then on the spell ability's magic effect, put this script:

 

 

Scriptname MyModLockPickTopicScript extends ActiveMagicEffect 

Actor Property PlayerRef Auto 
Topic Property LockPickDialogue Auto
GlobalVariable Property LockPickDetectGV Auto

Event OnEffectStart(Actor akTarget, Actor akCaster) ;effect starts after picking a lock
    Utility.Wait(1)
    ;Debug.Notification("Lock Picked")
    akTarget.Say(LockPickDialogue)
    MCMTestLockPickDetectGV.SetValue(Game.QueryStat("Locks Picked")) ;this nullifies the effect, so it can start again after picking a lock.
EndEvent

Edit: Actually its better to put the GetDistance condition in the script, rather than on the spell ability.

 

 

Scriptname MyModLockPickTopicScript extends ActiveMagicEffect 

Actor Property PlayerRef Auto 
Topic Property LockPickDialogue Auto
GlobalVariable Property MCMTestLockPickDetectGV 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")
        akTarget.Say(LockPickDialogue)
    Endif 
    
    Utility.Wait(1)
    MCMTestLockPickDetectGV.SetValue(Game.QueryStat("Locks Picked")) ;this nullifies the effect, so it can start again after picking a lock.
EndEvent

Edited by dylbill
Link to comment
Share on other sites

Thank you all for the input and advice. Also yes @agerweb, there's not enough to go on for Lockpicking SM Nodes; I'm not even sure if anyone's even gotten it to work yet. Under my lockpick quest I did have two aliases, one for the player and one for the container target.

 

I might just try both the RegisterforTrackedStatsEvent or Get Distance method for now, since I don't really have much experience scripting off of SKSE functions.

 

Also if I didn't make it clear enough already, this is meant to be a radiant event, to occur at any time the player lockpicks, regardless of whichever container it is.

Edited by Martimius
Link to comment
Share on other sites

I would use the Spell Ability option that I posted, rather than RegisterForTrackedStats, because it's better for performance. I tested it and the effect does start every time you pick a lock. If you need more detailed instructions let me know.

Link to comment
Share on other sites

  • 4 weeks later...

I would use the Spell Ability option that I posted, rather than RegisterForTrackedStats, because it's better for performance. I tested it and the effect does start every time you pick a lock. If you need more detailed instructions let me know.

Hey there! Sorry if I took kind of long to reply. Was just implementing other things with my mod. May I clarify how I would apply that spell ability on the follower? She's a vanilla actor, Serana.

 

Do I make a separate script with the ActorREF.Addspell() command, to be run once at game startup?

Link to comment
Share on other sites

Yes that's how I would do it. You can make a new start up quest, make sure Start Game Enabled is checked. Then use a script like this:

 

Actor Property Serana Auto 
Spell Property LockPickDetectAbility Auto 

Event OnInit()
    Utility.Wait(1) 
    Serana.AddSpell(LockPickDetectAbility) 
    Utility.Wait(1) 
    Self.Stop() ;stops this quest
EndEvent 

Have your script extend quest.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...