I am having a problem comparing a unit to an array of units and checking if the unit is already in the array.
The array is made in another script which I call in the main script. In the array all damaged vehicles (not yet exploded) will be added.
Now the main script selects units out of a list at random and I would like to make the script choose a different unit if the selected unit is in the array already.
I cant post the script right now since I am at work.
But after the script selected a random unit it will count how many units (if any) are in the array and than compare the selected unit to each unit in the array. If it sees the unit is the same it should go back to start and select another random unit.
And that is where the problem is, even when it selects a unit which is already in the array it doesnt see it is actuall the same.
So I have even tried to get the name of the selected unit and compare it to the name of the units in the array.
It sees the names are the same but still it doesnt go back to start to select a new unit.
What am I doing wrong here? How can I compare a unit to a unit to see if they are the same unit?
I have done this with a position array already (to see if a new position was close or the same to a position selected earlier) but comparing positions works.......comparing units not.
I have searched this weekend but to be honest I get so many hits when searching for compare, array etc etc, its kind of a search without an ending.
I hope someone is able to help me with it, most preferable in .sqs style since I do not yet understand .sqf