daniilS
busy trying to do stuff not done yet
- 409
- Posts
- 11
- Years
- Seen Jan 29, 2024
![]()
I got this error in your routine, the bne something
FBI had explained it should have been a bne end.
![]()
I got this error in your routine, the bne something
huh? I check it off, by the way, I used LockSmithArmys complete item editor
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).
.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
.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
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 :)
...
setvar 0x8002 0xFF
callasm [routine+1]
...
Wide Lens (Raises wielder's accuracy by 10%)
Spoiler:
At 1E050: 00 4A 10 47 XX+1 XX XX 08
ZZ is the mystery byte of your item.
Code:.text .align 2 .thumb .thumb_func ldr r0, =0x2023d6b ldrb r0, [r0, #0x0] mul r0, r5 add r0, r0, r7 add r0, #0x2e ldrh r0, [r0, #0x0] bl geteffect cmp r0, [B]#0xZZ[/B] bne noboost mov r0, #0x6E mul r0, r4 mov r1, #0x64 bl divide lsl r0, r0, #0x10 lsr r4, r0, #0x10 noboost: mov r0, #0x0 str r0, [sp, #0x0] mov r0, #0x13 mov r1, #0x0 ldr r2, return bx r2 divide: ldr r2, divider bx r2 geteffect: ldr r1, getbyte bx r1 .align 2 getbyte: .word 0x0809A925 divider: .word 0x081E4019 return: .word 0x0801E059
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.
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).
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.
Finally, I found the problem !
It works perfectly. Thank you for your work fbi, you're great ! {XD}
I was wondering if the battle by turn routine also worked with double battles.
so this code works?
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 !
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
It is fine. But i prefer keeping larger numbers like 73-76 to be on the safe side
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:
Code:.text .align 2 .thumb .thumb_func main: push {r0-r3} mov r0, #0xFF lsl r0, r0, #0x1 add r0, r0, #0x4 ldr r2, =(0x806E6D0 +1) @checkflag 0xFF *0x2 + 4 = 0x202 bl linker cmp r0, #0x1 beq skip pop {r0-r3} cmp r0, #0x64 beq noCrash ldr r0, =(0x8021D24 +1) bx r0 skip: pop {r0-r3} noCrash: ldr r1, [r5] add r1, #0x53 ldrb r0, [r1] ldr r2, =(0x8021D04 +1) linker: bx r2 .align 2
Here's a compiled version:
Code:0F B4 FF 20 40 00 04 30 07 4A 00 F0 0C F8 01 28 04 D0 0F BC 64 28 02 D0 04 48 00 47 0F BC 29 68 53 31 08 78 02 4A 10 47 D1 E6 06 08 25 1D 02 08 05 1D 02 08
Now navigate to 0x21CFA and insert the following byte changes:
Where XX XX XX is the reverse hex pointer to where you inserted this routine +1.Code:00 00 00 49 08 47 XX XX XX 08
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 :)
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?