Jump to content

Auto-closing doors


Lykamdog

Recommended Posts

How can I create Automatic closing doors? You know, they close behind you. I am fairly(can't get any greener) new at scripting, so if it can be done without scripting that would be great. But if not, a push in the right direction would be very helpful.

 

Thanks in advance,

Link to comment
Share on other sites

I didn't write this script. Its origin is unclear to me.

 

scn AutoClosingDoorSCRIPT

float doorTimer 
short closeDoor 

Begin GameMode 
if closeDoor 
	if doorTimer > 0 
		set doorTimer to doorTimer - getSecondsPassed 
	elseif GetOpenState; if the door is still open 
		SetOpenState 0; close the door 
		set closeDoor to 0 
	endif 
endif 
End 
Begin OnActivate 
if GetOpenState == 3; if the door is closed 
	set doorTimer to 5 
	set closeDoor to 1
endif 
Activate 
End

Link to comment
Share on other sites

When it comes to automatically opening and closing doors, I prefer to use a combination of a door and a scripted triggerbox, which allows you to count the number of actors near the door and therefore open/close it effectively. The triggerbox's linked ref should be set to be the door, so that it can be manipulated via GetLinkedRef in the triggerbox's script. That way, you can count the number of actors near the door, and close it automatically via SetOpenState when there are no more actors within the triggerbox.

 

Of course, a timer will work as well, but it can have some rather annoying consequences when used with followers if the timer isn't long enough.

 

Cipscis

Link to comment
Share on other sites

@BadPenny: Thanks for the script. It works for now.

 

@Cipscis: I will try this for my followers. I did encounter one instance of where the door closed in his face :P

 

Still working on my little test house. So I will try to use the scripted triggerbox. I need to learn a little more about scripting first tho.

 

Thanks, all.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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