The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Research & Development (https://www.pokecommunity.com/forumdisplay.php?f=195)
-   -   Code ASM Resource Thread (https://www.pokecommunity.com/showthread.php?t=339153)

tzujm33 December 26th, 2014 5:38 PM

I have an idea about limiting the amounts of items that one can carry. however i wouldnjt like it to be like in red or silver. I would like it to be that you have a maximum of kg you can carry and hat each item weighs a diffrent amount of kg. for example a bike could weittgh 10 kg(or some other unit) and pokeball 1 kg. If the limit of the bag is 100 kg, you could be carry either 100 pokeballs or 90 pokeballs and one bike.


Another idea would be like the "game over when whiting out" thing, with the differnce, that the whiting out does occur after your last Pokemon died, or in other words that you dont go to game over after whiting out, aslong as one has pokemons in the box or pension.


I'd totally appreciate someone implementing these ideas! And thx for all the stuff that is already there!

Trainer 781 December 26th, 2014 8:44 PM

Quote:

Originally Posted by FBI agent (Post 8548768)
Thanks :)
Jeez KDS, I don't wanna have to update the first post this often :P
Good job, lol.

Keep working harder and toil, matey. ;P

El Diabeetus December 26th, 2014 11:59 PM

Hm, just thought of another potential thing that hasn't been done. May not be do able, but what about Critical Capture?

RuFF December 27th, 2014 3:28 AM

I don't know if i'm the only one requesting a routine for pokemon ruby
I don't have something to contribute because i don't know how to asm
well i have 2 requests I hope you don't mind

1. You know when it's raining on the overworld it's raining in a pokemon battle. I'd like to see routine that when it's snowing/ashesfalling it's hailing in pokemon battle.

2. And a routine just like in JPAN's Hacked engine where you can make your own items that work with your custom scripts.

it's okay for me if this is not answered because i know that most of you hack fire red now

LocksmithArmy December 27th, 2014 6:26 AM

Quote:

Originally Posted by quil09 (Post 8549470)
2. And a routine just like in JPAN's Hacked engine where you can make your own items that work with your custom scripts.

This has been done... infact, complete item editor does it for you... super simple to implement

Volt-Ikazuchi December 27th, 2014 12:08 PM

Thanks for the No EXP Routine. This will really help to extract the salt of players who think they can level up mid Gym-Battle and get a advantage or something.

TheRabbit December 27th, 2014 8:28 PM

FBI - I know you said you aren't developing routines anymore but I was just looking for some insight. Have you ever looked into changing the events that affect the player's trainer card in FR?

As an example, if I wanted to make it so finishing a new event gives a trainer card star instead of that stupid Doduo game. How would I do this?

kearnseyboy6 December 27th, 2014 9:14 PM

Quote:

Originally Posted by TheRabbit (Post 8550604)
FBI - I know you said you aren't developing routines anymore but I was just looking for some insight. Have you ever looked into changing the events that affect the player's trainer card in FR?

As an example, if I wanted to make it so finishing a new event gives a trainer card star instead of that stupid Doduo game. How would I do this?

I'm pretty sure it's either a variable or flag that affects the trainer card. Just make your own events that change these variables.

Spherical Ice December 28th, 2014 2:41 AM

Quote:

Originally Posted by TheRabbit (Post 8550604)
FBI - I know you said you aren't developing routines anymore but I was just looking for some insight. Have you ever looked into changing the events that affect the player's trainer card in FR?

As an example, if I wanted to make it so finishing a new event gives a trainer card star instead of that stupid Doduo game. How would I do this?

Quote:

Originally Posted by kearnseyboy6 (Post 8550652)
I'm pretty sure it's either a variable or flag that affects the trainer card. Just make your own events that change these variables.

Just a reminder guys, not necessarily targeted only at you two, that this is for ASM resources, and so questions don't belong here. Instead, post in the ASM & Disassembly Help Thread in the future. Thanks!

DizzyEgg December 31st, 2014 2:58 PM

Hey, I've got a simple request.
Could you change the boost that held items such as mystic water, charcoal, magnet, twisted spoon etc. give from 10% to 20%.

Lance32497 December 31st, 2014 3:44 PM

Quote:

Originally Posted by FBI agent (Post 8527650)

Battle Modes!



In this post, we will be implementing a base skeleton structure to allow the hacker to add in their own battle modes, I'll also be including some example "add-ons" so you know how to do it yourself. The post currently contains possibilities for the hacker to implement routines which run once at the end of each turn (perfect for tournament clauses) and a routine which runs once every move is chosen and used (perfect for trainer sliding *hint hint danillS*).

I'm calling it a skeleton, but it's actually more like a hook into a routine which runs your routines!
It works like this:
1) Hook from original to routine which runs routines
2) If flag is set, routine runs the routines it's told to run
3) Returns back to hooking location

