Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function MoveListItemsToChest()
- Actor Player = Game.GetPlayer()
- ;Shorten the script
- Int FormToFind = 0
- ;We'll use this to iterate through the list
- Int MaxSize = Myformlist.GetSize()
- ;Find the Maxsize of the formlist so we can end the script if it goes above this number
- While FormToFind <= MaxSize
- ;This will cause the script to loop until the full list is is iterated through
- Int ItemToMoveCount = Player.GetItemCount(Myformlist.GetAt(FormToFind))
- ;Count of The Object we want to move in players inventory
- Form ItemToMove = MyFormlist.GetAt(FormToFind)
- ;The item We Want To Move
- If ItemToMoveCount >= 1
- ;Skip all the other script if the player has zero
- Player.RemoveItem(ItemToMove,ItemToMoveCount,MyChest)
- ;Remove all of The item from the player add them to MyChest
- Debug.Notification("Removed "+ItemToMoveCount+ItemToMove+" from the player")
- ;Optional debug message to tell us what was removed
- FormToFind += 1
- ;Iterate to next form in list
- ElseIf ItemToMoveCount == 0
- ;Player Does Not have the Item
- FormToFind += 1
- ;Iterate to next form in list
- EndIf
- EndWhile
- EndFunction
- FormList Property MyFormlist Auto
- ObjectReference Property MyChest Auto
Advertisement
Add Comment
Please, Sign In to add comment