Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2011-10-02 08:05:36

Miksy91
Member
Registered: 2010-10-16
Post 546/2,339

Active Battle System

This is a small hack (with major effects) that changes the battle system to match with the one of pokemon anime.
So basically, you're only able to switch pokemon during the fight and not the same time your opponent does.

There are two versions of the hack, one works with both Gold and Silver and the other one with Crystal.
Downlaod here: http://www.mediafire.com/?3yp1j555wipj9pb

Last edited by Miksy91 (2011-10-02 08:09:14)

Offline

#2 2011-10-02 17:18:39

Chaos Rush
Member
Registered: 2010-10-16
Post 14/62

Re: Active Battle System

In other words, this hack has the same effect as going to the "OPTION" menu in-game, and selecting "SET" under "BATTLE STYLE"?

Offline

#3 2011-10-02 18:53:31

Miksy91
Member
Registered: 2010-10-16
Post 548/2,339

Re: Active Battle System

chaosrush wrote:

In other words, this hack has the same effect as going to the "OPTION" menu in-game, and selecting "SET" under "BATTLE STYLE"?

Wait...this can be done manually ? :o
I'll check this later if it really works that way. To tell you the truth, I'm not aware of what kind of things you can change under "option".

Offline

#4 2011-10-02 21:32:55

amvz08
Member
From: Philippines
Registered: 2011-06-27
Post 153/600

Re: Active Battle System

yes,if you set that to 'SET' you will use the first pokemon in your team and cannot shift to another pokemon,and if you set to 'SHIFT' of course,you can change your pokemon during battle


Trust me, I'm an Engineer

>>>Pinoy ka ba? Pasok ka dito<<<

Offline

#5 2011-10-03 10:08:37

Miksy91
Member
Registered: 2010-10-16
Post 549/2,339

Re: Active Battle System

amvz wrote:

yes,if you set that to 'SET' you will use the first pokemon in your team and cannot shift to another pokemon,and if you set to 'SHIFT' of course,you can change your pokemon during battle

