The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
Research & Development programs in this forum are subject to moderator approval before they are displayed.


Advertise here

Reply
 
Thread Tools
  #1    
Old February 4th, 2010, 02:10 PM
pokemonforever27's Avatar
pokemonforever27
IS RIDING LUGIA...
 
Join Date: Jul 2008
Location: At the computer...
Age: 23
Gender: Male
Nature: Calm

Advertise here
Something that is becoming more popular to do in a hack is TRAINER BATTLEs whose POKEMON are at the same level of the players highest. JPAN, Hackmew, and myself have done some extensive research into the ASM aspect, but I only recently figured out that it was in fact possible without ASM. This tutorial will show you how to check which POKEMON is at the highest level without having to insert or deal with ASM. It stores the level of the highest POKEMON in LASTRESULT.

First, the code:
Code:
'---------------
#org 0xpointer1
lockall
copybyte 0x20370D0 0x20242D8
comparefarbytes 0x20370D0 0x202433C
if 0x0 goto 0xpointer2
comparefarbytes 0x20370D0 0x20243A0
if 0x0 goto 0xpointer3
comparefarbytes 0x20370D0 0x2024404
if 0x0 goto 0xpointer4
comparefarbytes 0x20370D0 0x2024468
if 0x0 goto 0xpointer5
comparefarbytes 0x20370D0 0x20244CC
if 0x0 goto 0xpointer6
releaseall
end
 
'---------------
#org 0xpointer2
copybyte 0x20370D0 0x202433C
comparefarbytes 0x20370D0 0x20243A0
if 0x0 goto 0xpointer3
comparefarbytes 0x20370D0 0x2024404
if 0x0 goto 0xpointer4
comparefarbytes 0x20370D0 0x2024468
if 0x0 goto 0xpointer5
comparefarbytes 0x20370D0 0x20244CC
if 0x0 goto 0xpointer6
releaseall
end
 
'---------------
#org 0xpointer3
copybyte 0x20370D0 0x20243A0
comparefarbytes 0x20370D0 0x2024404
if 0x0 goto 0xpointer4
comparefarbytes 0x20370D0 0x2024468
if 0x0 goto 0xpointer5
comparefarbytes 0x20370D0 0x20244CC
if 0x0 goto 0xpointer6
releaseall
end
 
'---------------
#org 0xpointer4
copybyte 0x20370D0 0x2024404
comparefarbytes 0x20370D0 0x2024468
if 0x0 goto 0xpointer5
comparefarbytes 0x20370D0 0x20244CC
if 0x0 goto 0xpointer6
releaseall
end
 
'---------------
#org 0xpointer5
copybyte 0x20370D0 0x2024468
comparefarbytes 0x20370D0 0x20244CC
if 0x0 goto 0xpointer6
releaseall
end
 
'---------------
#org 0xpointer6
copybyte 0x20370D0 0x20244CC
releaseall
end
Second, the walk through:
"copybyte 0x20370D0 0x20242D8" this line copies the byte at the memory address of the level of the first POKEMON into the memory address of LASTRESULT. For this routine to work, we'll assume that the first POKEMON is highest, and we'll always copy the highest level POKEMON into LASTRESULT.

"comparefarbytes 0x20370D0 0x202433C
if 0x0 goto 0xpointer2
comparefarbytes 0x20370D0 0x20243A0
if 0x0 goto 0xpointer3
comparefarbytes 0x20370D0 0x2024404
if 0x0 goto 0xpointer4
comparefarbytes 0x20370D0 0x2024468
if 0x0 goto 0xpointer5
comparefarbytes 0x20370D0 0x20244CC
if 0x0 goto 0xpointer6"
These commands compare the bytes at the memory locations of the other POKEMON to LASTRESULT. If any of them are higher, we skip to an offset (0xpointer1, 0xpointer2, etc)

The copybyte command at the beginning of each offset copies the new highest level into LASTRESULT. The rest of their code then checks the remaining levels.

This routine checks all possible combinations. It doesn't matter what order the POKEMON are in.

Before you use the code, you'll need to put offsets in where I've written pointer1, pointer2, etc. I removed the pointers since it will be different for each hack.

This is a FIRERED VERSION. To use it in EMERALD, RUBY, SAPPHIRE, or LEAFGREEN, change the memory address values (the values after comparefarbytes and copybyte) to the memory addresses for your game.

Special Thanks:
JPAN for helping me on the ASM side
Hackmew for helping me on the ASM side
Attached Files
File Type: txt CheckLevel Without ASM.txt‎ (1.4 KB, 54 views) (Save to Dropbox)
__________________
TUTORIALS (ROM HACKING):

GAMES:

"We tend to move towards and act like that which we picture in our minds" (Henry David Thoreau)
Reply With Quote
  #2    
Old February 15th, 2010, 01:52 PM
Luster's Avatar
Luster
Form changing script (HINT)
 
Join Date: Feb 2010
Location: In a skip behind Lidl.
Gender: Male
Nature: Rash
can I do this with stats, nature etc and write them to another pokemon?
__________________
Can't post my website URL everywhere anymore
Thanks to HackMew and JPAN for ASM tutorials!

