i guess you could give the unit the invulnerable ability and then make all air units able to attack invulnerable.... alternatively it seems like if you can change the targeted as datafield for the unit with a function that would be the simplest and easiest way. you just make it so whatever field that is, be it ward or ancient or tauren or whatever....that air can attack it and ground can't. i can check the function list for something like that but i think it doesn't exist...yeah i'm not seeing anything like that. maybe you have to do some kind of morphing and make the morphed unit have that targeted as field which ground units won't be able to attack.
i use this method but i haven't tried doing the morphing thing yet...it's not something that's practical for a tag map like what i made but in my new map i might make some hero be able to morph...i'm not sure yet.
i know it's not a perfect solution because you have to take something that you wouldn't use much anyway and make it also be for that single unit.
for example...in my map you can't target critters with your heroes... so my message will pop up if you try to target them you cannot target critters or air. that's because the critters are targetted as air units. i guess you could do the same thing but take it a step further by having your unit morph into an unit which is a replica of your unmorphed unit only difference is one is targeted as ground and another is targeted as air.
i'm not sure what triggers the unit's invulnerable to ground that you are asking for, but if i had to guess, it's a simple ability right? so make the ability like storm crow form or bear form or metamorphosis or something like that and i think it should work. like i said i haven't played around with morphing so i'm not sure how it will go, but you should be able to figure it out by looking at some tutorials about morphing or something like that.
i think there will be a few different ways you can handle the morphing...you could make it auto temporary by making it have a duration, or take the duration out and it's permanent, if you need to make it temporary you can trigger the unit to use the ability which will make it morph again. although if you do that you'd want the spell to cost nothing to cast... that's all i can think of at the moment to help you figure it out.
cant you change, the unit that you want unattackable by ground, 'targeted as' type to air?
yeah i don't think there's actually a function for that, that's my suggestion too. i think the best way to work around it is to morph the unit into an alternate version like i mentioned above...
anyway it sounds like he doesn't even want archers to be able to attack the unit, if that's the case he would most likely want to select something else for this special unit's targeted as field other than air, that or make all the air units targeted by something else and change the archers' targets allowed fields, but that seems like too much work.
there should be plenty of fields to choose from, i would recommend finding one that you would rarely or better still, never use for the field...like if you have no wards in your map you can use the wards field. and again, you could make the wards that you would have in your map be targeted as something else. i'm not saying i'm recommending those, it's just an example.
this thread talks a bit about this sort of thing:
www.hiveworkshop.com/forums/triggers-and-scripts-269/trigger-item-ability-help-126229/