Wait so when somebody else gets your base down to 500 you want it to change ownership of the unit to the owner of the base? This is pretty easy:
Events: Unit - Generic Unit Event ; A unit is attacked
Conditions: Unit Type Comparison ; Unit Type of attacked unit = [the unit going below 500] Real Comparison ; Life of (Attacked Unit) Less than or equal to 500
Actions: Unit Change Owner ; Change owner of (Attacking Unit) to (Owner of Attacked Unit) and Change Color
The stuff in Cyan is the type of trigger and the stuff in orange is the value for that trigger.