Look at the wiki page, groupSelectedUnits
returns an array; that means a list of units. When you write `unit2 = groupSelectedUnits player;` or `unit3 = groupSelectedUnits player;`, what you're getting is actually something like this:
unit2 = [unit1, unit2, unit3];
unit3 = [unit1, unit2, unit3];
That's why you get an error that says "Type array,Expected object", because you're trying to use an array instead of a unit. You'd need to use the select
command to pick a specific unit from that array, or use a forEach
loop to do something with all the objects in the array.
Hope it's clear enough now, you don't really need to something specific for each key press, you just have to make sure it's an 'FX' key, then use groupSelectedUnits