Y'know, there's an article on random variables.
Okay, for a concrete example, say I have a forest. The forest is, we'll say, a square forest, five by five. So the total forest is 25 pages. I'm calling the pages 1-25 while I work for simplicity. (In an actual game, I'd probably rename them all "Forest" just before publishing.)
| 1 |
2 |
3 |
4 |
5 |
| 6 |
7 |
8 |
9 |
10 |
| 11 |
12 |
13 |
14 |
15 |
| 16 |
17 |
18 |
19 |
20 |
| 21 |
22 |
23 |
24 |
25 |
I want there to be one silver medallion in this forest somewhere. So I create the item "Silver Medallion" and I say it is found on the page called "You find a silver medallion."
Now, I create a variable SILVER and on the very first link of the game I make sure to Reset SILVER 1D25.
Now I make my pages 1-25 however I want them- and on each page I add a link to the page "You find a silver medallion."
On "Page 1" I make the link restriction SILVER=1. On "Page 2" I make the restriction SILVER=2, and so on. Whichever number 1-25 SILVER was reset to, on that page alone, the link to "You find a silver medallion" will appear.
On the page "You find a silver medallion" I set the link to Return to the Previous Page. Also, Reset SILVER 0, assuming I only want one silver medallion to be findable in the forest.
If I wanted the player to be able to collect a lot of silver medallions, I could just Reset SILVER 1D25 again.
(There's probably an easier way to do this, but this works for me.)