mirror of https://github.com/pret/pokeemerald.git
Updated Prompt for reusing Repels (markdown)
parent
03f2d0f2b4
commit
ac1ecfb579
|
@ -134,7 +134,7 @@ Since we walked through it above, let's do the same here. Remember, this functio
|
|||
|
||||
First we make an array with all the repel item IDs and declare an increment variable `i`. Next, we loop through the repels one by one and check if they exist in the bag - note that since `ITEM_REPEL` is listed first (in the 0th array index), it will look for this first in the loop. If none are found (`VAR_RESULT` still shows as `FALSE`) it'll look for super repels, then finally max repels. In this way all the smaller items are used first and the player's bag can clear them out. Finally, if no other repels are found, we want to stop the loop at `i > 2` and `return` to the script empty-handed, which is better than spiralling away to infinity in misery.
|
||||
|
||||
NOTE: If you want to just grab the smallest repel type after the first one gets depleted (rather than waiting for all repels of its kind to run out), just change the `while` to a `For (i = 0, i = 3, i++)` loop and get rid of the `if (i > 2)` stopper.
|
||||
NOTE: If you want to just grab the smallest repel type after the first one gets depleted (rather than waiting for all repels of its kind to run out), just change the `while` to a `For (i = 0, i = 3, i++)` loop, add a `Return;` to the 'if TRUE' statement, and get rid of the `if (i > 2)` stopper.
|
||||
|
||||
Sweet! Now, throw in a `callnative` in the assembly script and we're there. Over in [data/scripts/repel.inc](../blob/master/data/scripts/repel.inc):
|
||||
```diff
|
||||
|
|
Loading…
Reference in New Issue