So all you really need to do to add new battle modes, is add to the list of routines we call (Which is simple, I'll explain in detail later). I should also mention that these routines are called in ALL types of battle including wild, trainer, and scripted. Happy hacking!

Battle Routine By Move:



This routine will run, on average four times per turn. Once you select your move, once you use your move, once the opponents uses their move and at the end of the aftermath. This makes the routine a perfect branching place for an Oak-tutorial like battle.

How to insert:
Look at the routine below. The last line .table has an incomplete pointer. It says 0x[pointer to routine table]. Find enough free space (takes 4 byte per routine) in your ROM and set the pointer for .table to that. You do not add +1 to the pointer, nor is it in reverse hex. Once you've fixed the pointer, compile the routine into free space. The last pointer in the routine NEEDS to be 00 00 00 00.


Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main
        push {r0-r4}
        mov r0, #0xBF @flag to check divided by 4
        lsl r0, r0, #0x2
        ldr r1, =(0x806E6D0 +1)
        bl linker
        cmp r0, #0x0
        beq noCrash
        ldr r4, .table

loop:
        ldr r1, [r4]
        cmp r1, #0x0 @check table entry is null
        beq noCrash
        bl linker @call table routine
        add r4, r4, #0x4 @get next table routine
        b loop

noCrash:
        pop {r0-r4}
        lsl r0, r0, #0x18
        lsr r0, r0, #0x18
        mov r10, r0
        lsl r1, r1, #0x10
        lsr r1, r1, #0x10
        ldr r2, =(0x2022874)
        ldr r0, =(0x800E2EA +1)
        bx r0

linker:
        bx r1

.align 2

.table:
        0x[pointer to routine table] @THIS IS FREE SPACE IF IT'S YOUR FIRST TIME USING THIS ROUTINE


Navigate to


Now navigate to 0xE2E0 and insert the byte changes:
Code:

00 4D 28 47 XX XX XX 08


Where XX XX XX is the reverse hex pointer to your routine +1.



Usage:
The routine is toggled by flag 0x2FC. Activate the flag to toggle routines called by this routine. To add routines into the list of called routines, navigate to the pointer of freespace you made .table point to. Insert into that table pointers in reverse hex +1 to wherever you compiled the addon routines make sure they have the 0x8 prefix. The structure of the table should be: [routine pointer in reverse hex +1 (4 bytes)] for each pointer in the table. I.e if I put the addon at 0x740000, the pointer would read 01 00 74 08.

why I got this error?
https://z-1-scontent-a-hkg.xx.fbcdn.net/hphotos-xpa1/v/t1.0-9/10896888_767975836603808_8462018698209144451_n.jpg?oh=9e352336e8c53b82ac50710c2d0f7edd&oe=5532469F

help please

Quote:

Originally Posted by FBI agent (Post 8527650)

Battle by turn addons:



Sleeping clause:
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        push {r0-r3,lr}
        mov r2, #0x0 @pokemon counter
        mov r3, #0x0 @sleeping counter

loop:
        cmp r2, #0x5
        beq validateBattle
        ldr r0, =(0x202402C + 0x50)
        mov r1, #0x64
        mul r1, r1, r2
        add r0, r0, r1
        ldrb r0, [r0]
        lsl r0, r0, #0x5
        lsr r0, r0, #0x5
        cmp r0, #0x0 @check sleeping
        beq next
        add r3, r3, #0x1
next:
        add r2, r2, #0x1
        b loop

validateBattle:
        cmp r3, #0x1 @check amount sleeping <=1
        ble end
        ldr r0, =(0x2023E8A)
        mov r1, #0x5
        strb r1, [r0]       

end:
        pop {r0-r3, pc}

.align 2




Battle end by turn:
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        push {r0-r1,lr}
        ldr r0, =(0x20370CC)
        ldrb r0, [r0]
        ldr r1, =(0x3994FA3)
        ldrb r1, [r1]
        cmp r1, r0
        bne end
        ldr r0, =(0x2023E8A)
        mov r1, #0x5
        strb r1, [r0]
end:
        pop {r0-r1, pc}

.align 2



Hi, if flag 0x2f8 has been set, will Sleeping clause and battle by end turn function simultaneously?

daniilS December 31st, 2014 3:56 PM

You need to put .word before the 0xpointerToTable I think.

Aruaruu December 31st, 2014 7:24 PM

Quote:

Originally Posted by DizzyEgg (Post 8556897)
Hey, I've got a simple request.
Could you change the boost that held items such as mystic water, charcoal, magnet, twisted spoon etc. give from 10% to 20%.

This can be done in nearly any item editor. Just change the second special value to whatever you want.

DizzyEgg January 1st, 2015 3:16 PM

Hey. I've got some ideas that could make the game more similar to the newer ones. I don't know if they're all doable in ASM or if they could be done without it. If so, sorry. Anyway, here's my ideas:
- Electric types are immune to paralysis.
- Sturdy negates all hits that would OHKO-ed them and leaves Pokemon with 1 HP
- Grass types' immunity to powder moves i.e spore, poison powder etc.
- New items such as toxic orb, flame orb, focus sash, scope lens etc.

Lance32497 January 2nd, 2015 4:28 AM

Quote:

Originally Posted by FBI agent (Post 8515384)
Use special 0x9F to select the Pokemon then callasm.


EV Reducing berries



Speaking of special 0x9F, I finished EV reducing berries which was rather easy.
First of all, follow this tutorial: http://www.pokecommunity.com/showthread.php?t=258426
until you get to the part where you have to give the item an effect via script.

Compile and insert into free space the following routine:
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        push {r0-r4, lr}
        ldr r0, = (0x20370C0)
        ldrb r1, [r0]
        ldr r0, =(0x2024284)
        mov r2, #0x64
        mul r1, r1, r2
        add r0, r0, r1
        mov r4, r0
        ldr r2, =(0x20370D0)
        ldrb r1, [r2]
        push {r4}
        ldr r3, =(0x803FBE8 +1)
        bl linker
        pop {r4}
        ldr r2, =(0x20370B8)
        ldrb r3, [r2]
        cmp r3, r0
        bhi NoEffect
        sub r0, r0, r3
        mov r3, r0

end:
        mov r0, r4
        ldr r2, =(0x20370D0)
        ldrb r1, [r2]
        strh r3, [r2]
        ldr r3, =(0x804037C +1)
        bl linker
        pop {r0-r3, pc}

noEffect:
        ldr r2,  =(0x20370d0)
        mov r1, #0xFF
        strb r1, [r2]
        pop {r0-r4, pc}

linker:
        bx r3

.align 2


Here's a compiled version:
Code:

1F B5 10 48 01 78 10 48 64 22 51 43 40 18 04 1C 0E 4A 11 78 10 B4 0E 4B 00 F0 13 F8 10 BC 0D 4A 13 78 83 42 FE D8 C0 1A 03 1C 20 1C 07 4A 11 78 13 80 09 4B 00 F0 05 F8 0F BD 04 4A FF 21 11 70 1F BD 18 47 C0 70 03 02 84 42 02 02 D0 70 03 02 E9 FB 03 08 D2 70 03 02 7D 03 04 08




For the part of inserting a script to give your item functionality, you need to insert this script.
Code:

#dyn 0x740000
#org @start
special 0x9f
waitspecial
storepartypokemon 0x0 0x8004 'bufferpokemon2 in xse
setvar LASTRESULT 0x[EV to modify]
setvar 0x8000 0x[amount to decrease EV by]
callasm 0x[routine +1]
compare LASTRESULT 0xFF
if == jump @failed
storevar 0x1 0x800F 'buffervar in xse
msgbox @gain
callstd MSG_NORMAL
removeitem 0x[ID] 0x1
release
end

#org @failed
msgbox @noEffect
callstd MSG_NORMAL
release
end

#org @noEffect
= It would have no effect!

#org @gain
= \v\h02 gained \v\h03\nInsert the EV your berry gives


In variable 0x8000 put the amount the EV is to decrease by.
In variable 0x800D put which EV you want to modify, in this format:
0x1A - HP EV
0x1B - Attack EV
0x1C - Defence EV
0x1D - Speed EV
0x1E - Sp. Attack EV
0x1F - Sp. Defence EV

Tried and tested but it doesnt work

Mickey` January 2nd, 2015 5:17 AM

Quote:

Originally Posted by FBI agent (Post 8547374)

Adjusting Shiny encounter chance



[...]

After you've done that, compile and insert the following routine into free space:

Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        push {r0-r3}
        mov r0, #0x1 @item ID
        mov r1, #0x1
        ldr r2, =(0x8099F40 +1)
        bl linker
        cmp r0, #0x0
        beq normal
        mov r0, #0xA
        lsl r0, r0, #0x7
        add r0, r0, #0x55 @1/1365 chance with shiny charm
        b calcChance

normal:
        mov r0, #0x20
        lsl r0, r0, #0x7 @1/4096 chance normally

calcChance:
        ldr r1, =(0x20370B8)
        strh r0, [r1]
        ldr r2, .random
        bl linker
        cmp r0, #0xFF
        bne
        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 0x8[RANDOM +1]





[...]


I have two questions :

First, what did you forget after the bne in calcChance ? I don't really understand what this check does.

Also, if I want to change the shiny encounter chance (without the shiny charm), I have to change this two lines, right ?

Code:

mov r0, #0x20
lsl r0, r0, #0x7 @1/4096 chance normally


For example,

Code:

mov r0, #0x2
lsl r0, r0, #0x0


With this code, I have one chance on two to find a shiny Pokemon ?

Thanks ! :)

AkameTheBulbasaur January 2nd, 2015 1:38 PM

Quote:

Originally Posted by Lance32497 (Post 8560582)
Tried and tested but it doesnt work

How does it not work for you? Does is not run the script? Or does it run the script but not cause any effect? I was able to get it to run a script, and it seems to have worked for me. You can PM me and I'll help you out more.

Blah January 2nd, 2015 2:57 PM

Quote:

Originally Posted by daniilS (Post 8556959)
You need to put .word before the 0xpointerToTable I think.

Yeah, you're right. I miss some stuff from time to time when I port them from my computer to the site :x

Quote:

Originally Posted by Lance32497 (Post 8560582)
Tried and tested but it doesnt work

I know 2 confirmed people who've gotten it working. Uhhh...maybe you inserted it incorrectly or something.

Quote:

Originally Posted by Mickey` (Post 8560625)
I have two questions :

First, what did you forget after the bne in calcChance ? I don't really understand what this check does.

Also, if I want to change the shiny encounter chance (without the shiny charm), I have to change this two lines, right ?

Code:

mov r0, #0x20
lsl r0, r0, #0x7 @1/4096 chance normally


For example,

Code:

mov r0, #0x2
lsl r0, r0, #0x0


With this code, I have one chance on two to find a shiny Pokemon ?

Thanks ! :)

