dylbill Posted April 11, 2021 Share Posted April 11, 2021 Ah, if you wanted to do it that way you could do something like this: Function TakeAway(int PiecesToRemove, ObjectReference Player, Form ObjectToGive) Int index = 0 Int M = SoulGemPieces.GetSize() While PiecesToRemove > 0 Form Entry = SoulGemPieces.GetAt(index) If Player.GetItemCount(Entry) > 0 Player.RemoveItem(Entry,1,true) PiecesToRemove -= 1 EndIf index += 1 If index >= M index = 0 ;cycle through again. Endif EndWhile Player.AddItem(ObjectToGive) EndFunctionThat way, if PiecesToRemove == 4 and the player has say 2 of one type and 2 of another rather than 1 of each the function will still work. Link to comment Share on other sites More sharing options...
Recommended Posts