Complete Example Scripts: Difference between revisions

Jump to navigation Jump to search
m
→‎Script a container that only accepts certain types of items: GetPlayer swapped for PlayerREF for consistency and 'cause it's leagues faster/cheaper
imported>JustinOther
imported>JustinOther
m (→‎Script a container that only accepts certain types of items: GetPlayer swapped for PlayerREF for consistency and 'cause it's leagues faster/cheaper)
Line 579: Line 579:
'''How to use this script''': Fill the FormList, AcceptedItemFLST, with only the item(s) you want the container to accept.
'''How to use this script''': Fill the FormList, AcceptedItemFLST, with only the item(s) you want the container to accept.
<Source lang="Papyrus">
<Source lang="Papyrus">
ScriptName ExampleContainerScript extends ObjectReference
ScriptName ExampleContainerScript Extends ObjectReference


Actor Property PlayerREF Auto
FormList Property AcceptedItemFLST Auto
FormList Property AcceptedItemFLST Auto


Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
If akSourceContainer == Game.GetPlayer()
If akSourceContainer == PlayerREF
If !AcceptedItemFLST.HasForm(akBaseItem)
If !AcceptedItemFLST.HasForm(akBaseItem)
RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer)
RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer)
Anonymous user

Navigation menu