Hi Scipters,
I want to make a script that means if the player has armour in their inventory that is better than that equipped, then swap the armours (so if diamond boots in inventory, and iron boots equipped, swap them).
I have managed to get "swapItems" to work, but now I need to work out a method to check all inventory slots and compare to the armour slots.
This is my swap code atm, which if the player has the tag "SWAP", it will rapidly swap the items in slot 1 and 2 (hotbar 2nd and 3rd slot)
const inventory = player.getComponent("inventory").container
if (player.hasTag("SWAP")) {
inventory.swapItems(1, 2, inventory)
}
Any help working out how to set this up would be amazing. I am a noob when it comes to complex functions like this 🙂