Everything looked ok, each soldiers rating corresponded to the values you use in your function.
Yes, I know, I run a test mission with sideChat debug that does exactly same, it returns all the stuff I need to see whether the function works ok...
So,
rating returns the correct value, BUT my function somehow doesn't work...
It's either the marking routine that doesn't work (altough I've confirmed that it at least runs, and it's much more 'complicated' than your example, and does not work with forEach for some reason...), or the process of getting the unit from inside a vehicle and then getting the below decimal stuff from the rating doesn't work...
The problem here is that when a unit is inside a vehicle it actually is not in the thisList array...
So, the mark routine checks if the selected unit in the array is a vehicle and then 'goes inside' it and marks all the units in it (at least it should...)
Then, when the rank process is called it needs to be checked whether the passed unit is in a vehicle... And this is actually where I have the problem now... First, I need to determine if the units is in a vehicle, and that's easy...
Then I need the crew array of the vehicle the passed unit is in, then the 'position' (index) of the unit (element) in the crew array in order to get the 'actual unit' (well, the pointer...) from the crew array for the process of getting the below decimal value from that units rating...
But, as usual, I may be thinking this way too complicately...
And doing many other things aside of this, I'm starting to have troubles keeping up myself
I noticed that if it's just a driver and gunner (MG Jeep), the driver gets the rank set in the editor, and the gunner one less [.....
Yeah, like I said, the vehicle rank given in the editor goes to the driver and so on... (of course, if there is a driver in that vehicle...)
If you just have a gunner (M2 Machine Gun), he automaticaly gets his rank raised by one. If you set him to Major in the editor, he becomes a Colonel in the game.
Noticed this too.
And there's a process now in the function to 'correct' this...
I actually fail to see the BIS logic behind this one...
Wth is the gunners rating being raised like that...??
With the exception of the MG jeep, it appears straight forward. You can have options in the config for Cargo as Co driver. Perhaps this is what make the MG Jeep different?
Never tested anything with cargoIsCodriver, so won't know what effect it has...
@Kammak:
Yeah, I'm aware of that but that's no longer an issue...
I used that method in some version of this function, but is has some downsides, as the function deals with the crew of a vehicle, not the actual vehicle itself, the typeOf "man" would always return true...
Meaning, the if ("man" countType[_unit]==1) then {person code here, or goto} would always cause the
then part to run...