From 4ca541cca3013062301103d74258af92264f065a Mon Sep 17 00:00:00 2001 From: Idain Date: Wed, 17 Nov 2021 02:13:33 -0400 Subject: Clarify the use of percentage. --- Smashing-rocks-has-a-chance-to-contain-items.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Smashing-rocks-has-a-chance-to-contain-items.md b/Smashing-rocks-has-a-chance-to-contain-items.md index f9bba07..81af5bc 100644 --- a/Smashing-rocks-has-a-chance-to-contain-items.md +++ b/Smashing-rocks-has-a-chance-to-contain-items.md @@ -84,7 +84,7 @@ We have to define `RockItemEncounter`, and a suitable place to put it would be i For starters, `RockItemEncounter` will load the `.RockItems` table into `hl`, and then call `Random`, which will load a random byte (i.e., a value between 0 and 255) in `a`. With this random value generated, it performs comparisons against the probabilities encoded in the `.RockItems` table, picking an item with the listed odds (out of 256: in the example, there's a 2 percent [or 5 in 256] chance of getting a Max Revive, and a 25 percent [or 64 in 256] chance of getting a Brick Piece). For more info about how the `percent` symbol works, go to [macros/data.asm](https://github.com/pret/pokecrystal/blob/master/macros/data.asm). -Since the probabilities in the table add up to less than 256, the `db -1` line at the end indicates the end of the table. If this line is reached, the function will load a 0 (which represents `NO_ITEM`), indicating that the rocks didn't contain an item. If this is the case, the `iffalse .no_item` line in the script will skip giving an item to the player. Otherwise, the selected item, which will have already been loaded into the script variable (`wScriptVar`) by the function, will be awarded to the player by the script. +Since the probabilities in the table add up to less than 100 percent, the `db -1` line at the end indicates the end of the table. If this line is reached, the function will load a 0 (which represents `NO_ITEM`), indicating that the rocks didn't contain an item. If this is the case, the `iffalse .no_item` line in the script will skip giving an item to the player. Otherwise, the selected item, which will have already been loaded into the script variable (`wScriptVar`) by the function, will be awarded to the player by the script. And there you have it, the player can now find items within smashed rocks! You can add your own items and chances by editing the `.RockItems` table in `checkhiddenitems.asm`, or even add something more complex like the Fossils/Old Amber from RBY. -- cgit v1.2.3