Plarux Posted February 21, 2019 Share Posted February 21, 2019 (edited) Hello, I'm making this post in search of suggestions on how to make a deactivated elevator active, only if the player has activated something on a terminal. There already exists in the game script(s) that make the elevator activate and deactivate, but I'm not sure how to use them in unison with a terminal to activate the elevator. For instance, here is a script for the call button of an elevator. It includes properties for the elevator that if set to true, a message will appear saying "This elevator isn't functional". It's a pretty big script and my understanding of it is very limited, but I can see that there are lines concerning "On Activate". Are these lines something I could alter to make it where the elevator is active after the player activates a button on a terminal or is there an alternative way to write a script that does what I need it to? Any help is appreciated. Thank You, Plarux Scriptname LoadElevatorPanelScript extends ObjectReference Hidden Group Optional_Properties Bool Property bStartDeactivated = FALSE Auto { Whether this elevator starts "off" or not. If set to TRUE then LinkCustom01 this button to the ElevatorMeter above the door. } Message Property DeactivatedMessage Auto {Message that shows up when any elevator button is pressed while it's deactivated.} EndGroup Group No_Touchy CollapsedOnRef Bool Property InteriorPanel = FALSE Auto Const {Only for the button inside the elevator.} Keyword Property LinkCustom01 Auto Const {Only used if you want this elevator to start in the "off" state, to be turned on later.} ;Keyword Property LinkCustom02 Auto Const ;{Only used if you want this elevator to start in the "off" state, to be turned on later.} EndGroup Bool bHasAlreadyLoaded = FALSE Event OnLoad() if !bHasAlreadyLoaded bHasAlreadyLoaded = TRUE if InteriorPanel PlayAnimation("Play01") endif utility.Wait(0.1) if bStartDeactivated ObjectReference Link01 = GetLinkedRef(LinkCustom01) if Link01 if !Link01.Is3DLoaded() Link01.Waitfor3dLoad() endif Link01.PlayAnimation("Play02") endif if GetLinkedRef().GetLinkedRef() RegisterForRemoteEvent(GetLinkedRef().GetLinkedRef(), "OnActivate") GetLinkedRef().GetLinkedRef().BlockActivation() endif Playanimation("StartOff") else ;Do Nothing endif endif EndEvent Event ObjectReference.OnActivate(ObjectReference akSender, ObjectReference akActionRef) if akSender == GetLinkedRef().GetLinkedRef() if bStartDeactivated if akActionRef == Game.GetPlayer() DeactivatedMessage.Show() endif endif endif EndEVENT Event OnActivate(ObjectReference akActionRef) if bStartDeactivated if akActionRef == Game.GetPlayer() DeactivatedMessage.Show() endif else if InteriorPanel if GetLinkedRef().GetOpenState() == 1 GetLinkedRef().Activate(Game.GetPlayer()) endif else if GetLinkedRef().GetOpenState() == 3 (GetLinkedRef() as LoadElevatorDoorScript).ActivatedFromButton = TRUE GetLinkedRef().Activate(Game.GetPlayer()) endif endif endif EndEvent Function MakeElevatorFunctional() bStartDeactivated = FALSE if GetLinkedRef(LinkCustom01) GetLinkedRef(LinkCustom01).PlayAnimation("StartOn") GetLinkedRef().SetLockLevel(0) endif if GetLinkedRef().GetLinkedRef() UnRegisterForRemoteEvent(GetLinkedRef().GetLinkedRef(), "OnActivate") GetLinkedRef().GetLinkedRef().BlockActivation(FALSE) endif Playanimation("Play02") EndFunction Function MakeElevatorNonFunctional(bool ShouldDoorClose = TRUE) bStartDeactivated = TRUE if GetLinkedRef().GetLinkedRef(LinkCustom01) GetLinkedRef().GetLinkedRef(LinkCustom01).PlayAnimation("Play02") endif if GetLinkedRef() if ShouldDoorClose GetLinkedRef().SetOpen(FALSE) GetLinkedRef().SetLockLevel(254) else GetLinkedRef().SetOpen(TRUE) endif endif if GetLinkedRef().GetLinkedRef() RegisterForRemoteEvent(GetLinkedRef().GetLinkedRef(), "OnActivate") if ShouldDoorClose GetLinkedRef().GetLinkedRef().SetOpen(FALSE) else GetLinkedRef().GetLinkedRef().SetOpen(TRUE) endif GetLinkedRef().GetLinkedRef().BlockActivation() endif Playanimation("StartOff") utility.Wait(1) if GetLinkedRef() if !ShouldDoorClose GetLinkedRef().SetOpen(TRUE) endif endif if GetLinkedRef().GetLinkedRef() if !ShouldDoorClose GetLinkedRef().GetLinkedRef().SetOpen(TRUE) endif endif EndFunction Edited February 21, 2019 by Plarux Link to comment Share on other sites More sharing options...
DieFeM Posted February 22, 2019 Share Posted February 22, 2019 (edited) You don't need to change this script, you just need to change the property bStartDeactivated from your terminal script, by adding a property to your script like this: LoadElevatorPanelScript Property ElevatorPanel Auto Const MandatoryThen, in whatever function or event you are willing to change this property, use: ElevatorPanel.bStartDeactivated = Trueor ElevatorPanel.bStartDeactivated = FalseWhen you compile the script, go to the script properties, fill the ElevatorPanel property by using the option "Pick Reference in Render Window" and pick the elevator panel of the elevator that you want to make active. EDIT: If this doesn't work, you can try calling the functions MakeElevatorFunctional() or MakeElevatorNonFunctional() on the ElevatorPanel: ElevatorPanel.MakeElevatorFunctional()or ElevatorPanel.MakeElevatorNonFunctional() Edited February 22, 2019 by DieFeM Link to comment Share on other sites More sharing options...
Plarux Posted February 22, 2019 Author Share Posted February 22, 2019 DieFeM, thank you for the explanation! Link to comment Share on other sites More sharing options...
MissingMeshTV Posted February 22, 2019 Share Posted February 22, 2019 You might have a look at the terminal and elevator in the Switchboard that you need to activate to leave. They should give you an idea on how to set your properties and link your references. IIRC, it functions pretty much as you said you want: you need to choose an "activate power" item on the terminal for the elevator to function. If there is a vanilla script that more or less does what you want, just look at how it gets implemented in the game and you can learn a lot about how the script properties work without ever having to modify the script...which you generally don't ever want to do...if that's what you were originally thinking. Link to comment Share on other sites More sharing options...
Recommended Posts