Jump to content

User:CytricAcid/Beginner's Guide To ACE/US Red and Blue Guide: Difference between revisions

→‎3. Setting up our first code: Added the other codes.
(→‎3. Setting up our first code: Changed Full Heal ×2 to Full Heal ×3 to avoid potentially unsafe filler code.)
(→‎3. Setting up our first code: Added the other codes.)
Line 182:
The final step is to spell out the arbitrary code you want to execute with items in your inventory. We will start with some simple codes both to verify that your party setup is correct, and to take full control of your inventory (i.e. get any item in any quantity) in order to facilitate making more complicated codes.
 
=== Get any item quantity ===
Arrange your items as follows, starting from the first item in your inventory:
* 8F<ref group="note">Technically, 8F can be in any slot of your inventory, but this slot is the most convenient.</ref>
Line 209 ⟶ 210:
 
After making sure everything is set up correctly, use 8F. The quantity of the second item should have increased by 1, even going over 99 (which eliminates the need to use MissingNo. to duplicate items in the future).
 
There is a slightly different variant of this code that you may find more convenient (depending on the quantities you need and/or your willingness to do some math): Replace Full Heal ×3 with Revive ×3, which will cause 8F to decrease the quantity of the second item by 1 instead of increasing it. At first glance this may not seem that useful, but the point is that this can decrease the quantity from 1 to 0 without deleting the item stack. As mentioned earlier, a ×0 item stack is equivalent to ×256, so you can then get any quantity ''n'' you want by tossing 256-''n'' from the item stack.
 
=== Get any item ===
Arrange your items as follows, starting from the first item in your inventory:
* 8F
* (Any unimportant item)
* Lemonade ×(the ID of the item you want)
* X Accuracy ×32
* Water Stone ×3
* TM01 ×(any)
You can find out the ID of any item from [[The Big HEX List]].
{{Explanation|title=ASM translation|contents=
Again, initially <code>hl</code> = $D322.
{{{!}} class="wikitable"
! Item slot !! Item stack !! Hex !! ASM !! Comments
{{!}}-
{{!}} 3rd {{!}}{{!}} Lemonade<br />×<ID> {{!}}{{!}} 3E<br /><ID> {{!}}{{!}} '''ld a, <ID>''' {{!}}{{!}} Loads <ID> into the register a
{{!}}-
{{!}} 4th {{!}}{{!}} X Accuracy<br />×32 {{!}}{{!}} 2E<br />20 {{!}}{{!}} '''ld l, 0x20''' {{!}}{{!}} hl = $D320 (the kind of the second item)
{{!}}-
{{!}} rowspan=2 {{!}} 5th {{!}}{{!}} rowspan=2 {{!}} Water Stone<br />×3 {{!}}{{!}} 22 {{!}}{{!}} '''ld [hli], a''' {{!}}{{!}} Sets the value at $D320 to <ID>
{{!}}-
{{!}} 03 {{!}}{{!}} inc bc {{!}}{{!}} Filler
{{!}}-
{{!}} 6th {{!}}{{!}} TM01 {{!}}{{!}} C9 {{!}}{{!}} '''ret''' {{!}}{{!}} Returns control to the calling routine
{{!}}}
* Again, the "×3" in "Water Stone ×3" is a filler that can be replaced by anything that don't actively mess up the rest of the code (in particular, ×2 may work with some setups).
}}
 
After making sure everything is set up correctly, use 8F. The second item should become the item you want.
 
=== More codes ===
At this point, you should have full control over your inventory, which would make it easy to spell out any future codes. See [[Generation I item codes]] for some examples of what you could do with ACE.
 
== Notes ==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.