Hi there!
Humm. That looks mighty complicated. When it comes to situations like these, that have no overt error messages but you're still not getting the desired result, what you should try for is using a lot of hints to debug it piece by piece. Also, you have to make sure that you're not messing up the switch...do's by giving them things they don't understand (for instance one of the leaders having a rank that's none of the 5 that it can detect, in which case the rank wouldn't be turned into a number).
Anyway, use sleeps + hints to make sure each part works as it's supposed to. If not, you might i.e. have to invest in some more local variables, use
private to make sure variables are being properly defined/aren't overwriting eachother, and some other tricks here and there. Anyway, try this:
_HighestRankW1 = leader groupW1;
_RankLW1 = rank _HighestRankW1;
_HighestRankW2 = leader groupW2;
_RankLW2 = rank _HighestRankW2;
_HighestRankW3 = leader groupW3;
_RankLW3 = rank _HighestRankW3;
_HighestRankW4 = leader groupW4;
_RankLW4 = rank _HighestRankW4;
sleep 1;
//To make sure the _HighestRankWX variable is getting defined properly. Should return the "Private", "Corporal" etc strings.
hint format ["%1, %2, %3, %4", _RankLW1, _RankLW2, _RankLW3, _RankLW4];
switch (_RankLW1) do {case "PRIVATE": {_RankLW1 = 1}; case "CORPORAL": {_RankLW1 = 2}; case "SERGEANT": {_RankLW1 = 3}; case "LIEUTENANT": {_RankLW1 = 4}; case "CAPTAIN": {_RankLW1 = 4};}
switch (_RankLW2) do {case "PRIVATE": {_RankLW2 = 1}; case "CORPORAL": {_RankLW2 = 2}; case "SERGEANT": {_RankLW2 = 3}; case "LIEUTENANT": {_RankLW2 = 4}; case "CAPTAIN": {_RankLW2 = 4};}
switch (_RankLW3) do {case "PRIVATE": {_RankLW3 = 1}; case "CORPORAL": {_RankLW3 = 2}; case "SERGEANT": {_RankLW3 = 3}; case "LIEUTENANT": {_RankLW3 = 4}; case "CAPTAIN": {_RankLW3 = 4};}
switch (_RankLW4) do {case "PRIVATE": {_RankLW4 = 1}; case "CORPORAL": {_RankLW4 = 2}; case "SERGEANT": {_RankLW4 = 3}; case "LIEUTENANT": {_RankLW4 = 4}; case "CAPTAIN": {_RankLW4 = 4};}
sleep 1;
//To see if they've properly changed the strings into numbers (should return i.e. 1, 2, 3, 4...)
hint format ["%1, %2, %3, %4", _RankLW1, _RankLW2, _RankLW3, _RankLW4];
_HighestRankWest = (_RankLW1 max _RankLW2) max (_RankLW3 max _RankLW4);
sleep 1;
//To make sure _HighestRankWest works as it's supposed to
hint format ["%1", _HighestRankWest];
switch (_HighestRankWest) do {case _RankLW1 : {_JOIN = leader groupW1}; case _RankLW2 : {_JOIN = leader groupW2}; case _RankLW3 : {_JOIN = leader groupW3}; case _RankLW4 : {_JOIN = leader groupW4};}
sleep 1;
//To find out who Join turned out to be.
hint format ["%1", _JOIN];
[Prince] join _JOIN;
Some things I noted:
Lt. and Cpt. are both given the number 4 as their maximum : so if you have another Lt. in the group, he's equally possible to be the one getting the Prince.
In the final check, you only check for numbers...so in the case of more than one "3" for instance, it'll be the lucky group who's first that'll get the Prince. But I'm guessing that's not a problem.
Anyway, try it with the hints to see where it is that things go wrong.
Wolfrug out.