Jump to content

Why is my script waiting in an IF condition not met?


Recommended Posts

Have a lock gate script that works fine except, it appears, that the script is executing a Utility.Wait in conditions that are not met. That's the best way I can explain it. Video link attached and script.

In the video you can see that when player activates the lever - not the first time but every time after - that it needs 2 pulls. I am guessing the script is executing a Utility.Wait that I don't want it to.

 

Float Property GateOpening Auto
GlobalVariable Property My_GV_LockWater Auto
ObjectReference Property GateSE1Acti Auto
ObjectReference Property GateSE2Acti Auto
ObjectReference Property GateSW1Acti Auto
ObjectReference Property GateSW2Acti Auto
ObjectReference Property LockGateCollE Auto
ObjectReference Property LeverCollE Auto
ObjectReference Property ValveCollE Auto
ObjectReference Property LockGateCollW Auto
ObjectReference Property LeverCollW Auto
ObjectReference Property ValveCollW Auto

Bool Property IsEastGate = True Auto

Event OnActivate(ObjectReference akActionRef)

If IsEastGate == True && My_GV_LockWater.GetValue() == 1; east gate, water up
debug.notification("Cannot Open East Gates At Current Water Level")
EndIf

If IsEastGate == False && My_GV_LockWater.GetValue() == 0; west gate, water down
debug.notification("Cannot Open West Gates At Current Water Level")
EndIf

If IsEastGate == True && My_GV_LockWater.GetValue() == 0; east gate, water down
LeverCollE.Enable()
ValveCollE.Enable()
GateSE1Acti.Activate(Self)
GateSE2Acti.Activate(Self)
Utility.Wait(GateOpening); wait for translation
If LockGateCollE.IsEnabled()
LockGateCollE.Disable()
Else
LockGateCollE.Enable()
EndIf
LeverCollE.Disable()
ValveCollE.Disable()
EndIf

If IsEastGate == False && My_GV_LockWater.GetValue() == 1; west gate, water up
LeverCollW.Enable()
ValveCollW.Enable()
GateSW1Acti.Activate(Self)
GateSW2Acti.Activate(Self)
Utility.Wait(GateOpening); wait for translation
If LockGateCollW.IsEnabled()
LockGateCollW.Disable()
Else
LockGateCollW.Enable()
EndIf
LeverCollW.Disable()
ValveCollW.Disable()
EndIf

EndEvent

 

 

https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2152845&parId=B60C11D037429D8E%21191&o=OneUp

Edited by antstubell
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...