![]() |
Set Disobedience
For a while I was hoping to figure out a way to make a Pokemon disobedient, a sort of reverse of the setobedience command. I tried experimenting with Mew to see if there was anything in his code that would make him disobedient, but couldn't find anything, and I'm looking for more of the trade disobedience (occasionally sleeping, using other attacks, etc.).
Can anyone tell me if there was a way to create a custom ASM routine to set a specific Pokemon in your party as disobedient? Could you find the setobedience command and just change a few things, and create your own routine for setting a Pokemon to disobedient no matter what its level and what badges you've obtained? Any insight would be appreciated. I know I don't understand much about ASM, but I'm willing to do whatever possible to get this in, and I'm hoping it won't be too difficult, considering there's a command already in the game that does almost the same thing, but the opposite. And now a solution to this problem. This code was made by colcolstyles, all credit goes to him: Quote:
Here's another code you can apply. This one was designed by JPAN, all credit to him. This is a code causes certain Pokemon to be disobedient, but instead of being completely disobedient, they are also occasionally obedient. It actually gives you some incentive to train a disobedient Pokemon, which can add to the depth of the game. Code:
All credit to this one goest to Jambo51: Code:
Special thanks to thank colcolstyles, Jambo51, and JPAN for working on this for me! Thanks! :) So here's the routine: First place 00 49 08 47 at 0x0801D3F4, and the reversed pointer to the code below at 0x0801D3F8 (per JPAN's routine). Code:
|
Might I ask as to what game you are hacking?
|
Quote:
|
I can be bothered writing a routine... but... 0x02024284 contains Party Pokemon data. I'm 90% sure the Sanity byte controls the obedience...
http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_data_structure_in_Generation_III I'm not on a computer with anything on it right now, so I can't do anything... |
Quote:
|
Try this tutorial I found: http://sfc.pokefans.net/lesson.php?id=14
I'm not sure if that's exactly what you're looking for, but it seems to be related to the issue. |
Well, I know this isn't right, because it didn't work, and I'm still an ASM-newb, but my thinking was that you would load the "sanity byte" of, say, the first Pokemon in your party, and either subtract 1 or add 1 to it. I kind of figured the sanity byte would start at 0x0 or 0x1 and need to have a byte removed or added to make the Pokemon disobey. So I tried a very basic routine, going off of HackMew's Secret ID example in his tutorial:
Code:
Code:
I know it's not correct, but any advice on where to go from this, or if I should be going in a completely different direction. I might have to do something a lot more complicated that I'm not capable of yet ... |
The data at '0x02024284' is not a pointer. Because of this, the "ldr r0, [r0]" on the third line of each routine is unnecessary. It was needed in the Secret ID case because the trainer's data is moved around in-game and so in order to find it, you needed to load the pointer at an address and then subsequently load the data at that second pointer. It's kind of confusing and difficult to explain but if you remove the line that I told you to, you should hopefully have a little more success.
|
Pro tip: Before you start making a routine, you need to observe the data.
|
Quote:
Quote:
EDIT: According to this: http://bulbapedia.bulbagarden.net/wiki/User:Kyoufu_Kawa#Font_and_Sanity The sanity byte has to do with whether the Pokemon is an egg or not. Quote:
So does this mean that the sanity byte doesn't control obedience? EDIT 2: I was trying out the debugger thing and I thought of something. Since you can view what's going on with custom routines, if I had the offset for the setobedience routine that's in the game, could I theoretically view that and see what it's dealing with? If I could see that, then I could use the same things for my custom routine, right? So if that's the case, how could I go about figuring out what the offset for the setobedience command is? |
As you said yourself, the fact that your Pokémon obeys you is related to it's level and the number of badges you have. So, one could say that, before you attack, the game does a little calculation which takes the highest 'badge-flag' and the Pokémon level into account.
What one should do is find the routine that checks if the Pokémon obeys or not and eventually add another check. For example: One could use an unused bit in the Pokémon data and use this as a flag. |
Quote:
|
Quote:
Quote:
Anyway, how I would try to find this routine you need to expand is, well.. The game displays a message when the Pokémon isn't willing to obey you, right? I would try to find out when that message is loaded and like so work my way back and find the actual routine that does the 'check'. Also, if indeed the "Sanity Byte's" pattern repeats after 7, you could easily use a bit from that byte for the new 'flag'. At least I think you could. |
Quote:
EDIT: The following messages should be located at these offsets: (Pokemon) ignored orders while asleep! - 0x3FD0F1 - The pointer to this message is at 0x3FE358 (Pokemon) ignored orders! - 0x3FD111 - The pointer to this message is at 0x3FE35C (Pokemon) pretended not to notice! - 0x3FD16A - The pointer to this message is at 0x3FE370 That's the end of the pointers. Not sure what I could do from here. |
Oh wow. When I looked at your routines earlier, I just skimmed over them real briefly and then pointed out the first error that I saw. There are a bunch more too.
First of all, the first routine does absolutely nothing. It loads a byte from some address, subtracts one from it... and then restores the previous condition without changing anything. As for the second routine, if all you're trying to do is store '0x01' at '0x02024284', then all you need is the following (excluding push and pop): Code:
Also, it was my understanding that a Pokémon was deemed an egg by setting one of the top two bits in the IV word. I could be mistaken, though. |
Quote:
But no, I'm not storing 0x0 at that offset. That's only the beginning of the offset for the first Pokemon's data. I need to store it where the sanity byte is, which is (if I'm understanding correctly) 19 bytes (13 in hex) after that, which is why I had "ldrb r0, [r0, #0x13]" there. |
|
|
One step ahead of you. :)
Well I've been slowly making my way through the assembly code for the 'setobedience' command and though I haven't figured it out yet, I've been following some values through the system and it looks like the game is trying to access the "Data" substructure of my Squirtle's data. I'll update this post once I figure out which block gets accessed and, from there, what piece of data exactly gets modified. |
Quote:
|
Sorry for the delay. The game uses a very long and inefficient way to perform the modulo operation and it does it about 6 times before it actually starts to edit anything. D:
Well from what I can tell, the game is editing the last byte of the Growth substructure. There is no documentation on that piece of data which means that is possible that it controls obedience. The guy who wrote that article seems to think that it's a halfword (16-bit) but the game reads from it using ldrb so I'm guessing that it is actually two bytes. The 'setobedience' command takes whatever value is stored there, 'and's it with '0x7F' (i.e., clears the most significant bit), 'orr's that with some other value (it was '0x80' for me) and then stores the final result back in the Growth substructure. I'll look more into it later but right now I have to go run a few errands. If anyone's interested, the routine that does what I mentioned above is located at '0x08040A82'. |
Quote:
Oh, and I thought that ldrb was for reading one byte, and that two bytes = 16 bits. So if the game uses ldrb, it's only loading one byte? |
Quote:
I'm going to go do a little more research on that byte. Perhaps by looking at Mew's data (who I've heard is disobedient unless obtained legally or something like that) I can figure out if there's a certain value which makes a pokémon disobedient. edit: At '0x0801D402' the game checks if the player's pokémon is Mew. I expanded the routine to add a check for Squirtle (which was the only other pokémon I had in my party at the time). And look what I got: Spoiler:
In an unedited ROM, all pokémon except Mew will always obey the player unless they don't have enough badges (but I didn't look up those routines). If the player is using a Mew, it checks the top bit of the last byte in the Growth Structure. If it is set, then Mew will obey. If not, then Mew won't obey. By default, all pokémon don't have that bit set but because it isn't checked, it doesn't matter. However, in order to get Mew to obey, you need to use the 'setobedience' command to set that bit, unless you want to do the work of decrypting the Pokémon data and then recalculating the checksum. Once you use 'setobedience', Mew/Squirtle will start to obey again: Spoiler:
Because I'm a nice guy, here's the code: Code:
Code:
|
Perhaps researching what makes herbs/roots make your pokemon happiness go down may help? or maybe gym badges (pokemon up to lvl 30 can obey you)
hope it helps. |
Quote:
Thank you very much. I really do appreciate it. I'm gonna test it out and then post the code with credit in the first post of the thread. :) EDIT: Might I ask something? In your post you said that 0x0801D415 goes on to check the obedience byte? What I'd really like to do is have a code to change an individual Pokemon obedience byte. So presumably an obedient byte does exist then? While having the Mew type of disobedience would work, I'd prefer it to be more like the traded-overtrained disobedience, where the Pokemon falls asleep, and refused to attack. With the Mew disobedience, Mew simply doesn't do anything, I believe. Maybe if I do checkobedience and use 0x0801D415 as a breakpoint I could figure it out? Oh, and I'm dumb, so I don't know how to insert the first code into the game properly. Do I copy the code to a specific offset once it's assembled? Or maybe there's a way to assemble it I don't know, since there's a command to tell it where to put it in the code itself. Right now, all I really know is the "thumb" command to create the hex script to be inserted ... EDIT2: Never mind - got it to work. Had to copy the code 0x1d415. And as HackMew said in the post after this one, only Mew and Deoxys do the complete disobedience thing. I just tried it with Charizard and it worked perfectly. The last thing I'd like to know is I can undo the setobedience command? See, I kind of want to make Charizard obedient for a bit, then make it disobedient again, then make it obedient once more later. Possible? |
| All times are GMT -8. The time now is 8:59 AM. |
![]()
© 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.
Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.