Jump to content

Making a door lock once you fast travel through it and giving you a warning message.


kirloper

Recommended Posts

So I am decided to redo a mod I am currently working on and remake it from scratch it will be a sewer expansion pack. Before entering a message will pop up warning you of the dangers you face, once you click ok and travel through the door locks behind you preventing you from leaving then you have to find your own way out.

 

How to make a massage pop up ?

 

How to make a door lock once you travel through it ?

Link to comment
Share on other sites

You need a trigger placed in front of the door to display the warning. Then you need another script on the door itself to listen for its activation, and lock it, when the player "teleports" from it(need to register and call OnPlayerTeleport from that script too). AFAIK, nothing can stop the load screen from appearing once the door is activated. A message box of course will pause it, but when you exit the box, you gonna go through the door. I think this is behaviour you want to get around.

 

Something like..

Event OnActivate(ObjectReference akActionRef)
    if akActionRef == Game.GetPlayer()
        RegisterForPlayerTeleport() ; beam me up Scotty
    endif
EndEvent

Event OnPlayerTeleport()
    Lock()
EndEvent

Event OnCellDetach()
    UnregisterForPlayerTeleport()
EndEvent

If you care about the door in the destination cell also being locked.. that's a tough one.

Edited by Rasikko
Link to comment
Share on other sites

An more complex alternative to locking and unlocking if you want to hide or block the door until it is available (base game Arcjet, FortHagen, OldRobotics, HoleInTheWall)

 

 

(1) A static object with a broken door or wall panel NIF overlaying

 

(2) The actual load door

 

(3) The linked teleport door

 

(4) A trigger/quest/object script which disables (1) and enables (2) and (3)

Link to comment
Share on other sites

There are various ways to achieve what you want, I will suggest what I think is the best way.

If you want to show a warning when door is activated and make it available only after that, you just add script on it with something like this inside:

Message Property myMessage Auto Const
bool once

Event OnLoad()
 if !once
  BlockActivation()
 endif
endEvent

Event OnActivate(ObjectReference akActionRef)
 if !once
  if akActionRef == Game.GetPlayer()
    myMessage.show()
    BlockActivation(false)
    once = true
  endif
 endif
EndEvent

So first time a messagebox will appear and only after that player will be able to enter that door.
Now about making it locked after teleport.
I havent tested whats going to happend if you call lock() as soon as onactivate happens, it may actually work and lock it but if not, do something like this, place trigger near door so player enters it when teleport finishes. then add script on that trigger activator

with something like this inside:

Door Property myDoor Auto Const

Event OnTriggerEnter(ObjectReference akTriggerRef)
 if akTriggerRef == Game.GetPlayer()
  Objectreference[] mydoorref = Game.getplayer().FindAllReferencesOfType(myDoor, 200.0); reason for using this function instead of directly pointing  
  ;to door ref is that usually you shouldnt be filling objectreference properties, that way you make them persistent thats not very good.
  ;but if you want it too much, you can directly use your door as object reference property
  mydoorref[0].Lock() ;of course you should be sure thats only door of that base form nearby 
 endif
EndEvent

Event OnTriggerLeave(ObjectReference akTriggerRef)
 if akTriggerRef == Game.GetPlayer()
  Disable()
 endif
EndEvent
Edited by shavkacagarikia
Link to comment
Share on other sites

  • 3 weeks later...
  • Recently Browsing   0 members

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