How to cast to an actor with a certain variable value?

As the above poster mentioned you need a reference for this to work. If you have trouble creating one or need to know a few ways to make the reference check out this link, video #25 in the series is all about creating references. You can see which method will work best for your situation.