Scriptname GlobalCounterScript extends ObjectReference
GlobalVariable property GlobalCount auto
Quest property myQuest auto
MiscObject property Obj auto
Int property preReqStage auto
Int property StageToSet auto
int myCount
Auto State Ready
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
if myQuest.GetStage() == preReqStage
if akNewContainer == Game.GetPlayer()
utility.wait(0.10)
myCount = Game.GetPlayer().GetItemCount(Obj)
GlobalCount.SetValue(myCount)
if myCount == 2
myQuest.SetStage(StageToSet)
endif
GoToState("Picked")
endif
endif
EndEvent
EndState
State Picked
EndState