A placeholder container. (This has BlockActivation() and points activation to PlaceAtMeCopies) This is seemingly what the player is interacting with.
A container to be copied. (CopyMeRef. Hidden out of sight)
An XMarker. (Also hidden out of sight, PlaceAtMe copies spawn here)
Script01 on Placeholder:
Spoiler
Scriptname MDHRelockScript extends ObjectReference{Re-locks a container for the player to train lockpicking against};simply re-locking the container will only give the player experience from the first unlock.Actor Property PlayerRef AutoObjectReference Property CopyMe AutoObjectReference Property TargetMarker AutoGlobalVariable Property MDHOneCopy AutoEvent OnLoad()BlockActivation()EndEventEvent OnActivate(ObjectReference akActionRef)BlockActivation()If akActionRef == PlayerRef If MDHOneCopy.GetValue() == 0 ObjectReference Dupe = TargetMarker.PlaceAtMe(CopyMe) MDHOneCopy.SetValue(1) Dupe.Activate(akActionRef)endif endifEndEventEvent OnLockStateChanged() ;fires if the player attempts to unlock this container by cheatingLock()EndEvent
Script02 on CopyMeRef:
Spoiler
Scriptname MDHRelockScriptChild extends MDHRelockScript{Child Script changes needed global};This script is on MDHRelockScript.CopyMe and gets applied to Dupe as well.Message Property Success AutoObjectReference Property CannotDelete Auto ;it seems my OnCellLoad event is deleting CopyMeRef somehowEvent OnLockStateChanged() ;fires if the player attempts to unlock this container by cheatingLock() ;prevents container from opening after successful lockpick;MDHRelockScript.ClearDupe ;how do I do this???? Might not be necessaryMDHOneCopy.SetValue(0) ;Doesn't seem to fire after Delete(); Success.Show() ;Debug Delete() ;won't delete whilst still property in Parent?EndEventEvent OnCellLoad() ; Clean's up remnant copies on cell loadMDHOneCopy.SetValue(0)Delete() ;Can have this on CopyMe, won't fire because its still a property and always will be. mwahahaEndEvent
Several Issues. Some are described in script annotations. But I will detail them here:
1st: Simply having Lock() inside an OnLockStateChanged() Event won't continue to give the player experience. D:
2nd: My code won't work if the Player has to close the lockpicking menu without a successful lock pick (see script01)
3rd: Somehow CopyMeRef is getting deleted, this shouldnt happen as the actual object reference "MDHCopyMeRef" is a property in both scripts
Talk about a work-around. When I first tested:
Event OnLockStateChanged()Lock()EndEventThe heavens parted, I saw the matrix. At least I thought I did. Perhaps my methodology is needlessly complex. Please help.