Chronepsys Posted September 12 Share Posted September 12 Hi there, Not that simple to make a short title with enough info. I get an unexpected behavior from my button/portal minigame using a script. Basic : three buttons controling five portals, depending of their combination of activation I use : - Three Dwemer Button - Three ButtonMarker (Xmarker) - Five Portals (Activator for now) - Five PortalMarker (Xmarker) Each portal is linked to its PortalMarker with the "enable parent" feature. Each PortalMarker is initialy disabled, the Portals follow. Each of the three Buttons is ruled by the following script which do this in short : - Play sound and animation. - Check its button (ButtonT in the script) state and sets it in opposite state. - Wait 0.5sec (just in case, not needed) - Check state of button1, Button2, Button3 and then enable portal 1 if combination matches (Combination are given later in the post) - Do the same for portal 2, 3, 4 and 5. Things work fine except when : Button 1 is 0 (Disabled) Button 2 is 0 (Disabled) Button 3 is 1 (Enabled) Portal 3 is 1 the other are 0 as they should When activating Button 1 Portal 3 should disable and 4 enable. Portal 4 do his job but portal 3 no. I get its debug message telling me it gets its order to disable. But Portal 3 does not... Other combination will disable him as it should. I have checked many things and many times my script, links, markers, buttons, ... And i really do not understand what is going bad here. So i ask for your help. Do you have some advices for me please ? PS : Forgive my english, i am French. Combinations here Spoiler Button 1, 2 and 3 to 0 -> Portal 1, 2, 3, 4 and 5 are Disabled Button ( 1 0 0 ) -> Portal ( 0 0 0 0 0 ) Button ( 0 0 1 ) -> Portal ( 0 0 1 0 0 ) Button ( 1 0 1 ) -> Portal ( 0 0 0 1 0 ) The other combination are set up but get no interest here and are in the script if you need. Script here Spoiler Scriptname _PortalCode extends ObjectReference {Enable 1 button Check the combination for each portal Enable the portal if combination matches Disable the portal if combination doesn't matches} Actor Property PlayerREF Auto Sound Property QSTAstrolabeButtonPressX Auto ObjectReference Property ButtonT Auto ObjectReference Property Button1 Auto ObjectReference Property Button2 Auto ObjectReference Property Button3 Auto ObjectReference Property Portal1 Auto ObjectReference Property Portal2 Auto ObjectReference Property Portal3 Auto ObjectReference Property Portal4 Auto ObjectReference Property Portal5 Auto ;-------------------------------------------------------------------------------- Event OnCellAttach() ; this event runs when cell is loaded containing this scripted object PlayAnimation("Open") EndEvent Event OnActivate(ObjectReference akActionRef) If akActionRef == PlayerREF PlayAnimationAndWait("Trigger01", "done") ; sound and animation If QSTAstrolabeButtonPressX QSTAstrolabeButtonPressX.Play(Self) EndIf ; Debug.MessageBox("Joy!") ; DebugMessage ButtonActivation() Utility.Wait(0.5) PortalMatchCheck() EndIf EndEvent ;-------------------------------------------------------------------------------- ;----------Button activation-------------------------------------------------- Function ButtonActivation() If (ButtonT.IsDisabled()); Check the target button state ButtonT.Enable(); Enable if not Else ButtonT.Disable(); Disable if not EndIf EndFunction ;-------------------------------------------------------------------------------- ;----------Button activation-------------------------------------------------- Function PortalMatchCheck() ;----------Portal 1 Check----- ;Portal1 match with 0 1 0 If (Button1.isDisabled()) && (Button2.isEnabled()) && (Button3.isDisabled()) Portal1.Enable() Else Portal1.Disable() EndIf ;----------Portal 2 Check----- ;Portal2 match with 1 1 0 If (Button1.isEnabled()) && (Button2.isEnabled()) && (Button3.isDisabled()) Portal2.Enable() Else Portal2.Disable() EndIf ;----------Portal 3 Check----- ;Portal3 match with 0 0 1 If (Button1.isDisabled()) && (Button2.isDisabled()) && (Button3.isEnabled()) Portal3.Enable() Debug.MessageBox("Portal 3 Enabled") ; DebugMessage Else Portal3.Disable() Debug.MessageBox("Portal 3 Disabled") ; DebugMessage EndIf ;----------Portal 4 Check----- ;Portal4 match with 1 0 1 If (Button1.isEnabled()) && (Button2.isDisabled()) && (Button3.isEnabled()) Portal4.Enable() Else Portal4.Disable() EndIf ;----------Portal 5 Check----- ;Portal5 match with 0 1 1 If (Button1.isDisabled()) && (Button2.isEnabled()) && (Button3.isEnabled()) Portal5.Enable() Else Portal5.Disable() EndIf EndFunction ;-------------------------------------------------------------------------------- Link to comment Share on other sites More sharing options...
Recommended Posts