Jump to content

Photo

Switches and Doors


  • Please log in to reply
16 replies to this topic

#1
ryuuki

ryuuki

    Newbie

  • Members
  • Pip
  • 16 posts
Hey all

I'm playing with GECK for the first time and been following the tutorials by Bethesda on how to use it. I've got enough knowledge now to set up, light and clutter a new area and provide access points from the world to the new area. What I'm trying to do is build a custom player home with a sort of high security feel. My aim is to create a short quest to provide the player with a keycard that gives them access to this new area. The idea is that inside a cave there is a secured heavy door that is locked and needs the keycard to open. Now I can get that working fine without any problems. However, what I REALLY want is for the door not to open by a player activating it directly, but to have a control panel to the side of the door that the player has to activate while in possession of the keycard in order to unlock and open the door. I've been at it for hours now and no amount of googling has provided any breakthroughs. Could someone please provide some help?

I never even suspected it was so complicated just to get a switch to unlock and open a door >_< Any help would be very much appreciated.

#2
BEArbiter

BEArbiter

    Enthusiast

  • Members
  • PipPip
  • 142 posts
ScriptName OpenMe
;DoorRef: Persitent Reference of the door
;KeyReference Geck ID of the item
Begin OnActivate
	if(Player.GetItemCount keyReference == 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 the door is teleporting the player:
ScriptName OpenMe
;DoorRef: Persitent Reference of the door
;KeyReference Geck ID of the item
Begin OnActivate
	if(Player.GetItemCount keyReference == 0);Does The player have the key?
		Return
	endif
	if(DoorRef.GetLockLevel == 100);Is the door Locked?
		DoorRef.Lock 0 ;Unlock the door
	else ;Otherwise
		DoorRef.Lock 100 ;Relock the door

	endif
End


#3
ryuuki

ryuuki

    Newbie

  • Members
  • Pip
  • 16 posts

ScriptName OpenMe
;DoorRef: Persitent Reference of the door
;KeyReference Geck ID of the item
Begin OnActivate
	if(Player.GetItemCount keyReference == 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 the door is teleporting the player:
ScriptName OpenMe
;DoorRef: Persitent Reference of the door
;KeyReference Geck ID of the item
Begin OnActivate
	if(Player.GetItemCount keyReference == 0);Does The player have the key?
		Return
	endif
	if(DoorRef.GetLockLevel == 100);Is the door Locked?
		DoorRef.Lock 0 ;Unlock the door
	else ;Otherwise
		DoorRef.Lock 100 ;Relock the door

	endif
End



Thanks for the reply. Where is that I enter these scripts?

#4
BEArbiter

BEArbiter

    Enthusiast

  • Members
  • PipPip
  • 142 posts
ouch ><

- You create a new script and put one of these (change the name (OpenME) to something like ESPNAME_Secure_Door_Script)
- Go to your door (in the Cell and add a Persitent Reference)
- Change the Persitent Reference of the script (DoorRef) to the one you made.
- Save the script
- Create A New activator (Clone existing One).
- In the script option, Choose the script.

Enjoy

#5
ryuuki

ryuuki

    Newbie

  • Members
  • Pip
  • 16 posts
Thanks again :) I will try this in the morning (sorry i'm a total noob at this and Bethesda's tutorials weren't much use for that)

#6
BEArbiter

BEArbiter

    Enthusiast

  • Members
  • PipPip
  • 142 posts
Be Carefull and make a backup before if you'r not sure of what you are doing ^^.

#7
ryuuki

ryuuki

    Newbie

  • Members
  • Pip
  • 16 posts
I'm not sure if I'm doing something wrong but it seems I can't save my script. I create a new one (tried clicking the little pencil button at the top, and right clicking in Scripts in the object window and pressing new) typed in the script, tried copying and pasting too, then hit the save button and nothing happens. When i close the window it asks "Do you want to save the current script? Current = " Yes or No. If i hit yes nothing happens and my script window stays on screen. If i hit no it goes away. Even if I hit yes it isn't saved. Any idea what's going on here?

#8
BEArbiter

BEArbiter

    Enthusiast

  • Members
  • PipPip
  • 142 posts
I'm sure you have a problem with The persistent Reference.
Be sure to do this:
- Right click on the door (the one you have in cell view pannel).
- click edit
- under "Reference Editor ID" put something like ESPNAME_MyDoor
- Be sure that you have checker Persitant reference.
- Copy paste The refenrence in the script

(Note: If it don't save, it's because you've made an error, I checked the code Several Times. so I'm sure it's working. stay the reference name of the door)

#9
ryuuki

ryuuki

    Newbie

  • Members
  • Pip
  • 16 posts
I'm still not sure what I'm doing wrong. Persistence is checked.
The door ID is: BLACKLAIRHub
The key ID is: BlackLairKeycard1

So the script should look like this?

ScriptName BlackLairHub_Open

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

        endif
End


It's still not saving, I've tried loads of combinations and It still won't work. I'm really sorry for the noobness, I'm very new at scripting, never really done it before.

#10
BEArbiter

BEArbiter

    Enthusiast

  • Members
  • PipPip
  • 142 posts
Are you sure that the "persitent reference" box is checked?




Page loaded in: 0.933 seconds