Talk:AddInventoryEventFilter - ObjectReference

Active discussions
Revision as of 04:19, 28 June 2012 by imported>Sollar
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Script to Show Gift Window and Identify Items GivenEdit

This is used for the Player to feed his animal companion. The FormList is created in the CK and includes all the food (Potion & Ingredient) items I want to consider food for the animal.

FormList Property FoodList Auto
Bool hasBeenFedToday = False

Function FeedCompanion()
	AddInventoryEventFilter(FoodList)
	ShowGiftMenu(True, FoodList, False, False)
	RemoveAllInventoryEventFilters()
EndFunction

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
	If akSourceContainer == Game.GetPlayer()
		self.RemoveItem(akBaseItem,aiItemCount)
		If !hasBeenFedToday
			hasBeenFedToday=True
		EndIf
	EndIf
EndEvent

--Sollar 03:17, 28 June 2012 (EDT)

Return to "AddInventoryEventFilter - ObjectReference" page.