Jump to content

locking doors


omega549

Recommended Posts

This may seem stupid, but ive been trying to figure out how to make a door operate on a switch, ie when the switch is activated the door opens. I cant figure it out, do i need to make a new door and switch and give it a script? or is there something in the edit window that allows me to do it in the render view?
Link to comment
Share on other sites

Open the switch properties in the render window and click the enable parent tab. Then select the door for the reference there (door must be persistent). Attach the following script to the door...

 

Begin OnActivate

if isactionref player == 1
showmessage SomeMessage ; something like "This door is opened remotely"
endif

if getopenstate == 3 && isactionref player == 0
setopenstate 1
elseif getopenstate == 1 && isactionref player == 0
setopenstate 0
endif
End

 

If you don't want NPCs using the door you can use a ref variable for the GetLinkedRef function and substitute it like this...

 


ref SwitchRef

Begin OnActivate

if isactionref player == 1
showmessage SomeMessage ; something like "This door is opened remotely"
endif

set SwitchRef to GetLinkedRef

if getopenstate == 3 && Getactionref == SwitchRef
setopenstate 1
elseif getopenstate == 1 && Getactionref == SwitchRef
setopenstate 0
endif
End

Link to comment
Share on other sites

Provided I have a functioning door and a switch in place, here's what I do:

 

  1. Double-click the switch to open its Reference Editor
  2. Tick the Persistant Reference checkbox, assign a Reference Editor ID and close the Reference Editor
  3. Double-click the door to open its Reference Editor
  4. Tick the Persistant Reference checkbox and assign a Reference Editor ID
  5. Go to the Activate Parents tab
  6. Context-click the Activate Parent Ref list box and select New from the context menu
  7. Then just select the switch's Reference Editor ID from a dropdown list or click the button that lets me select the switch in the render window

 

If you tick the Parent Activate Only checkbox, that makes sure the door is only activated by the switch. Note that you can have more than one switch or other activator listed in the Activate Parent Ref list.

 

From here, you can add any script you like to the door (e.g. autoclose, autolock, etc.) without having to readjust what you've done.

 

I hope this helps. Good luck...

Link to comment
Share on other sites

  • Recently Browsing   0 members

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