Jump to content

Switches and Doors


ryuuki

Recommended Posts

Strange, I do not have Any Idea why it's not working, and since the geck dont tell us what the Error is, I could say we are stuck.

You could try by Linked Ref:

- edit the Activators in Cell View
- Select the Door as the linked Ref.
- you should see Yellow lines from Activator To door now (not sure of the color)

 

The code would be like this:

ScriptName BlackLairHub_Open

ref DoorRef


Begin OnActivate
if(DoorRef == 0) ;Is the ref initialized?
	set DoorRef to GetSelf
	set DoorRef to DoorRef.GetLinkedRef
endif
if(Player.GetItemCount BlackLairKeycard1 == 0);Does The player have the key?
	Return
endif
if(DoorRef.GetOpenState == 3 && DoorRef.GetLockLevel == 100);Is the door Closed?
	DoorRef.Lock 0 ;Unlock the door
	DoorRef.SetopenState 1  ;Open the Door
else ;Otherwise
	DoorRef.Lock 100 ;Relock the door
	DoorRef.SetOpenState 0 ;Close The Door

endif
End

 

If that doesn't work, you have an error with the ItemID (is it created already? the Geck check that too)

Link to comment
Share on other sites

This is driving me crazy, the script still won't save. I started it from scratch, this is what I did:

 

- Put a door in a doorway

- Right clicked > Edit

- Set "Reference Editor ID" to "BunkerDoor"

- Checked "Persistent Reference" box

- Created a new Activator called "BlackLairSecurityTerminal" using the Terminal01 mesh and no script set yet

- Added it to the world by the door

- Right Clicked > Edit > LinkedRef

- Selected "BlackLair" as the Cell and "BunkerDoor" as Reference. Hit Ok. The reference arrow points to the door.

- Clicked the Script button, selected New.

- Copied and pasted the code above

- Click save, nothing happens

- Close the window, get asked if i want to save

 

To my knowledge I've done everything correct - can you spot anything wrong there?

Link to comment
Share on other sites

Woo! Got it to save! I deleted the key I created and recreated it (identical to the first time) but this time it allowed me to save the script. I don't know why that happened but the script is now saved. So time to try out in game and see if it works.
Link to comment
Share on other sites

Thanks a lot for you help. I really appreciate it. The script works in game as I'd hoped.

 

I know I'm biting off more than I can chew but I find it's the best way for me to learn. I was wondering if you could suggest a way to implement the same idea but using a Terminal interface rather than simply using the activator like a button? So using the terminal would bring up the computer screen interface only if the player has the key in their inventory and allow them to select an option from the screen like "Disengage locks and open door".

Link to comment
Share on other sites

Exemple:

DoorIsClosed would be a Global Variable

First Item: Name: Open Secret Vault Door | Condition : GetItemCount Mykey != 0  && DoorIsClosed == 1| Result : Script to open the door + Text"Door Opened"
Second Item: Name: Open Secret Vault Door | Condition : GetItemCount Mykey == 0 && DoorIsClosed == 1| Result: Text"Error: No Passkey inserted"
Third Item: Name : Open Secret Vault Door | Condition : DoorIsClosed == 0 | Result: text"Error: Door is already Opened"
Fouth Item: Name: Close Secret Vault Door | Condition : DoorIsClosed == 0 | Result: Script to Close the door + Text"Door Closed"
Fifth Item: Name: Close Secret Vault Door | Condition : DoorIsClosed == 1 | Result Text"Error: Door Already Closed"

 

Script Would Be:

Opening the Door:

ref DoorRef
if(DoorRef == 0)
set DoorRef to GetSelf
set DoorRef to DoorRef.GetLinkedREf
endif
DoorRef.Lock 0 ;Unlock the door
DoorRef.SetopenState 1  ;Open the Door
set DoorIsClosed to 0

 

Closing the door:

ref DoorRef
if(DoorRef == 0)
set DoorRef to GetSelf
set DoorRef to DoorRef.GetLinkedREf
endif
DoorRef.Lock 100 ;lock the door
DoorRef.SetopenState 0  ;Close the Door
set DoorIsClosed to 1

Link to comment
Share on other sites

  • Recently Browsing   0 members

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