My code does not work. Its purpose is to iterate over my commandable allies and command them to do whatever it is they’re supposed to do. However, whenever it is called, it only commands one ally to do its job before appearing to end the for loop. Now, when called individually (outside the concentrateFire function), each of the sub functions work perfectly. The issue is somehow here in this code, and I can’t figure out why it won’t work. Can anyone help?
function concentrateFire(fType) local associates = self:findFriends() for i=1, #associates do local friend = associates[i] if friend.type == "soldier" and friend.team == "humans" then killType(fType) elseif friend.type == "archer" and friend.team == "humans" then killType(fType) elseif friend.type == "paladin" and friend.team == "humans" then paladinFollow() end end end
it should be noted i’m using lua