Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2011-04-30 20:08:32

Miksy91
Member
Registered: 2010-10-16
Post 343/2,315

Removing "HM cannot be used" codes

I'd like to make my hack so that you won't need to have different flag bits (from table 2) being set to be able to use HM moves.
First I thought that, because in the scripts of gym leaders lots of different flag bits are set, some of them determine whether you've acquired the badge and some other bits probably define whether you can use a HM move or something...

However, all that information is actually stored in the commands of flag bit table 2 (other 33 commands actually make the trainers in that gym un-challengeable). For example when flag bit 1A00 from bittable 2 is set, information is saved to the ram that you have now badge from Falkner, the image of the badge is shown in the badges menu and HM Flash is made usable.

This is actually somewhat important because I've made the menu system look like this:

18042372.png

As you can see, the flag bits shouldn't be changed before you find the Orbs.
Besides, the Orbs may be taken away during the gameplay as well and when that happens, it wouldn't work fine either if you also lost the possibility of using HM moves.


Hope someone has some sort of idea how to accomplish doing this :D

Last edited by Miksy91 (2011-04-30 20:09:17)

Offline

#2 2011-04-30 20:41:00

Tauwasser
Member
Registered: 2010-10-16
Post 128/448

Re: Removing "HM cannot be used" codes

IIRC it's coded directly into the ASM item scripts, so you will have to go and disable it.

cYa,

Tauwasser

Offline

#3 2011-04-30 21:36:22

189/701

Re: Removing "HM cannot be used" codes

Tauwasser wrote:

IIRC it's coded directly into the ASM item scripts, so you will have to go and disable it.

Eh? You can teach any Pokémon an HM move at any time, but badges keep you from using the move in the overworld to move rocks and things.

I would start by looking for the pointer to the text that says “You need a badge to do that” or similar.

#4 2011-05-01 07:29:41

Miksy91
Member
Registered: 2010-10-16
Post 344/2,315

Re: Removing "HM cannot be used" codes

Okay, I happened to found the location where the pointer is to this text that's in offset 0x1920AD.
"Sorry! A new BADGE is required."

Bytes AD 60 64 are written in offset $C781.

Then some code follows, and for example pointer to this text "RAM (CF7E) used Cut!" is in offset $C808.
Anyways, my only problem right now is basically that I don't understand assembly well enough - I know what a few commands do but couldn't really follow the code at all.


EDIT:
Yeeeah!!!
I've done it.

I figured out (once again) a noobish way to circle the problem.
Instead of changing the code itself, you can see that the game checks whether a specific bit of Bittable 2 is set.
Well, I checked if I can make HM Flash work without having badge from Falkner by changing 1A 00 at offset 0xC8F0 into 04 00 (Pokegear) and it worked perfectly :D

Last edited by Miksy91 (2011-05-01 08:09:02)

Offline

#5 2011-05-01 08:54:33

Tauwasser
Member
Registered: 2010-10-16
Post 129/448

Re: Removing "HM cannot be used" codes

IIMarckus wrote:

Eh? You can teach any Pokémon an HM move at any time, but badges keep you from using the move in the overworld to move rocks and things.

Well, I meant if you use it like an item in the overworld... Key Items all check stuff like this in their asm scripts.

Miksy91 wrote:

Well, I checked if I can make HM Flash work without having badge from Falkner by changing 1A 00 at offset 0xC8F0 into 04 00 (Pokegear) and it worked perfectly :D

It's really not that hard to read.

ld de, $001A        //BitTable2 entry to check
ld a, $03            //call check routine
ld hl, $4776        //which also prints text
rst $8
jr c, @490F            //Bit is reset, go to 
ld a, [$D56E]        //Check if current time select
cp a, $FF            //is not cave (i.e. flash has been used before)
jr nz, @4909
call @4912            //call action
ld a, $81            //return 0x81 (success)
ret
@4909:
call $47BE            //Print text
ld a, $80            //Return 0x80 (no success)
ret
@490F:
ld a, $80            //return 0x80 (no success)
ret
@4912:
ld hl, @4918        //offset of ingame-script
jp $3423            //interpret it
@4918:
Ingame-Script

So if you just NOP the whole first part of this script, you will completely remove the check.

cYa,

Tauwasser

Offline

#6 2011-05-01 09:11:08

Miksy91
Member
Registered: 2010-10-16
Post 345/2,315

Re: Removing "HM cannot be used" codes

Most of it makes sense by using this KBM's Z80 help thread (I don't understand rst $8 though).
http://www.pokecommunity.com/showthread.php?t=220304

Besides, did you use some disassembler to show the code look like that (or wrote it here by hand) ?

Last edited by Miksy91 (2011-05-01 09:12:52)

Offline

#7 2011-05-01 10:25:14

Tauwasser
Member
Registered: 2010-10-16
Post 130/448

Re: Removing "HM cannot be used" codes

rst $8 is the command to run code at restart vector 1 at offset 0x08.

I use a disassembler a friend made a long time ago. Can't share it tho. BGB and No$GMB can dump asm as well, so it's not that much of a difference.

cYa,

Tauwasser

Last edited by Tauwasser (2011-05-01 10:25:40)

Offline

Board footer

Powered by FluxBB