Interesting. Alright, first of all, please could you remove your signature? Images (both animated and inanimated) are not permitted as signatures here.
In regards to your question, couldn't you just place rectangular triggers on top of enterable buildings?
How many buildings roughly are we talking about here? Are we dealing with small urban combat situations? AI are particularly bad when it comes to CQB; they can walk through walls, see through walls, and even shoot through walls.
If we're talking about a small selection of buildings, then the placing of triggers shouldn't be too much hassle.
-Put a rectangular trigger on top of an enterable building, and size it accordingly.
-Group the trigger to a unit (the unit you want to check when inside a building)
-Make another unit (the unit to move to the building's location, or the trigger's location in this instance)
-In the trigger we placed earlier, put this in the On activation field:
loon1 move (getpos trig1)
loon1 is the response unit, trig1 is the name of the trigger on top of the building
You'll need to make quite a few triggers if you go with this solution. You could still use a gamelogic, by setpos'ing it to the location of the building trigger, and finding the nearestbuilding to the gamelogic. I'm not sure whether nearestbuilding works with triggers. Once the gamelogic has found the nearestbuilding, you can then find out the number of buildingpos in that building, and move a unit to each position in turn.
This would simulate a unit checking each position in a building for another unit. There's a function in the editor's depot that can count the number of buildingpos in a building.
My solution may seem simple, but sometimes the simplest solutions are the best.
Hope this helps
Gruntage