Complete Example Scripts: Difference between revisions
Jump to navigation
Jump to search
m
→Script a container that only accepts certain types of items: Optimized
imported>ShadeMe (Removed bylines) |
imported>JustinOther |
||
| Line 802: | Line 802: | ||
'''How to use this script''': Change the ITEM properties to whatever you want and the container will only accepts those items. If you want a container that only accepts an item that isnt a MiscObject just change the property type to the correct type. If you require your container to accept more than just three item types add another property for the item followed by another If (akBaseItem != ITEM4). Dont forget your Endif! | '''How to use this script''': Change the ITEM properties to whatever you want and the container will only accepts those items. If you want a container that only accepts an item that isnt a MiscObject just change the property type to the correct type. If you require your container to accept more than just three item types add another property for the item followed by another If (akBaseItem != ITEM4). Dont forget your Endif! | ||
<Source lang="Papyrus"> | <Source lang="Papyrus"> | ||
ScriptName ExampleContainerScript extends ObjectReference | |||
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 !AcceptedItemFLST.HasForm(akBaseItem) | |||
RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer) | |||
Debug.Trace("Invaild Item") | |||
EndIf | |||
Endif | |||
EndEvent</Source> | |||
Endif | |||
EndEvent | |||
</Source> | |||