Relic Castle

For my game I need to do this and I have no idea how to do so.
I've seen it done before
Example: Pokemon Uranium forces Pokemon to hold Mega Stone

If someone can tell me how thanks!
Also I'm using 17.2
Top