I dont see any "Main Layout" in the posted .cap.
So i can not help you with the variable.
But i do see other things in the posted .cap.
1/ the for each conditions in the key assignments are unneeded.
Why ?
Well, the compare private variable condition you have in the key binding events are Pick Conditions already. Every "Compare" condition is a Pick Condition, its a hidden LOOP already.
It works as follow.
It takes ALL the tanks. Loops trough them 1 by 1, hidden and in the background. It will test the private variable (in your case 'TankID'), if it meets the test conditions (in your case if 'TankID is equal to a number), it will feed that object to its Sub Events and Actions.
So when you compare ALL the tanks private variable TankID to the value 1. It takes all the tanks, and only the tank with TankID 1 gets picked out. Or what i call, gets picked from the group.
All sub events and conditions will only work on/with that picked tank.
What you now do is this.
The for each condition loops trough all 8 tanks, and the Compare condition loops trough all 8 tanks.
So what you do you could write as :
Loop from 1 to 8 (the for each loop)
_____if anything and nothing
_______ do nothing with tank(loopcounter)
_________Loop from 1 to 8 (the compare loop)
___________if 'TankID' = 1 -------------------------------------------> do actions and subevents
___________end if
_________end loop
_____end if
end loop
Each tank is passing 64 times a loop, where only 1 time is needed. At the end your game will lag.
2/ I see you still do not use containers. You do not have to. But it will make your live a lot more simple