Siloz Zanj,
You can only perform such manipulations with units that are already placed on the map. In this case, you need to change the unit's owner to "No player" in the unit's properties within the trigger events, and only then initiate the battle. If a unit is, for example, recruited in a town, you won't be able to change its owner. I would simply place gates in the appropriate locations and allow only those who are supposed to pass through them according to the storyline to do so.
Auto-translated