In Rayd's following Pokemon tutorial, someone had the same problem as me, and he replied:
"It's really pretty simple. Somewhere in your game, at the point where you want following Pokemon to activate, put a blank event and name it "Dependent". Look at this event's ID and remember what it is...