• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Code: ASM Resource Thread

[PokeCommunity.com] ASM Resource Thread


I got this error in your routine, the bne something

FBI had explained it should have been a bne end.
 
huh? I check it off, by the way, I used LockSmithArmys complete item editor

I don't use many tools, so I'm not sure how that really works. I just know the routine is fine and dandy.

Okay, so I was right, but it doesn't work. I compile the 3 routines correctly, and it works only if I set the variable 8002 to 0xFF. But if I don't set the var to this value, the wild Pokemon isn't shiny. I tryed to set a great probability to encounter a shiny in the routine (1/2), but the wild Pokemon is still normal, not shiny...

It should work. I've tested the routine myself on a clean ROM and simply just pasted the code over here with some minor edits to make it insertable for others. Also it calls the random number generating routine to determine the chance. Did you insert that as well?

If you want to send me your ROM, I can point out what exactly is going downhill for you. Most of the time with these kind of problems it's a simple mistake somewhere or a missing routine.

I know for a fact this routine system works because I've also used it in other places like chain fishing (which I've also tested).
 
I dont know why but all the scripts I made and inserted in LSA-Complete item editor came in an error, I really dont know why? I should contact him.
 
It should work. I've tested the routine myself on a clean ROM and simply just pasted the code over here with some minor edits to make it insertable for others. Also it calls the random number generating routine to determine the chance. Did you insert that as well?

If you want to send me your ROM, I can point out what exactly is going downhill for you. Most of the time with these kind of problems it's a simple mistake somewhere or a missing routine.

I know for a fact this routine system works because I've also used it in other places like chain fishing (which I've also tested).

Finally, I found the problem !

It's in the code of the shiny encounter chance :

Code:
.text
.align 2
.thumb
.thumb_func


main:
	push {r0-r3}
	
normal:
	mov r0, #0x2
	lsl r0, r0, #0x0 @1/2 chance normally
	
calcChance:
	ldr r1, =(0x20370B8) @ var 8000
	strh r0, [r1] @ var 8000 = r0
	ldr r2, .random
	bl linker @ random between 0 et r0
	[U][B]cmp r0, #0xFF[/B][/U]
	bne end
	@ if equal to 0xFF, the Pokemon is shiny
	ldr r1, =(0x20370BC)
	strb r0, [r1]
	ldr r1, =(0x20370B8)
	mov r0, #0x0
	strh r0, [r1]

