Edit: Never mind, I've got more time now so I'll just put it up.
You will need four variables & two switches for this. You might be able to do it with fewer, but I'm not worried about that at the moment.
Variable 1: ThisBin
Variable 2: BinOne
Variable 3: BinTwo
Variable 4: RandomNumber
Switch 1:OneFound
Switch 2:BothFound
I advise having a variable that you can reuse for random numbers, rather than creating one for every single throwaway number you might at some point need to generate.
So, if you're sticking to the gym layout as it was in HGSS, your trash cans should be arranged like this.
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
You will need to create an event over one of the bins (which you can copy, paste & change once you're done)
Page 1
Page 1 is the most awkward to create. I've added a few images in to run through the process, with explanations along the way.
First line tells the system which bin you are examining. This is one of the things you will need to change for each copied bin.
Second line sets up a conditional branch to see if the first button has been hidden in a bin.
If it hasn't, the third line will randomly generate a bin to hide it in.
Ok. On to the second part.
Right. The first line asks whether the ThisBin is the same as the BinOne, which was randomly generated a few moments ago. Although you can't see it yet, you will need an else section for this conditional branch.
Put in whatever text/se/bgm/etc. you want when you find the first switch.
Control Switch -
Slight mix up here. I realise that the screenshot says the switch is TwoDown, but it should be the OneFound switch. Make sure you choose the right switch! This switch should tell fence 1 to turn off, so don't forget to do that!
Control Variable - Set to a random between 1 & 4 as there are potentially 4 places the second button could be.
Label - You might want to name this something a bit shorter or more memorable, it's up to you.
Conditional Branch - Did the Random Number come up as 1?
The comment says it all. this is the section for placing the button above the current bin.
The next conditional branch decides whether the second button CAN be placed above the current one. If Bin One is on the top row (numbered 5 or less) then it will go back to the label and try another random number. Otherwise, BinTwo will be set to the same as BinOne, then have five taken away from it.
There's a lot of repetition over the next few images so I'll only go over what's different.
The random number in the Conditional Branch has changed to 2. This is to place the second button on the right of the first.
The Conditional Branch now uses the script as its criteria. Note that the number in square brackets ($game_variables[X]) should be the same as your BinOne Game Variable. This checks to see if, when divided by five, there is a remainder. If there isn't then BinOne will be one of the right hand bins.If there is then BinTwo will be moved one to the right by having one added to it.
Another typo here, sorry! The Conditional Branch that asks whether BinOne is greater than 15 should ask whether it's greater than 10!!! Man I really rushed this.
Ok, you can work this out pretty easily. I'm not going to bore you through repetition.
Again, very similar to the right part. Not Gonna elaborate.
Exactly what it says on the picture.
Page 2
Ok, the Second Page is much easier. It will need OneFound as a precondition on the left hand side of the event page.
Once again you need the set variable (ThisBin). you can copy and this from the top of page 1 if you find it quicker.
Then you need a Conditional Branch that asks whether BinTwo equals ThisBin, with an else statement.
In the Conditional Branch, turn BothFound On and have whatever text etc you want to happen in there (y'know, like the fence going down).
Under else, you need the text saying that there's no button and the other has reset, plus the first fence switching back on. So you'll need to switch OneFound off & set BinOne & BinTwo to 0.
That should have done it. As long as you've set the fences up properly so that they can be turned off via the OneFound & BothFound switches, you now have a Vermillion Gym style puzzle. PM me if there are any problems or I need to edit/clarify something.