Complete Example Scripts: Difference between revisions

Jump to navigation Jump to search
m
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
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 akSourceContainer == Game.GetPlayer()
If (akBaseItem !=  ITEM1)
If !AcceptedItemFLST.HasForm(akBaseItem)
If (akBaseItem !=  ITEM2)
RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer)
If (akBaseItem !=  ITEM3)
Debug.Trace("Invaild Item")
Self.RemoveItem(akBaseItem, aiItemCount, True)
EndIf
Game.GetPlayer().Additem(akBaseItem, aiItemCount, True)
Endif
Debug.Notification("Invaild Item")
EndEvent</Source>
Endif
Endif
EndIf
Endif
EndEvent
MiscObject Property ITEM1  Auto 
MiscObject Property ITEM2  Auto
MiscObject Property ITEM3  Auto
</Source>
Anonymous user

Navigation menu