Jump to content

Script help request


Rattlerx5150

Recommended Posts

 

 

without trying your script, the problem I see with it is when the player opens the door, it will automatically close and lock on them rather then only locking when the door is closed, hense why I used the event 'OnClose' instead of 'OnActivate', that way the door will only lock if its closed, and will remain open until then.

 

No, it does not do this - it`s a toggle.It does something only when player activates it, one action at a time. Either closes and locks or unlocks and opens. Activating = pressing "E" on the door. I tested it in the game as this is a script I`m using for my settlements just without a lock level and key. Without lock level it won`t let to unlock it with some certain key so for using key need to set a lock level.

 

 

yes I understand that, but for instance - if you have a object that unlocks the door but doesn't activate it, then when the player opens the door it will flip shut and lock again, likewise, if the door wasn't originally locked, when the player opens the door, it will flip shut and lock. As long as your door is locked to begin with, and nothing is used to just 'unlock' the door but not open it, then all is fine and dandy.

Link to comment
Share on other sites

 

yes I understand that, but for instance - if you have a object that unlocks the door but doesn't activate it, then when the player opens the door it will flip shut and lock again, likewise, if the door wasn't originally locked, when the player opens the door, it will flip shut and lock. As long as your door is locked to begin with, and nothing is used to just 'unlock' the door but not open it, then all is fine and dandy.

 

 

I understood you. Yes, If you attach the script in the moment the door was closed, but not locked, you`ll have to click it twice to open it, but only the first time after attaching the script. I have bool set in the settlement door that makes it locked when crafted.

Edited by kitcat81
Link to comment
Share on other sites

 

 

I was actually wrong, decided to test it as I was curious why it won`t work for you. My script works for Covenant doors if adding a locklevel of Covenant doors to it which is zero.

Event OnActivate(ObjectReference akActionRef)
    If akActionRef == Game.GetPlayer()
        If Self. IsLocked() == false
            Self.SetOpen(false)
                Self.Lock()
                SetLockLevel(0)
            else
                Self.UnLock()
                Self.SetOpen()
        EndIf
    EndIf
EndEvent

 

without trying your script, the problem I see with it is when the player opens the door, it will automatically close and lock on them rather then only locking when the door is closed, hense why I used the event 'OnClose' instead of 'OnActivate', that way the door will only lock if its closed, and will remain open until then.

 

Compilation failed

Link to comment
Share on other sites

 

 

 

I was actually wrong, decided to test it as I was curious why it won`t work for you. My script works for Covenant doors if adding a locklevel of Covenant doors to it which is zero.

Event OnActivate(ObjectReference akActionRef)
    If akActionRef == Game.GetPlayer()
        If Self. IsLocked() == false
            Self.SetOpen(false)
                Self.Lock()
                SetLockLevel(0)
            else
                Self.UnLock()
                Self.SetOpen()
        EndIf
    EndIf
EndEvent

 

without trying your script, the problem I see with it is when the player opens the door, it will automatically close and lock on them rather then only locking when the door is closed, hense why I used the event 'OnClose' instead of 'OnActivate', that way the door will only lock if its closed, and will remain open until then.

 

Compilation failed

 

It failed because there is a space that appeared after copypasting. Should be "Self.IsLocked()" without space between them.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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