Scriptname _00E_FS_NQ06_PuzzleLeverScript extends ObjectReference Conditional

Import Utility

;=====================================================================================
;              							EVENTS                  					 
;=====================================================================================

Event OnActivate(ObjectReference akActionRef)

int iCurrentValue = _00E_FS_NQ06_LeversGlobal.GetValueInt()

if  bRiddleSolved == false
	if (iCurrentValue < 2	&& iPushed == 0)
		iPushed = 1
		QSTAstrolabeButtonPressX.Play(Self)
		_00E_FS_NQ06_LeversGlobal.SetValue(iCurrentValue + 1)
		self.playAnimation("FullPush")
		Wait(8)
		_00E_FS_NQ06_LeversGlobal.SetValue(0)
		QSTAstrolabeButtonOpenX.Play(PlayerREF)
		self.playAnimation("FullPull")
		iPushed = 0
	ElseIf (iCurrentValue == 2 && iPushed == 0)
		iPushed = 1
		self.playAnimation("FullPush")
		QSTAstrolabeButtonPressX.Play(Self)
		_00E_FS_NQ06_SecretDoor.SetOpen()
		_00E_SecretWoodDoorSlideOpenLPM.Play(PlayerREF)
		_00E_FS_NQ06_LeversGlobal.SetValue(3)
		bRiddleSolved = True
		Wait(8)
		self.playAnimation("FullPull")
	Else	
		;do nothing
	EndIf
EndIf
		
EndEvent

;=====================================================================================
;              							PROPERTIES                  					 
;=====================================================================================

bool bRiddleSolved 
bool bCurrentlyRunning
int iPushed = 0

GlobalVariable Property _00E_FS_NQ06_LeversGlobal Auto

Sound Property QSTAstrolabeButtonPressX Auto
Sound Property QSTAstrolabeButtonOpenX Auto
Sound Property _00E_SecretWoodDoorSlideOpenLPM Auto
ObjectReference Property _00E_FS_NQ06_SecretDoor Auto

Actor Property PlayerREF Auto