The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script How do you get the move ID of a Pokemon?

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old May 20th, 2017 (9:29 AM).
TheHunterManX's Avatar
TheHunterManX TheHunterManX is offline
 
Join Date: Jul 2015
Gender: Male
Posts: 92
So, while programming, I have ran into a (fairly important) problem. I am here to ask the community for a solution.
How would I get a move Id of the move I select with special 0xDC? I have looked all around for this and the closest I got was this: https://www.pokecommunity.com/showthread.php?t=168600 , however I cannot/don't know how to get the move Id of the move I select from the special. Any help would be great.
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old May 20th, 2017 (11:54 AM). Edited May 20th, 2017 by ghoulslash.
ghoulslash's Avatar
ghoulslash ghoulslash is offline
 
Join Date: Mar 2016
Gender: Male
Posts: 238
according to JPANs thread on specials, I believe you would set variable 0x8004 to a specific pokemon slot (0x0-0x5), and then use special2 0x8005 0xDC to open the move menu screen. Selecting a move should store the move position into variable 0x8005.

It appears to be a move reminder/deleter special so I'm not sure if there is an inherent special to get this move ID, I believe it just stores the slot number of the selected move into 0x8005. But, you could write an assembly routine to then load the appropriate move from the pokemon data using the Get Attribute function. Let me know if you need help writing the assembly :)
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old May 20th, 2017 (8:08 PM).
TheHunterManX's Avatar
TheHunterManX TheHunterManX is offline
 
Join Date: Jul 2015
Gender: Male
Posts: 92
I have already used special 0xDC, however, like you said, it returns to 0x8005 the move position. I need the move ID. I may be able to edit a little bit of ASM, but I cannot write it (I have already done tutorials on ASM, however not for pokemon, and only a small portion). If there is a special I can use to get the move ID or if anyone can tell me where the move ID is stored when I use callasm on the pokemon data decipher code, it would be appreciated.
Here is my example script of what I want:
Code:
#dynamic 0x800000
#org @start
faceplayer
lock
special 0x9F
//special to bring up menu
waitstate
special2 0x8005 0xBA
//special to read pokemon number from the position stored to 0x8004
compare 0x8005 0x0
//If pokemon if bulbasaur
if 0x1 goto @bulbasaur
release
end
#org @bulbasaur
special 0xDC
//Displays move menu of pokemon in the party position of 0x8004
//Here is where I want to get the moveID of the move slot on 0x8005 of the pokemon on 0x8004
compare 0x8005 0x1
//If move is pound
if 0x1 goto @pound
buffernumber 0x8005
msgbox @test 0x6
release
end
#org @pound
msgbox @test2 0x6
release
end
#org @test
= That's not pound, thats [buffer1],
#org @test2
= That's...!\pThat's pound! Finally, after\nall this time! Thank you.
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old May 20th, 2017 (8:37 PM).
ghoulslash's Avatar
ghoulslash ghoulslash is offline
 
Join Date: Mar 2016
Gender: Male
Posts: 238
No problem, I may use something similar like this in the future so I wrote up a simple routine. Fair warning: I haven't tested it, so you'll have to let me know if it works. I heavily commented it to help you get the hang of assembly.

I wasn't sure if special 0xDC returned the move position as 0x0-0x3 or 0x1-0x4. If the latter, you'll have to add a line to the routine (specifics in the comments)

Code:
.text
.align 2
.thumb
.thumb_func

main:
	push {r0-r2, lr}
	ldr r0, .var8005
	ldrb r0, [r0]                      @r0 = selected move position
	mov r1, #0xD                  @r1 is the attribute to "decrypt" move IDs are between 0xD-0x10
	add r1, r1, r0				@get move ID of attack (1+0x8005 value) - if special 0xDC returns 0x1-0x4 instead of 0x0-0x3, add a sub r1, r1, #0x1 below this line
	ldr r0, .var8004
	ldrb r0, [r0]                  @get selected pokemon's slot number (0x0-0x5)
	mov r2, #0x64
	mul r0, r0, r2                @100*slot#
	ldr r2, .PartyPoke         @address for first pokemon in your party
	add r0, r2, r0                @r0 = address of selected pokemon
	ldr r2, .GetAttr
	bl linker					@store move ID in r0
	ldr r1, .var8006			@change to .var8005 if you want to store the moveID back in 0x8005 instead
	strh r0, [r1]                     @store move ID in var 0x8006
	pop {r0-r2, pc}
	
linker:
	bx r2

.align 2
.var8005:	.word 0x020370C2
.GetAttr:	.word 0x0803FBE9
.var8004:	.word 0x020370C0
.PartyPoke:	.word 0x02024284
.var8006:	.word 0x020370C4
Hope this helps!
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old May 20th, 2017 (10:51 PM).
TheHunterManX's Avatar
TheHunterManX TheHunterManX is offline
 
Join Date: Jul 2015
Gender: Male
Posts: 92
The ASM code works! Thank you for making it. It gave back from 0xDC 0x0-0x3.
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

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

Forum Jump


All times are GMT -8. The time now is 9:17 AM.