ScriptName _amm_FakeHarvestScript Extends ObjectReference

Actor Property acPlayer Auto
Potion Property PotionHarvested Auto
Sound Property HarvestSound Auto
MiscObject Property EmptyBottle Auto
Message Property FailureMsg Auto

Event OnActivate(ObjectReference akActivator)

	If (akActivator == acPlayer)
		FakeHarvest()
	EndIf
	
EndEvent

Function FakeHarvest()

	Int iNum = acPlayer.GetNumItems()
	Int iCount = 0
	Bool bEmptyBottle = False
	
	While (iCount < iNum)
		Form frmBottle = acPlayer.GetNthForm(iCount)
		If (frmBottle == EmptyBottle As Form)
			bEmptyBottle = True
		EndIf
		iCount += 1
	EndWhile
	If (bEmptyBottle == True)
		HarvestSound.Play(Self)
		acPlayer.RemoveItem(EmptyBottle As Form, 1, True)
		If (PotionHarvested)
			acPlayer.AddItem(PotionHarvested, 1, False)
		EndIf
	Else
		FailureMsg.Show()
	EndIf

EndFunction
