You might want to take a look at the “Hide and Seek” example to see how to do this. In that example, a Widowmaker that sees a Tracer will cause damage. This should get you started on the right foot.
This thread was added on April 24, 2019, with posts from KeithMiron-1943.