NexusComa Posted September 30, 2016 Share Posted September 30, 2016 Use the pressure plate script not the button script [ PressurePlate ].Then add your custom script xmarker script and the [ defaultBlockFollowerActivation ] I think with the lever letting it be and not trying to switch it back would be fine. After all it is a toggle switch.In real life I wouldn't expect a lever to switch itself after I turned a valve ... Also, you need to be careful when editing scripts. The script you are showing me is a default game script.If you change it in anyway it may/will effect the entire game. If you want to change a default script like thatyou need to make a copy by a different name. I checked the SteamLever.Activate(Game.GetPlayer()) It worked fine for me.Having the Lever switch back if you turn the Valve off is a bit harder then I was thinking.I all most got it but have to call it a day ... I will looking into this more tomorrow. Link to comment Share on other sites More sharing options...
NexusComa Posted September 30, 2016 Share Posted September 30, 2016 OK ...Make sure you have all the properties set to the correct thingsin the Creation Kit. (note: one goes to the Steam Lever itself) Valve Script: ScriptName _ValveSwitch Extends ObjectReference;* ValveMarker Switch *ObjectReference Property SteamLever autoObjectReference Property LeverMarker autoObjectReference Property ValveMarker autoEvent OnInit() If(ValveMarker.IsDisabled()) GoToState("ValveOff") Else GoToState("ValveOn") EndIfEndEventState ValveOff Event OnBeginState() ValveMarker.Disable() If(LeverMarker.IsEnabled()) SteamLever.Activate(Game.GetPlayer()) Endif EndEvent Event OnActivate(ObjectReference akActionRef) GoToState("ValveOn") EndEventEndStateState ValveOn Event OnBeginState() ValveMarker.Enable() EndEvent Event OnActivate(ObjectReference akActionRef) GoToState("ValveOff") EndEventEndState Lever Script: ScriptName _LeverSwitch Extends ObjectReference;* LeverMarker Switch *ObjectReference Property LeverMarker autoObjectReference Property ValveMarker autoInt RF = 0 ;Reset flagEvent OnInit() If (LeverMarker.IsDisabled()) GoToState("LeverOff") Else GoToState("LeverOn") EndIfEndEventState LeverOff Event OnBeginState() LeverMarker.Disable() EndEvent Event OnActivate(ObjectReference akActionRef) If(LeverMarker.IsDisabled()&&(ValveMarker.IsEnabled())) GoToState("LeverOn") Else If(RF==(0)) RF=(1) Utility.Wait(2.0) Activate(self) Else RF=(0) EndIf EndIf EndEventEndStateState LeverOn Event OnBeginState() LeverMarker.Enable() EndEvent Event OnActivate(ObjectReference akActionRef) GoToState("LeverOff") EndEventEndState Link to comment Share on other sites More sharing options...
wref48 Posted October 1, 2016 Author Share Posted October 1, 2016 I've just posted that script as an example, I do try not to change the originals, but a very valid advise to any future readers. And thanks a lot for the script, it does change the lever position as intended, though if you spam, it is possible to change its default position (the one it returns to when the marker is off). I really had no idea how to approach making a button out of a trigger, so I continued tinkering with the defaultbutton script. Seem logical enough - play the animationdown then the animation up, but for some reason it wasn't working. It did work as intended when I added Utility.Wait as in your script with 0.2 seconds of wait(to make it go up almost immediately). I've also managed to disable the animation on movable static objects. I've used the method you've mentioned as it appears it's impossible to disable this kind of animations via a script. There is a flash when the objects swap places, BUT only if you make a marker their parent, if you actually include their state in the activator script there is no flash and the transition is very smooth. Link to comment Share on other sites More sharing options...
NexusComa Posted October 2, 2016 Share Posted October 2, 2016 (edited) Ya, I knew I had it but it didn't work until I added the Wait ... Have to wait for the Valve ... I was thinking it would work better the other way around.Like the 1st set of scripts, then use the lever in the valves place and the valve in the levers place. Then you wouldn't have to worry about switchingback the lever at all via script. I'll try your suggestion on the flash as it drives me a bit nuts ... (I just make it so my switches face away from it's effect)One is moving so when it pops back there is a good chance it will not line up to the still version ... That said being able to stop a vent or other movement is worth it. As far as the spamming problem, I posted a fix for that .. "However a pressure plate can be a bit click happy and go off many times as the player walks over it.So, you need to add to the script a way to not let it keep reactivating until the first activation is completed." Something like: Int KF = 0 ; kick flag If "activate" ... If(KF==(0)) KF=(1) ; code ; code ; code KF=(0)Endif A setup like this is pretty much needed for all switches.To stop the player from spamming it ... Some Switches and/or Activators have animations that take a bit. In cases like thatit never hurts to toss in a Utility.wait(5.0). With the time in seconds set to however longthe animation takes plus a second. Above the KF=(0) command. Edited October 2, 2016 by NexusComa Link to comment Share on other sites More sharing options...
Recommended Posts