So my whole "Door locking idea" I suppose requires so many conditions that may not even exist nobody could even make a script for it. However as an alternative here is something I managed to put together.
The way it works is a spell similar to throw voice which uses an explosion to spawns an activator, that disables the two Kmarkers the Skyrim zombies and Solstheim zombies use as an enable parent, and the activator also spawns another activator that acts as both the visual and the distance measuring point. The first activator the script is on also uses null textures so you don't see two objects being spawned, and the activator it spawns has no script on it, it's only there to measure distances/be a visual cue.
The only script I'd ever put on the second activator would be an on activate to simulate picking up a lantern, where the "static" activator is sent back to it's unreachable interior cell, and a vanilla lantern is added to the players inventory, but that is much simpler than this other script, and unrelated to my current issues. It is a power that can only be used once every 24 hours, and will require a lantern to be successfully casted, and of course I'll provide a way to craft lanterns as well though that's again another subject.
Scriptname AAAWardOffZombersScript extends ObjectReference
Actor Property PlayerRef Auto
Spell Property AKWardOffZombersSpell Auto
ObjectReference Property ZeCandleActivaitor Auto
ObjectReference Property KMarker Auto
ObjectReference Property KMarkerSolstheim Auto
ObjectReference Property ZeCandleActivatorMarker Auto
Event OnLoad()
Debug.MessageBox("This lantern will ward off the undead so long as you don't travel too far from it")
ZeCandleActivaitor.Moveto(PlayerRef)
kMarker.Disable()
kMarkerSolstheim.Disable()
EndEvent
Event OnUpdate()
if PlayerRef.GetDistance(ZeCandleActivaitor) > 4096
kMarker.Enable()
kMarkerSolstheim.Enable()
Debug.MessageBox("You have walked past the boundaries of safety the lantern provided and the Undead are likely to search for you now.")
ZeCandleActivaitor.Moveto(ZeCandleActivatorMarker)
self.delete()
Endif
Endevent
Scriptname AAAWardOffZombersScript extends ObjectReference
Actor Property PlayerRef Auto
Spell Property AKWardOffZombersSpell Auto
ObjectReference Property ZeCandleActivaitor Auto
ObjectReference Property KMarker Auto
ObjectReference Property KMarkerSolstheim Auto
ObjectReference Property ZeCandleActivaitorMarker Auto
Event OnLoad()
If PlayerRef.GetDistance(ZeCandleActivaitor) > 4096
Debug.MessageBox("This lantern will ward off the undead so long as you don't travel too far from it")
ZeCandleActivaitor.Moveto(PlayerRef)
kMarker.Disable()
kMarkerSolstheim.Disable()
ElseIf PlayerRef.GetDistance(ZeCandleActivaitor) < 4096
kMarker.Enable()
kMarkerSolstheim.Enable()
Debug.MessageBox("You have walked past the boundaries of safety the lantern provided and the Undead are likely to search for you now.")
ZeCandleActivaitpr.Moveto(ZeCandleActivaitorMarker)
self.delete()
Endif
EndEvent
Again I experimented with a much smaller distance of 10 units and it didn't work either. I first tried to use the first script and when it didn't work I tried the second script which has the same problems.
Now- it seems like it is ALMOST perfect- or at least the FIRST part of the script, only problem is, when I walk past 4096 units, the second script function never occurs. No debug messages of the second debug message at all, and the lantern then follows me around. I also experimented with a distance of 40 units instead and that didn't work any better.
Can someone please explain what I did wrong with my script, and how I can add the secondary function after "Event OnUpdate()" to my script? Was event on Update the wrong thing to begin with or something? I also made an extremely similar script that won't quite work the right way either.