Get the lowest armor and remove based on percentage

Hello everyone,

I’m making a system for zombie armor but I can’t find the right method to remove the armor that has the least armor point once it’s less then the zombie’s total armor, I’m bad at explaining so here is an example:

let’s say the zombie wear 2 armors:

["Helmet"] = 10,
["Chestplate"] = 15,

That would make the zombie have a total of 25 armor points now when he reach 5 armor points after getting damaged the Helmet will be removed.

How would I achieve this? Thank you.

You could go through all of the armor by doing a for loop with the table as the search table. Then have a min defense and set that to math.huge. If the armor value is less than min defense then that value is min defense and best option.

(You also have to create a variable for best option)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.