You could certainly use triggers. There are a lot of tutorial videos out there.
So you could just have a train unit ability on the barracks with auto cast enabled. You're probably going to have to use triggers to have the units patrol a specific area. I don't know how else you'd do that part with the data editor. Unfortunately I know almost nothing about triggers.