I think u can use just GUI trigger, not need for script, coz i didn't know about script and i can make that trigger
Just try to make 2 regions, one nearby the tavern (TavernReg)and the other nearby the fountain (FountainReg), and make this trigger:
Events:
Unit - Enters TavernReg
Conditions - Triggering Unit Is A hero = True
Action - Move Triggering Unit instantly to Center of FountainReg
If it works you can modify that trigger further, like limit trainin of hero and limit training of unit.
And remember this, there must be TRIGGERING UNIT since:
TRIGGERING UNIT: Used to represent unit that causing the triger works.
MATCHING UNIT: Used to represent unit that was checked its condition when you pick up every unit on unit group with matching condition.
PICKED UNIT: Used to represent unit that was picked, after the matching condition filter was done.
and many more variables that you must know what those variables represent for.