If it's based off of a unit being trained, try using:
- Events
- Unit - A unit is trained
- Conditions
- Actions
- If/ then/else, multiple functions
- If - Conditions
- (Unit-type of (Trained Unit)) is Equal to Footman
- Then - Actions
- Your actions here
- Else - Actions
- Do Nothing
Yes, but the unit will have to finish training, before the error message appears on the screen, which is way too awkward.
Anyway, nothing leaky
Either do what Maker suggested, or use the Jass version: