1.) Create four (or more for multiple entrances) locations for each building; the player walks into location 1, gets moved to location 3, and after doing whatever inside the building, walks to location 2 and gets moved to location 4.
Advantages: Is simple.
Doesn't require that the game keep track of whether or not the player is in a building.
Disadvantages: TOO MANY LOCATIONS!
May cause problems in really small buildings with little room.
Could cause problems if a lot of units are trying to cram their way in or out (a player could enter a building only to find himself unable to get out because he's surrounded by enemies at "location 3" (from the example).
2.) Create two locations for each building, and have some sort of marker at each entrance (such as a beacon). When the game detects one of these markers in a location centered at the player, change a death counter or a switch. When the game no longer detects the marker, change it back. When the game detects the marker again, it'll be reasonable to assume that the player is ready to leave the building, since he left the entrance location and then went back.
Advantages: Uh... it doesn't use as many locations as #1... that's about all I can think of...
Disadvantages: Requires a marker unit (requires a unit type be dedicated to the purpose of marking entrances and will likely have an impact on the aesthetics of the building entrance). I could circumvent this by using a death count instead of a marker unit, but that'd be significantly more trigger-work (I think).
Requires that the game know what unit is entering the building, and prevents more than one unit from entering or leaving the building at a time. (This I cannot figure out how to fix)
Requires the a player move away from the marker, which may be inconvenient if the player gets physically trapped (ie, surrounded by enemies).
Complex and tedious to implement.
3.) Have some sort of button to press (such as a reaver building scarabs) that the player could activate when they wanted to enter a building.
Advantages: Simple and easy to implement.
Allows the user to control when he enters a building, so that accidental entries are impossible.
Disadvantages: The player either would only be able to have one unit that could enter buildings, or a set of buttons for each building (which would require more locations, triggers, and space defeating the first advantage and giving it the same key flaw as system #1).
Stupid people probably wouldn't be able to figure it out.
It would be difficult to implement any secret buildings, since the player would probably have to be aware of them to take the initiative to press the button.
I think that's all the systems I've come up with so far... any ideas on better ones?
The map is an rpg, but has the possibility for players to acquire armies (most likely, anyway). The "hero" unit changes throughout the game (for instance, a player could start as a peasant (scv), then join the army and become a swordsman (zealot), then commit suicide and become a vampire (dark templar), then later try and become a Dark Lord (dark archon)), which means that if the game would have to know what unit is entering the building, I would need triggers for each possibility (even if non-heroes won't be entering buildings). And there's likely going to be a lot of buildings to put in, although I'm not certain yet (I haven't created all the buildings and decided which ones will be enterable yet; it depends on how much room I have left over when I finish drawing the world and designing the other buildings).
None.