SetObjectOwner (hero, 1)
Where hero is the hero; if it's a script name, it should be in quotes, and 1 is the red player.
Added 4 minutes later
How to write the script itself (create a file for it), see elsewhere; I can't do it right away, I need the map itself.
A complete example for the hero Rolf:
SetObjectOwner ("Rolf", 2)
2 is the blue player.