open vault door with key script?

Post » Fri Nov 23, 2012 9:03 pm

Ive been trying to figure this out but i cant, i would like to make a vault door open with a control panel only when the player has the key, i basically want the features of the control panel handle moving and activatinf right so have been looking at the generic control pod script
scn GenericControlPodScript;See V112 for generic setup.short moderef myLinkbegin onActivateif IsActionRef player == 1  set myLink to getLinkedRef   ;the linked ref should be the door.  if ((myLink.getOpenState == 3) || (myLink.getOpenState == 1)) && mode != 2	  ;door closed or open   playgroup Forward 0			;pull handle out   set mode to 2   activate myLink			 ;activate all the things that this is an activate parent of - klaxon light and activator.  endifendifendbegin gameModeif (mode == 2)  if (isAnimPlaying == 0)   set myLink to getLinkedRef   ;the linked ref should be the door.   playgroup Left 1			;pull handle down   set mode to 3   myLink.activate player  endifendifend

Then someone suggested this script which sort of works but the door can still be activated directly and there are no control panel animations
ScriptName Vault74_door_key_open;Vault74Door;01012627 vault74 keyBegin OnActivate			   if(Player.GetItemCount 01012627 == 0);Does The player have the key?						   Return			   endif			   if(Vault74Door.GetopenState == 3 && Vault74Door.GetLockLevel == 100);Is the door Closed?						   Vault74Door.Lock 0 ;Unlock the door						   Vault74Door.SetopenState 1 ;Open the Door			   else ;Otherwise						   Vault74Door.Lock 100 ;Relock the door						   Vault74Door.SetOpenState 0 ;Close The Door			   endifEnd

Does anyone know what i would need to combine the two?

EDIT: ive done this:
ScriptName Vault74_door_key_open;Vault74Door;01012627short moderef myLinkbegin onActivate	 if IsActionRef player == 1			   if(Player.GetItemCount 01012627 == 0);Does The player have the key?						   Return			   endif		set myLink to getLinkedRef			;the linked ref should be the door.		if ((myLink.getOpenState == 3) || (myLink.getOpenState == 1)) && mode != 2						;door closed or open			playgroup Forward 0												;pull handle out			set mode to 2			activate myLink													;activate all the things that this is an activate parent of - klaxon light and activator.		endif	endifendbegin gameMode		if (mode == 2)		if (isAnimPlaying == 0)			set myLink to getLinkedRef			;the linked ref should be the door.			playgroup Left 1												;pull handle down			set mode to 3			myLink.activate player		endif	endifend
which works and only allows me to open the door with the control pod and key but i have to add the control panel as a parent activate and set it to parent activate only to stop you clicking on the door and it opening. Is that the best way to do it? does seem a bit sloppy
User avatar
Sharra Llenos
 
Posts: 3399
Joined: Wed Jan 17, 2007 1:09 pm

Post » Sat Nov 24, 2012 12:39 am

Did you consider adding a script to the door itself just displaying a message "this door is opened elsewhere" followed by a return when the player tries to activate the door instead of the panel ?
the script and test will run fine on the panel but wil do nothing on the door.
User avatar
Stephanie I
 
Posts: 3357
Joined: Thu Apr 05, 2007 3:28 pm

Post » Sat Nov 24, 2012 9:23 am

Did you consider adding a script to the door itself just displaying a message "this door is opened elsewhere" followed by a return when the player tries to activate the door instead of the panel ?
the script and test will run fine on the panel but wil do nothing on the door.
thanks i'll try that :)
User avatar
clelia vega
 
Posts: 3433
Joined: Wed Mar 21, 2007 6:04 pm


Return to Fallout 3