Page 1 of 1

Setting a value for multiple items in a grid

Posted: Wed May 31, 2017 2:22 pm
by Sigor
How to get to all equipment with the same name in a vehicle grid and read/set their energy?

Re: Setting a value for multiple items in a grid

Posted: Wed May 31, 2017 2:56 pm
by Nexela

Code: Select all

if vehicle.grid then
  for _, eq in pairs vehicle.grid.equipment do
    if eq.name == "eq-name" then
      eq.energy = 0
    end
  end
end