Jump to content

Automatic Door


Skyviper086

Recommended Posts

Is there is a quick way to make an automatic door and or link a door to a switch.

 

I'm wanting to make a hanger that when my character is about to land the hanger door will open automatically and I would like to have a switch so it can be opened before take off.

Link to comment
Share on other sites

You could try attaching an activate script to a trigger and using the OnTriggerEnter. Or try attaching a script that opens it when the Player is within a certain distance from the object using the GetDistance function. See example script below.

scn YourModExampleSCRIPT

Begin
    if Player.GetDistance YourDoorREF <= ;Distance away to activate door
        YourDoorREF.Activate
    endif
End

Please note that I'm fairly new to scripting using TESScript, so it may or may not work as I have not tested it.

Link to comment
Share on other sites

Something like Dope's script could work, yup. If you'd like to use a triggerbox instead it could be something like this.

scn AutoDoorScript

Begin OnTriggerEnter player

    MyDoorRef.activate

END

Begin OnTriggerLeave Player

   MyDoorRef.activate

END

I think something like that would make it so the door opens when the player enters the trigger, and closes it when the player exits. You can also try with this, if the above doesn't work. This one may be preferable because, in the script above, if the door is open for whatever reason (maybe if an NPC used it), when the player enters the trigger the door would close instead :laugh: So I'd recommend you try the script below first.

scn AutoDoorScript

Begin OnTriggerEnter player

    MyDoorREF.SetOpenState 1

END

Begin OnTriggerLeave Player

   MyDoorREF.SetOpenState 0

END

Something to keep in mind with Trigger blocks is that you need to make the trigger boxes big enough that the player cannot enter and leave the trigger in too little time because the scripts will get messed up. But you shouldn't worry about that unless your trigger box is like, paper-thin :laugh:

Edited by Jokerine
Link to comment
Share on other sites

  • Recently Browsing   0 members

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