>>>I SUPPORT<<<
Spoiler:








>>>DESPARATE HELP NEEDED<<<

Spoiler:
IF ANYONE HAS THE OFFSETS FOR WHERE POKEMON STATS ARE STORED, PLEASE LET ME KNOW. ANY HELP IS GOOD, AND YOU WILL BE WELL REWARDED. THANKS.
Reply With Quote
  #3    
Old February 15th, 2010, 03:05 PM
NarutoActor's Avatar
NarutoActor
The rocks cry out to me
Community Supporter
 
Join Date: Jan 2009
Location: Brooklyn/Marlboro
Age: 20
Gender: Female
Nature: Bashful
Send a message via AIM to NarutoActor Send a message via Windows Live Messenger to NarutoActor
will if your trying to find a way without asm try some wrightbytetooffset command
__________________
~There are those people who understand hex, F the rest
Reply With Quote
  #4    
Old February 15th, 2010, 03:28 PM
HackMew's Avatar
HackMew
Mewtwo Strikes Back
 
Join Date: Jun 2006
Well, I got asked already, and it is indeed possible with plain scripting. The question is: is it worth it, though?
Think about it. Instead of a simple callasm, you have to a lot of compares, and you even use more bytes.
__________________
Reply With Quote
  #5    
Old February 15th, 2010, 05:47 PM
NarutoActor's Avatar
NarutoActor
The rocks cry out to me
Community Supporter
 
Join Date: Jan 2009
Location: Brooklyn/Marlboro
Age: 20
Gender: Female
Nature: Bashful
Send a message via AIM to NarutoActor Send a message via Windows Live Messenger to NarutoActor
I agree If someone already made the asm routine then that's what I go with, but if there is none then I would take the scripting method, due to my lack of asm knowledge.
__________________
~There are those people who understand hex, F the rest
Reply With Quote
  #6    
Old February 16th, 2010, 10:46 AM
pokemonforever27's Avatar
pokemonforever27
IS RIDING LUGIA...
 
Join Date: Jul 2008
Location: At the computer...
Age: 23
Gender: Male
Nature: Calm
Quote:
The question is: is it worth it, though?
Think about it. Instead of a simple callasm, you have to a lot of compares, and you even use more bytes.
It is true that this code uses more space than the ASM, but not everyone knows ASM, wants to learn it, and wants to deal with inserting it and compiling it. Thus, I made this so that you don't have to know ASM. And let's face it, GAME FREAK coded it this way (although their's was more complex because it needed to set up a custom battle as well).

Quote:
can I do this with stats, nature etc and write them to another pokemon?
The stats yes, nature, no. The nature, attacks, pp, etc is encoded in a way that requires ASM to decode. This article should help explain what I'm talking about.
__________________
TUTORIALS (ROM HACKING):

GAMES:

"We tend to move towards and act like that which we picture in our minds" (Henry David Thoreau)
Reply With Quote
  #7    
Old February 23rd, 2010, 07:32 AM
Luster's Avatar
Luster
Form changing script (HINT)
 
Join Date: Feb 2010
Location: In a skip behind Lidl.
Gender: Male
Nature: Rash
Quote:
Originally Posted by pokemonforever27 View Post
It is true that this code uses more space than the ASM, but not everyone knows ASM, wants to learn it, and wants to deal with inserting it and compiling it. Thus, I made this so that you don't have to know ASM. And let's face it, GAME FREAK coded it this way (although their's was more complex because it needed to set up a custom battle as well).



The stats yes, nature, no. The nature, attacks, pp, etc is encoded in a way that requires ASM to decode. This article should help explain what I'm talking about.
thanks a lot, i thik i understand now.
__________________
Can't post my website URL everywhere anymore
Thanks to HackMew and JPAN for ASM tutorials!

>>>I SUPPORT<<<
Spoiler:








>>>DESPARATE HELP NEEDED<<<

Spoiler:
IF ANYONE HAS THE OFFSETS FOR WHERE POKEMON STATS ARE STORED, PLEASE LET ME KNOW. ANY HELP IS GOOD, AND YOU WILL BE WELL REWARDED. THANKS.
Reply With Quote
  #8    
Old February 25th, 2010, 09:08 AM
HackMew's Avatar
HackMew
Mewtwo Strikes Back
 
Join Date: Jun 2006
Quote:
Originally Posted by pokemonforever27 View Post
It is true that this code uses more space than the ASM, but not everyone knows ASM, wants to learn it, and wants to deal with inserting it and compiling it. Thus, I made this so that you don't have to know ASM. And let's face it, GAME FREAK coded it this way (although their's was more complex because it needed to set up a custom battle as well).
Learning ASM in first place is not a bad idea at all. Not to talk about the fact some things cannot be done through plain scripting. Also, the script is actually more complex that the respective ASM version. Consider all those addresses: making errors is quite easy. BTW, you assemble ASM routines (ASM means Assembly).

The fact Game Freak coded it that way doesn't mean anything. It's not like their code is perfect. Either way, your script code is meant to retrieve the highest level only, while I've got a mimum level routine too in the R&D section.
__________________
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 03:30 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 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 - 2014 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.