end:
	pop {r0-r3}
	sub SP, SP, #0x20
	mov r7, r0
	ldr r4, [SP, #0x40]
	ldr r4, [SP, #0x48]
	mov r5, #0xE
	ldr r6, =(0x803DAD8 +1)
	bx r6
	
linker:
	bx r2
	
	
.align 2

.random:
	.word 0x8C00001

In fact, if I set r0 to 2 (for example), the random value will be 0 or 1. Generally speaking, if I set r0 to a value under 0xFF, r0 will never be equal to 0xFF, so the Pokemon won't be shiny.

I wrote cmp r0, #0x0 instead of. And also, because we must set 8002 to 0xFF to make a Pokemon shiny, I added the line mov r0, #0xFF.

Here is my new code :

Code:
.text
.align 2
.thumb
.thumb_func


main:
	push {r0-r3}
	
normal:
	mov r0, #0x2
	lsl r0, r0, #0x0 @1/2 chance normally
	
calcChance:
	ldr r1, =(0x20370B8)
	strh r0, [r1]
	ldr r2, .random
	bl linker
	cmp r0, #0x0
	bne end
	mov r0, #0xFF
	ldr r1, =(0x20370BC)
	strb r0, [r1]
	ldr r1, =(0x20370B8)
	mov r0, #0x0
	strh r0, [r1]

end:
	pop {r0-r3}
	sub SP, SP, #0x20
	mov r7, r0
	ldr r4, [SP, #0x40]
	ldr r4, [SP, #0x48]
	mov r5, #0xE
	ldr r6, =(0x803DAD8 +1)
	bx r6
	
linker:
	bx r2
	
	
.align 2

.random:
	.word 0x8C00001

It works perfectly. Thank you for your work fbi, you're great ! {XD}
 
Last edited:
Usage:
setvar 0x8002 0xFF 'This line makes it so the next Pokemon you encounter, or are given is a shiny Pokemon with a properly generated PID. I've made it so the code sets 0xFF back to 0x0 so you don't have to disable it after. There's only an enable switch :)

so this code works?
...
setvar 0x8002 0xFF
callasm [routine+1]
...

because it doesnt work for me if I just set the var

Wide Lens (Raises wielder's accuracy by 10%)

Spoiler:

Hello ^_^
What is the mystery byte?
There's no item wide lens in Gen3 right? then Should I create new item? then what is next?
 
Last edited:
Hello ^_^
What is the mystery byte?
There's no item wide lens in Gen3 right? then Should I create new item? then what is next?

It is actually the Hold Effect Item byte or Special Value 1 byte. You should create a new item for this then assign it hold effect item byte.
 
It is actually the Hold Effect Item byte or Special Value 1 byte. You should create a new item for this then assign it hold effect item byte.

There are 42 Mystery bytes(in Hex) in rom, so Does it mean I should use the existing Mystery byte or I can expand it so that Ill be having more than 42 Mystery bytes?
 
There are 42 Mystery bytes(in Hex) in rom, so Does it mean I should use the existing Mystery byte or I can expand it so that Ill be having more than 42 Mystery bytes?

Lol, you should use a new number. Just open up an item editor and select your desired item, then in the special value 1 field enter a number that you kept instead of ZZ in the ASM. ( just make sure that no. is different from the prexisting item's special value numbers, you can check locksmitharmy's hold-item effect thread in the R&D forum for reference).
 
Lol, you should use a new number. Just open up an item editor and select your desired item, then in the special value 1 field enter a number that you kept instead of ZZ in the ASM. ( just make sure that no. is different from the prexisting item's special value numbers, you can check locksmitharmy's hold-item effect thread in the R&D forum for reference).

ahhhhm so lets say I used 43, is that right? I read his thread and the rom has 42(in Hex), 43 as my new effect byte.
 
ahhhhm so lets say I used 43, is that right? I read his thread and the rom has 42(in Hex), 43 as my new effect byte.

It is fine. But i prefer keeping larger numbers like 73-76 to be on the safe side
 
Finally, I found the problem !

It works perfectly. Thank you for your work fbi, you're great ! {XD}

Wow, I'm an idiot, sorry. I forgot completely about that haha. Well, at least hopefully it was a good exercise for you :P

I was wondering if the battle by turn routine also worked with double battles.

90% sure it does (I haven't tested, but I do believe they use that portion of code in both battle types).

so this code works?

It does work. I've tested that one quite thoroughly :X


Updates:
- Pokemon custom attacks routine has been updated
- Battle by move (and turn) bug fixes + efficiency updates
- some other small bug fixes that I don't feel like listing (EV berries and stuffs)

I'm currently working on having one time/limited quantity buying for marts right now. I expect that to be done sometime this week, lately I've been lazy and busy :P
 
Wow, I'm an idiot, sorry. I forgot completely about that haha. Well, at least hopefully it was a good exercise for you :P

Yes, it was :P

I have another question (because nobody replied to my previous post) : does anyone know the offset of the routine which check the Cave byte (Regular/Dark, Flash usable/Dark, Flash unusable) ?

Thanks !
 
Yes, it was :P

I have another question (because nobody replied to my previous post) : does anyone know the offset of the routine which check the Cave byte (Regular/Dark, Flash usable/Dark, Flash unusable) ?

Thanks !

The map is a cave if in RAM location 0x2036E11 is 0x1 and the lightING is determined at 0x2036E13 I believe. There are a lot of routines that check the current map header, so there isn't really a particular routine that I can give you which checks this. I can tell you that the routine for flash is at 0x80C9B2C
 
The map is a cave if in RAM location 0x2036E11 is 0x1 and the lightING is determined at 0x2036E13 I believe. There are a lot of routines that check the current map header, so there isn't really a particular routine that I can give you which checks this. I can tell you that the routine for flash is at 0x80C9B2C

Thanks a lot ! I'm going to check if I can use these offsets.
 
It is fine. But i prefer keeping larger numbers like 73-76 to be on the safe side

Ahhh, Thanks ^_^
May I ask, When you tested that, what mystery byte did you used?

EDIT: FBI about your Temporary Deleting the EXP GAIN portion, it doesnt share EVs of a Pokemon I battled before
 
Last edited:

Temporarily disabling EXP gains from battle


It was brought to my attention by some requesters that for their battle/tournament events they wouldn't want their Pokemon leveling up. This routine disables the exp gains in battle. Note that the player can still use stuff like Rare Candy to level. The fix to that is exactly the same as this, but with slight modifications. I hope you don't give the player a chance to rare candy in battle though or I will go to your hack's thread and severly criticize your lack of common sense :c


How to insert:

Compile and insert the following routine into free space:

Spoiler:


Now navigate to 0x21CFA and insert the following byte changes:
Code:
00 00 00 49 08 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer to where you inserted this routine +1.

Usage:

If flag 0x202 is set, the EXP gains will be disabled. Obviously, to re-enable just clear the flag.
Currently the way I'm doing this is by making the game act like the player's party is already max level, so therefore they don't gain exp :)

Hmm... that's one good thing to implement. If someone has a passion to make Black Tower/White Treehollow in any hack, do you have (or will you make) an independent routine to disable the usage of items (holding is still able)?
 
Ok so I hath a request. Both are for Emerald.
1: a routine that allows you to dynamically change the wild pokemon of the route you are in, via variables or such.
this was already done for Fire Red so I would hope it wouldnt be too terrible to port.

2: a routine that only allows flying/dragon type pokemon to be sent out into battle. Pretty much like the sky battles in x/y. But not quite the same.
 
Ok so I hath a request. Both are for Emerald.
1: a routine that allows you to dynamically change the wild pokemon of the route you are in, via variables or such.
this was already done for Fire Red so I would hope it wouldnt be too terrible to port.

2: a routine that only allows flying/dragon type pokemon to be sent out into battle. Pretty much like the sky battles in x/y. But not quite the same.

What?
Is that true?
May I have the name who did that?
 
What?
Is that true?
May I have the name who did that?

Yes its true.
Jpan.
Its in his hacked engine.
Spoiler:
 
Back
Top