Jump to content

How to increment/decrement masterball count in pokeball slot 1 in Pokemon HeartGold/SoulSilver - 0xD9 not working?


Recommended Posts

Posted

Hi, I would like some help on this issue. I would like to know if there is a way to increment or decrement an item count in Pokemon HeartGold/SoulSilver, specifically the masterball count in slot 1 of the pokeballs bag (though a generic option would be great :creep:). I know that you can set an specifc value for every item, but I don't want that. instead, read the current value of the item and increment or decrement it. I have this code:

94000130 FFF70000 [activates code when Start is pressed]

62111880 00000000 [don't really know the reason to use it - came with base code]

B2111880 00000000 [don't really know the reason to use it - came with base code]

D9000000 00000D14 [load 'stored' with 0x0D14 + offset - 'stored' should be XXXX0001 where XXXX is the hex value for masterball count]

D4000000 00010000 [add 0x010000 to 'stored' - 'stored' should be YYYY0001 where YYYY is XXXX + 1]

D6000000 00000D14 [write 'stored' to 0x0D14 + offset - should write YYYY0001 pointed address]

D2000000 00000000 [close conditional]

the code DO increment the masterball count but instead of doing it by 1, it increments the value by some random number each time the code is triggered.

the base code is

94000130 FCFF0000

62111880 00000000 (can anyone explain what is stored at 0x02111880?:S)

B2111880 00000000

00000D14 01ED0001

00000D18 00640002

D2000000 00000000

...

for [L+R] You get 493 Master Ball and 100 Ultra Ball then Hold L for Encounter found here (btw, how do I make the complete pokedex codes in that thread work?:rolleyes:)

I think code type 0xD9 is not working :confused: becuse if a value is set using 0xD5 and then stored with 0xD6 it changes the value as expected.

any help is appreciated. thank you. :biggrin:

Posted

Nothing is stored at the lines [62111880 00000000] [b2111880 00000000]. These lines are called Version Lines and they determine which game is being used.

Here is the correct code!

Wild Pokémon + Level Modifier:

Press L to Activate the Master/Ultra Balls

Press R to Activate the Wild Pokémon Encounter

94000130 FDFF0000

B2111880 00000000

00000D14 01ED0001

00000D18 00640002

D2000000 00000000

94000130 FEFF0000

B2111880 00000000

DA000000 00000D16

C0000000 00000027

D6000000 00025A68

D2000000 00000000

94000130 FEFF0000

B2111880 00000000

DA000000 00000D1A

C0000000 0000000B

D6000000 00025A5C

D2000000 00000000

Posted

thanks for the quick reply Riolu Aura Sphere Now.

the code works as a Wild Pokémon + Level Modifier but it's not what I'm looking for. the idea is to add the posiility to add/toss masterballs with a key press so you don't have to enter the bag and do it manually. say you want to catch Bulbasaur, Ivysaur, and Venusaur. instead of triggering the code again for every pokemon, you could leave one masterball, catch Bulbasaur, then press a key to increase the masterball count to 2 so you can catch Ivysaur, and once again for Venusaur. decreasing the ball count might also work.

then if [62111880 00000000] [b2111880 00000000], the code might look like this.

94000130 FFF70000

B2111880 00000000

D9000000 00000D14

D4000000 00010000

D6000000 00000D14

D2000000 00000000

the original code sets the masterball with

00000D14 01ED0001 [where 00000D14 is the address (ball pocket 1st slot), 01ED the ball count (493), and 0001 item (masterball)]

similarly,

00000D18 00640002 [where 00000D18 is the address (ball pocket 2st slot), 0064 the ball count (100), and 0002 item (ultraball)]

that's why I try to load the value in 0x0D14 to the 'stored' register, then sum 00010000 to add a masterball and save it back to 0x0D14, but for some reason the D9 intruction doesn't seem to work. if instead I set the value of 'stored' manually and then save it, it works but then I have a static value instead of adding/decreasing based on the current item count.

the code I provided do increment the item code, but instead of doing so by 1, it increments by some random number (4,10,...) each time the code is triggered. do you by any chance know how to solve this issue?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...