This is different then, makes it impossible to switch pokemon after you beat a pokemon of the trainer you battle against (normally a yes/no box pops up but with this patch, it doesn't appear and the game thinks you chose no.

Offline

#6 2011-10-03 12:21:24

287/703

Re: Active Battle System

Miksy91 wrote:
amvz wrote:

yes,if you set that to 'SET' you will use the first pokemon in your team and cannot shift to another pokemon,and if you set to 'SHIFT' of course,you can change your pokemon during battle

This is different then, makes it impossible to switch pokemon after you beat a pokemon of the trainer you battle against (normally a yes/no box pops up but with this patch, it doesn't appear and the game thinks you chose no.

That matches the behavior of the Set option.

#7 2011-10-03 14:10:55

Miksy91
Member
Registered: 2010-10-16
Post 550/2,339

Re: Active Battle System

Yeah, you're right. I just tested that it truly works that way (and in the meantime noticed you can also disable battle animations if you like).
Anyway, I guess I remove this "feature" from my hack too then.

Offline

#8 2011-10-03 22:07:33

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 973/3,578

Re: Active Battle System

Well, even though it turned out you were re-inventing the wheel, my hat is still off to you for figuring out and working out a way to do it because you wanted to.

Offline

#9 2011-10-04 03:32:51

Miksy91
Member
Registered: 2010-10-16
Post 551/2,339

Re: Active Battle System

Mateo wrote:

Well, even though it turned out you were re-inventing the wheel, my hat is still off to you for figuring out and working out a way to do it because you wanted to.

Thanks although it's only about removing one call -command nearby a pointer that leads to the text that pops up when you're ableto change pokemon. :)

Offline

#10 2013-03-18 08:03:58

Miksy91
Member
Registered: 2010-10-16
Post 1,574/2,339

Re: Active Battle System

jwibagi wrote:

Are you planning to use this in your next Dark Energy release?

No. I don't see much of a point in this hack really. I just did it for trying out something new at the time.
Or now that I think about it, I might just include in this later in such form that it replaces the "SET" system which could be renamed as "ABS". And then describe in the game how it works so people could use it if they wanted to. That would be a good idea actually.

jwibagi wrote:

I think the increased difficulty makes this a likely base for my hack, but I want to see how it fares with the fans.
* I just noticed that you didn't offer this as a base ROM so I would want your permission if I am to ever use this.

I don't think everyone would like it being that way. You could go for offering two patch files if you aren't into assembly at that time yet.
But go ahead and use this patch if you want to, you don't even have to credit me for it but I of course appreciate it if you do.

Last edited by Miksy91 (2013-03-18 08:05:58)

Offline

#11 2013-10-10 17:16:25

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 111/450
Website

Re: Active Battle System

Do you still remember what you did there, Miksy? The party screen still pops up certain times (not always) after taking out a pokemon and lets you change the Pokemon. I think it is somehow related to the Pokemon you were used. As far as I have tested the window never pops up when I'm using the starter Pokemon, but it seems to do it if the Pokemon I am currently using is another Pokemon I have caught. I have no explanation for this as you can imagine. (Of course, this only happens if battle style is "shift").

(I have only tested the patch in Pokemon Crystal. Well to be honest what I did was comparing a patched Crystal ROM with an untouched one to find the differences, and then I removed the call at 0x3D75E and filled it up with 0x00, like you did).

EDIT: If the function called at 0x3D75E is only to make the yes/no window appear, then my guess is that maybe it doesn't always interpret it as a "NO".

Last edited by Crystal_ (2013-10-10 17:55:25)

Offline

#12 2013-10-10 19:42:00

Miksy91
Member
Registered: 2010-10-16
Post 1,926/2,339

Re: Active Battle System

I'm not certain what I did actually, but it could be that the only change was really nopping out a call command that calls the YES/NO box routine.
At the time when it's accessed, carry flag probably has the value of answer NO in it, and thus, you won't get to change your pokemon.

Offline

#13 2013-10-14 23:06:05

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 115/450
Website

Re: Active Battle System

So it took me a lot of time, but I have found another way to force battle style =SET (sorry Miksy, but what you did there for some reason isn't working properly for me!).

Found out in the dissasembly of Pokemon Crystal that the flag that determines whether battle style is set or shift is the 6th bit of address 0xCFCC (wram). If battle style is SET, the bit is put to 1 while if battle style is SHIFT the bit is put to 0. There is a routine in bank 39 that sets or clears the flag according to the battle style option selected. To force battle style = SET, we'd have to edit byte at 0xe43be to 0xF6 so that the bit is put to 1 when battle style is put to SHIFT (it's already put to 1 when battle style is put to SET).

Obviously, we'd have to edit the text at 0xe43d1 so that it shows "SET" insetad of "SHIFT" in the options menu (meaning the battle style option will always show "SET".

The problem is that, the default option is SHIFT (in other words, the bit is clear by default) so the game will not behave as battle style = SET until the player enters the options menu. So if someone can come up with an easy way around this, I'd really appreciate it because this is something I really want to implement in my hack! So yeah...

Last edited by Crystal_ (2013-10-14 23:15:31)

Offline

#14 2013-10-15 06:55:33

Miksy91
Member
Registered: 2010-10-16
Post 1,927/2,339

Re: Active Battle System

So what you do want to accomplish exactly? Force battle style "SET" so that "SHIFT = SET" and "SET = SET" ?
All you gotta do is to edit the routine that uses either one of those battle styles during battles.

In case you're looking for something else, I have hacked "SET" routine in Dark Energy to work in another way, "Active". Here are some rough notes I wrote down about the process:

Bit 6 (40) in D199
-If 0 --> SHIFT
-If 1 --> SET

F:539F
-Is interpreted every time the opponent sends out another pokemon to the field
-When the routine begins, carry flag is already set if battle mode is SHIFT. If battle mode is SET, carry flag is reset.


Following changes;

Original routine at 0F:5610:
ld hl, 5490 (text pointer, associated with call 3CD6 to load text data from 40:5490)
ld bc, 0004 (Location of YES/NO box)
call 1C44 (YES/NO option)


New routine at 0F:5610:
ld hl, 5490 ---> jp 7F01

0F:7F01
ld a, D199
bit 6,a
jr nz, @set // if "SET" mode is on
ld hl, 5490 // text. string (SHIFT)
jp 5613 // return to the main routine

@set
ld hl, 6235 // [Trainer] is about to use another POKE + [wait for key press arrow]
call 3CD6 ; print text data pointed with hl
jp 5655

In other words, SHIFT routine still works like it does in the original game, but there is my built-in check that checks if SET/Active battle mode is on. If it is, we print text data "[Trainer] is about to use another POKE + [wait for key press arrow]" and jump forward in the main routine to a point where "pokemon switching" has already taken place.


If you want, you can build your own "force SET mode" in a similar way in the game if you like.

Last edited by Miksy91 (2013-10-15 07:03:00)

Offline

#15 2013-10-15 10:27:30

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 116/450
Website

Re: Active Battle System

So what you do want to accomplish exactly? Force battle style "SET" so that "SHIFT = SET" and "SET = SET" ?

Exactly. The thing is that I didn't want to get into battle routines because I find it desesperating to find out anything about them from scratch.

So, instead, I followed the part where the sixth bit of 0xCFCC is set/clear (after your post, I suppose the ram address for GS is D199 instead) and ended up in the routine that sets the bit (adds 0x40 to the byte) when battle style is put to SET (from the options menu), and clears the bit when battle style is put to SHIFT. And then, I edited the routine so that the bit is set both when battle style is put to SET and put to SHIFT, and finally I followed the RAM memory to verify that it was working well (to verify that the bit was never cleared).

The thing is that, the bit remains clear until the options menu is opened (and when it's opened battle style beomes SET no matter what the player does). So it would require the player to open the options menu at least once before the battle style works as it's supposed to do.

Anyway, when I'm back home I'm going to look at F:539F (or wherever the routine is in pkmn crystal) to see if I can find something out but I think I've been already through it and had no success...

Last edited by Crystal_ (2013-10-15 10:28:14)

Offline

#16 2013-10-15 17:02:32

Miksy91
Member
Registered: 2010-10-16
Post 1,928/2,339

Re: Active Battle System

Crystal_ wrote:

Anyway, when I'm back home I'm going to look at F:539F (or wherever the routine is in pkmn crystal) to see if I can find something out but I think I've been already through it and had no success...

The routines might match up totally in both Silver and Crystal although all the addresses are different.
You could look for the routine easily by just looking for something such as 21 _ _ 01 04 00 CD _ _ ... with a hex editor (see how the routine continues in Silver before doing that though!). At least GoldFinger gives you an option for not looking for certain bytes in the middle of the "word".

Notice that you can pick up the two values that follow "21" easily since they're a 2-byte text pointer to text string "[Trainer] is about to use..."

Last edited by Miksy91 (2013-10-15 17:06:40)

Offline

#17 2013-10-15 18:15:14

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 117/450
Website

Re: Active Battle System

Many thanks Miksy!

What I did was searching in bank F for the address 0xCFCC (cc cf) with a hex editor and the only result I got was into a routine that had a byte 0x37 (set carry) right before the return, so it looked very suspicius. I changed it to 0x38 so that it resets the carry flag instead and thus treats battle style as SET. It seems that I did the right edit as far as I have tested but you can't never be too sure with these things lol.

Anyway, wanna thank you again for the countless times you have already helped me. It's great!

EDIT: Actually, found out that 0x38 doesn't reset anything lol. Anyway just nopped the byte and seems to work well.

Last edited by Crystal_ (2013-10-15 18:23:01)

Offline

#18 2013-10-15 18:28:54

Miksy91
Member
Registered: 2010-10-16
Post 1,929/2,339

Re: Active Battle System

Ouch... that won't work at all actually. I believe what you did was to modify the "scf" instruction at 0F:5747. "and a, a" is an instruction that is used for reseting the carry flag. If that's what you want to do, try changing that to byte A7 instead (since that's the byte form of instruction "and a, a").

However, I wouldn't say that's going to give the right result either, although I may be wrong. When I made that battle mode asm hack in dark energy, I remember playing around with this routine before and trying to simply change those "and a, a" and "scf" instructions but it didn't work the way I assumed it to.
I can't recall what went wrong (I did some debugging to find out though), but in my case, simple one byte edits didn't do, and so, I had to find a place to write my own routine (which I posted above) for the required changes.

So yeah, try replacing 37 with A7 in 0F:5747. That might do.

P.S
In case you're wondering what instruction 38 does, it's simply "jr c" instruction.

Last edited by Miksy91 (2013-10-15 18:30:39)

Offline

#19 2013-10-15 19:28:02

Esphere
Member
Registered: 2012-05-21
Post 12/12

Re: Active Battle System

Okay i dont like to "necro", but ABS is muuch more special than "SET" mode.

Why? Two factors.

First: It doesnt say which is the next pokemon the trainer is about to send, so it has the thrill of : If i dont switch i might be doomed.
Second: Even if it doesnt mention it, SOMETIMES it prompts to a switch. When? I'm not sure, but i'm sure i've been able to get the switch prompt on some cases.

- X Is About to send a pokemon
- [Switch/No]


Y U NO LOOK AT ME?

Offline

#20 2013-10-15 19:37:07

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 118/450
Website

Re: Active Battle System

I see... Then it's weird that I got the desired result changing the byte to 0x00 because I actually checked that with the 0x37 instead, the game asked to change pokemon. Anyway, the byte at 0F:5747 is the only byte with a 0x37 in the whole routine. Wouldn't that mean that, if the carry flag is set, it can only be because the game went through the instruction at 0F:5747? That's what I thought when I changed to 0x00; if I nopped the only "set carry flag" instruction, the routine will never set the carry flag.

Regardless, changing it to 0xA7 works too. Indeed, right after the return at 0F:5748 there are two bytes that are exactly A7 C9 too. With your change, it will look A7 C9 A7 C9. I suppose the last A7 C9 is where the game goes if battle style is set, while the game goes to 37 C9 (now turned A7 C9 after your change) if battle style is shift. So it makes total sense to me, and of course, as usual you know what you are talking about while myself I never quite know what I'm really doing :P

Offline

#21 2013-10-16 06:44:21

Miksy91
Member
Registered: 2010-10-16
Post 1,930/2,339

Re: Active Battle System

Esphere wrote:

Okay i dont like to "necro", but ABS is muuch more special than "SET" mode.

Why? Two factors.

First: It doesnt say which is the next pokemon the trainer is about to send, so it has the thrill of : If i dont switch i might be doomed.
Second: Even if it doesnt mention it, SOMETIMES it prompts to a switch. When? I'm not sure, but i'm sure i've been able to get the switch prompt on some cases.

- X Is About to send a pokemon
- [Switch/No]

Well I never intended to give a possibility for the player to switch though! :D (but then again, I wasn't smart enough at the time to do anything but try out if "this" works) But cool to hear you like it.

Crystal_ wrote:

I see... Then it's weird that I got the desired result changing the byte to 0x00 because I actually checked that with the 0x37 instead, the game asked to change pokemon. Anyway, the byte at 0F:5747 is the only byte with a 0x37 in the whole routine. Wouldn't that mean that, if the carry flag is set, it can only be because the game went through the instruction at 0F:5747? That's what I thought when I changed to 0x00; if I nopped the only "set carry flag" instruction, the routine will never set the carry flag.

Carry flag is a bit in flag register, F. So, it can have either value of 0 ("reset") or 1 ("set).

There are plenty of asm instructions that modify the value of carry flag. But for example "ret" instructions doesn't affect the carry flag (which is a good thing). Thus, when we want to use the carry flag as a "comparing value" after the main routine ends, with ret instruction, we tend to set or reset the carry flag then. This is because then we can ensure that carry flag indeed has the value that we want it to have.
So if you just wrote "nop" in the place of original "scf" instruction, you can only ensure that carry flag has the same value as it did before when the routine ends. And you might as well replace that "scf" with "ret" in that case as well... But... if you want to ensure that carry flag is indeed reset after the routine ends, you should use an instruction for reseting it. What I mean here is that carry flag can already be set when that scf instruction is executed!

Good ways of modifying the carry flag

scf = Set carry flag (by writing "1" to carry flag)

scf + ccf = Sets carry flag and complements it. = carry flag is reset

and a,a = resets carry flag (by writing "0" to it) and doesn't change the value of a (so "scf + ccf" as one instruction actually)
Crystal_ wrote:

With your change, it will look A7 C9 A7 C9. I suppose the last A7 C9 is where the game goes if battle style is set, while the game goes to 37 C9 (now turned A7 C9 after your change) if battle style is shift.

That's possible, or even likely. But you can never be too sure unless you have taken everything in account (and this case, we hardly have though it feels like it does work).

Crystal_ wrote:

So it makes total sense to me, and of course, as usual you know what you are talking about while myself I never quite know what I'm really doing :P

Thanks. You'll get there, it takes a little bit of programming practice.
(And what comes to it, don't follow asm routines with a hex editor. Get yourself an asm editor at romhacking.net, use BGB's debugger or even both.)

Last edited by Miksy91 (2013-10-16 06:46:45)

Offline

#22 2013-10-16 09:32:26

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 119/450
Website

Re: Active Battle System

Second: Even if it doesnt mention it, SOMETIMES it prompts to a switch. When? I'm not sure, but i'm sure i've been able to get the switch prompt on some cases.

Yeah, that's what I pointed out before. Glad to hear it doesn't just happen to me, haha.

So if you just wrote "nop" in the place of original "scf" instruction, you can only ensure that carry flag has the same value as it did before when the routine ends.

Yep, that's the part that I missed. Didn't account for the fact that the carry flag could already have a value before.

That's possible, or even likely. But you can never be too sure unless you have taken everything in account (and this case, we hardly have though it feels like it does work).

I'm going to continue making and testing the hack with the ->0xA7 change applied. So if at any point I experience any bug related to battling, I'd know where to go. But for now, it feels like it's working.

(And what comes to it, don't follow asm routines with a hex editor. Get yourself an asm editor at romhacking.net, use BGB's debugger or even both.)

I have used bgb already a few times (and I must say it's the reason I managed to find the routine that sets/resets the 6th bit of byte 0xCFCC). For the few times I've been with asm stuff recently, I usually have a document with the Z80 opcodes and mnemonics handy to "work" (doubt you can call "work" the few things I have done/attempted to do though!) in a hex editor, but I agree it'd be much easier with a asm editor. Thanks for your advice!

Last edited by Crystal_ (2013-10-16 09:35:57)

Offline

#23 2013-10-16 19:30:26

Miksy91
Member
Registered: 2010-10-16
Post 1,931/2,339

Re: Active Battle System

Crystal_ wrote:

I usually have a document with the Z80 opcodes and mnemonics handy to "work" (doubt you can call "work" the few things I have done/attempted to do though!) in a hex editor, but I agree it'd be much easier with a asm editor. Thanks for your advice!

No problem! And yeah, real "CPU language" programmers never use hexadecimal/binary opcodes either. Everything is done in symbolic language which is afterwards compiled into CPU hex code with assemblers.

Offline

#24 2013-11-05 08:55:44

Sergio
Member
Registered: 2013-11-04
Post 6/24

Offline

Board footer

Powered by FluxBB