That should say, "bne end" sorry. Yes, your version would make it 50% chance for a shiny (though at that point you don't need the lsl)

Lance32497 January 2nd, 2015 3:22 PM

Quote:

Originally Posted by FBI agent (Post 8561631)
I know 2 confirmed people who've gotten it working. Uhhh...maybe you inserted it incorrectly or something.

huh? I check it off, by the way, I used LockSmithArmys complete item editor

Mickey` January 2nd, 2015 4:07 PM

Quote:

Originally Posted by FBI agent (Post 8561631)
That should say, "bne end" sorry. Yes, your version would make it 50% chance for a shiny (though at that point you don't need the lsl)

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...

daniilS January 2nd, 2015 4:43 PM

FBI had explained it should have been a bne end.

Blah January 3rd, 2015 12:45 AM

Quote:

Originally Posted by Lance32497 (Post 8561677)
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.

Quote:

Originally Posted by Mickey` (Post 8561758)
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).

Lance32497 January 3rd, 2015 12:59 AM

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.

Mickey` January 3rd, 2015 3:27 AM

Quote:

Originally Posted by FBI agent (Post 8562645)
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
        cmp r0, #0xFF
        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}

Lance32497 January 4th, 2015 3:58 PM

Quote:

Originally Posted by FBI agent (Post 8531480)
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?
Quote:

...
setvar 0x8002 0xFF
callasm [routine+1]
...
because it doesnt work for me if I just set the var

Quote:

Originally Posted by KDS (Post 8537176)
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, #0xZZ
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?


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


Like our Facebook Page Follow us on Twitter © 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.