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)

Skeli February 13th, 2019 9:09 PM

Quote:

Originally Posted by Skeli- (Post 9743323)
Expanding the Bag Entirely [FR]
]

This has been updated with fixes for the Old Man battle, Teachy TV, and expanded berries.

Golddron February 17th, 2019 4:38 AM

I've been working on a FR hack for a few months recreating Pokémon Colosseum/Gale of Darkness. About 95% done with the trainer editing (The shadow pokemon concept wasn't really working out as I was having trouble catching a specific pokemon from a trainer's party, so I've just been using the givepokemon command after the battle and using the flags from various overworld item sprites).

I'd really like to add a function where an opponents party level matches the highest in your party, like in the Mt Battle area in those games. Is there a way to set that up in a specific area of the game? Like to pull a certain trainer hex ID into the trainerbattle command and temporarily adjust the levels from their original setting to the highest in your party? Or would entirely new trainers have to be made? I'm leaning toward that because I've tried to find the trainers in the Trainer Tower in FR but they don't seem to be available to edit in trainer editing programs.

I've been scouring threads looking for info on this, but haven't had much luck. If anyone is able to help, wants to take a crack at it, or point me in the right direction I'd greatly appreciate it.

EDIT

I've come across how to get the highest level in my party, but I'm unsure how to have the game temporarily overwrite the trainer's pokemon level with a script, so I was thinking an ASM routine might be the way to go.

eMMe97 February 17th, 2019 2:17 PM

Quote:

Originally Posted by ghoulslash (Post 9976338)
[FR] Selection from PC Box

This hack allows the player to directly select a pokemon from the pc boxes by modifying the tasks associated with the withdraw function. It doesn't actually do anything with the selection except store relevant data, but this data can then be used in subsequent functions to modify relevant data.

Fortunately, I added in some new/updated specials to allow the user to swap pokemon between box and party for things like trading, nicknaming, and checking/setting pokeball types. Adding new specials for other data manipulation is easy enough, and I would be happy to add more if more ideas come to me.

Current Special Fixes Include:
Spoiler:

special 0x7 - get EVs of party/boxed pokemon
special 0x8 - get IVs of party/boxed pokemon
special 0xB - get pokeball ID of party/boxed pokemon
special 0xD - get happiness of party/boxed pokemon
special 0x13 - set happiness of party/boxed pokemon
special 0x14 - ste pokeball ID of party/boxed pokemon
special 0x1A - save/restore party pokemon data to/from free ram (default is 6th opponent slot)
special 0x1B - save/restore pokemon data to/from pc
special 0x7b - check nicknamed pokemon from party/box
special 0x7c - buffer party/boxed pokemon nickname
special 0x7d - check traded pokemon from party/box
special 0x9e - nickname pokemon from party/box


Here is the repository. The readme should do an adequate job of detailing the usage.

Here is a GIF of using this function with a wonder trade. (credit to sagiri for the dtan system)
https://i.imgur.com/zq6pr9c.gif

GREAT!!!!
Can u make a example script please? I don't understand how to make it (I just read the README text in the repository). Thank you :)

rubenturen February 18th, 2019 1:59 AM

im using emerald
Hello I wanted to know if there
Is a way to make a asm routine that I can call in a script Wich shows a trainer battle sprite anywhere on screen
Like a modified showpokepic or something

(P.s. i’m Not good at making asm myself so pls design the routine for me)

ghoulslash February 18th, 2019 11:19 AM

Quote:

Originally Posted by eMMe97 (Post 9980856)
GREAT!!!!
Can u make a example script please? I don't understand how to make it (I just read the README text in the repository). Thank you :)

There is an example nicknaming script at the bottom of the readme file.

The usage is essentially:
Code:

writebytetooffset 0x1 <state tracker ram>
special 0x3c
waitstate
writebytetooffset 0x0 <state_tracker ram>


This will let you select a pokemon from the box, and store the relevant location information to var8000 and var8001. Then, using the updated specials you can manipulate that pokemon's data.

eMMe97 February 18th, 2019 2:35 PM

Ok. But how can insert 2 Pokémon in the box? For example bulbasaur e squirtle?

ghoulslash February 18th, 2019 8:29 PM

Quote:

Originally Posted by eMMe97 (Post 9981292)
Ok. But how can insert 2 Pokémon in the box? For example bulbasaur e squirtle?

The routine doesn't let you deposit pokemon to the box, just select them. The hack itself does nothing except save useful information.

uchiwaobito February 19th, 2019 9:20 AM

Quote:

Originally Posted by GoGoJJTech (Post 8881333)
For Emerald (Changes in Red):
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

main:
        push {r0-r7}
        ldr r0, =(0x20244EC) @Party Pokémon
        mov r6, #0x0
        ldr r7, =(0x20244E9) @Party Quantity
        ldrb r7, [r7]

loop:
        cmp r6, r7
        beq end
        mov r1, #0x64
        mul r1, r1, r6
        add r0, r0, r1
        mov r5, r0
        mov r1, #0x39
        ldr r3, =(0x806A518 +1) @Pokemon Get Attribute
        bl linker
        mov r4, r0
        cmp r4, #0x0
        beq next
        mov r0, r5
        mov r1, #0x3A
        ldr r3, =(0x806A518 +1) @Pokemon Get Attribute
        bl linker
        add r6, r6, #0x1
        cmp r4, r0
        beq loop

addOn:
        add r4, r4, #0x3 @amount to add per step. Here it's 3
        cmp r4, r0
        ble cont
        mov r4, r0

cont:
        mov r0, r5
        mov r1, #0x39
        ldr r2, =(0x20375F0) @Var 0x800D (Lastresult)
        strh r4, [r2]
        ldr r3, =(0x806ACAC) @Pokemon Set Attribute
        bl linker
        b loop

next:
        add r6, r6, #0x1
        b loop

end:
        pop {r0-r7}
        lsl r0, r0, #0x18
        lsr r0, r0, #0x18
        cmp r0, #0x1
        beq brancher
        mov r0, r5
        ldr r1, =(0x809C8F4 +1)
        bx r1

brancher:
        ldr r0, =(0x809C92E +1) @This may actually fail the routine, needs testing
        bx r0

linker:
        bx r3

.align 2



Insert at 0x9C8EA.

Nice idea, however it didn't work for Pokemon Emerald BPEE, it automatically reset when the char moves.

Lunos March 4th, 2019 11:38 PM

Quote:

Originally Posted by opakedragon (Post 9960020)
Quote:

Originally Posted by Lunos (Post 9800566)
Quote:

Originally Posted by ghoulslash (Post 9800529)
Here you go! (admittedly I have not tested it)

Code:

.text
.align 2
.thumb
.thumb_func
.global GetHappiness

Main:
        push {r0-r2, lr}
        ldr r0, .var8004
        ldrb r0, [r0]        @slot num
        mov r1, #0x64
        mul r0, r1
        ldr r1, .PartyData
        add r0, r1, r0
        mov r1, #0x20        @happiness
        bl GetAttribute
        ldr r1, .var8004
        strb r0, [r1, #0x2]        @store into var8005
        pop {r0-r2, pc}

GetAttribute:
        ldr r2, =(0x0803FBE8 +1)
        bx r2

.align 2
.PartyData:        .word 0x02024284
.var8004:        .word 0x020370C0



Welp, it didn't work.
I compiled the routine and dropped it in the offset 71A250, wrote this script and once I checked it In-Game, this was the result.
https://i.imgur.com/yGrrQAK.png
Note: Just for the record, the savefile is right after defeating my Rival for the very first time, so there's no way for my Pokémon to have 76 points.

Dunno if you'll be able to fix it, but in any case thank you very much.

Would you be willing to reshare the script (the link is no longer working) in code tags? I am relatively new and trying to figure this stuff out.

Surprisingly, I just stumbled upon a thread that I made in the Spanish community "Whack a Hack!" where I reposted Ghoulslash's routine (giving all the credits to him, naturally.)
I also posted a script to get the routine working there, but instead of carelessly pasting it in Hastebin like I did here, I've put it in Pastebin.

Soo... yeah, here it is.
https://pastebin.com/2tv2QX18

AkameTheBulbasaur March 10th, 2019 2:06 PM

So because I have a life, I spent way too long yesterday writing a routine to change the measurements for the height and weight in the PokeDex to be in metric (for those who eschew the imperial system).

EDIT: I neglected to have this change the units for SEEN entries as well as CAUGHT entries. I fixed that now.


Height (Feet to Metres - (Uncaught Pokemon)):
Spoiler:
/* Assemble this at 0x1059D0 */
.text
.align 2
.thumb
.thumb_func

Main:
add r0, r13, #0xC
mov r1, #0xAC /* ? */
strb r1, [r0]
add r0, r0, #0x1
mov r1, #0xAC /* ? */
strb r1, [r0]
add r0, r0, #0x1
mov r1, #0x0 /* */
strb r1, [r0]
add r0, r0, #0x1
mov r1, #0xE1 /* m */
strb r1, [r0]
add r0, r0, #0x1
mov r1, #0xFF /* FF */
strb r1, [r0]
mov r0, r0
ldr r0, .Return
bx r0

.align 2
.Return: .word 0x081059FF


Height (Feet to Metres):
Spoiler:
/*00 48 00 47 XX XX XX 08 at 0x105924*/
.text
.align 2
.thumb
.thumb_func

/*r4 has the height number*/



Main:
mov r1, #0xB

Clear:
mov r2, r13
add r2, r2, r1
mov r0, #0x0
strb r0, [r2]
cmp r1, #0x10
beq Next
add r1, r1, #0x1
b Clear

Next:
mov r0, r4
cmp r4, #0xA
blt OneDigit
cmp r4, #0x64
blt TwoDigit

ThreeDigit:
mov r1, #0x64
bl Divide
mov r6, r0
mov r2, r13
add r2, r2, #0xC
mov r0, r6
add r0, r0, #0xA1
strb r0, [r2]
mul r1, r6
sub r0, r4, r1
mov r4, r0

TwoDigit:
mov r1, #0xA
bl Divide
mov r5, r0
mov r2, r13
add r2, r2, #0xD
mov r0, r5
add r0, r0, #0xA1
strb r0, [r2]
mul r1, r5
sub r0, r4, r1
mov r4, r0

OneDigit:
mov r2, r13
add r2, r2, #0xF
mov r0, r4
add r0, r0, #0xA1
strb r0, [r2]

PutTextIn:
mov r2, r13
add r2, r2, #0xE
mov r0, #0xAD
strb r0, [r2]
add r2, r2, #0x2
mov r0, #0x00
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0xE1
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0xFF
strb r0, [r2]
ldr r1, .Return
bx r1

Divide:
ldr r2, .Divide
bx r2

.align 2
.Return: .word 0x081059FF
.Divide: .word 0x081E4019


Weight (Pounds to Kilograms):
Spoiler:
/* 00 48 00 47 XX XX XX 08 at 0x105A94 */
/* Put AC 00 DF DB at 0x415FA0 */
.text
.align 2
.thumb
.thumb_func

/* r4 has the weight number */

Main:
mov r1, #0xB

Clear:
mov r2, r13
add r2, r2, r1
mov r0, #0x0
strb r0, [r2]
cmp r1, #0x10
beq Next
add r1, r1, #0x1
b Clear

Next:
mov r0, r4
cmp r4, #0xA
blt OneDigit
cmp r4, #0x64
blt TwoDigit
ldr r1, .Thousand
cmp r4, r1
blt ThreeDigit

FourDigit:
ldr r1, .Thousand
bl Divide
mov r6, r0
mov r2, r13
add r2, r2, #0xB
mov r0, r6
add r0, r0, #0xA1
strb r0, [r2]
ldr r1, .Thousand
mul r1, r6
sub r0, r4, r1
mov r4, r0

ThreeDigit:
mov r1, #0x64
bl Divide
mov r6, r0
mov r2, r13
add r2, r2, #0xC
mov r0, r6
add r0, r0, #0xA1
strb r0, [r2]
mov r1, #0x64
mul r1, r6
sub r0, r4, r1
mov r4, r0

TwoDigit:
mov r1, #0xA
bl Divide
mov r5, r0
mov r2, r13
add r2, r2, #0xD
mov r0, r5
add r0, r0, #0xA1
strb r0, [r2]
mov r1, #0xA
mul r1, r5
sub r0, r4, r1
mov r4, r0

OneDigit:
mov r2, r13
add r2, r2, #0xF
mov r0, r4
add r0, r0, #0xA1
strb r0, [r2]

PutTextIn:
mov r2, r13
add r2, r2, #0xE
mov r0, #0xAD
strb r0, [r2]
add r2, r2, #0x2
mov r0, #0x00
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0xDF
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0xDB
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0x00
strb r0, [r2]
add r2, r2, #0x1
mov r0, #0xFF
strb r0, [r2]
ldr r1, .Return
bx r1

Divide:
ldr r2, .Divide
bx r2

.align 2
.Return: .word 0x08105BE7
.Divide: .word 0x081E4019
.Thousand: .word 0x000003E8

Cam March 28th, 2019 10:22 PM

>Ruby/Saphhire
>nothing to see here
Real disappointing considering I'm stuck with a ruby base for certain reasons.

Delta231 March 29th, 2019 5:03 AM

Quote:

Originally Posted by CloverDevteam (Post 9999147)
>Ruby/Saphhire
>nothing to see here
Real disappointing considering I'm stuck with a ruby base for certain reasons.

You can port some Routines if the functions are similar.

AtecainCorp. April 2nd, 2019 8:28 AM

Quote:

Originally Posted by Sagiri (Post 9947345)
Unhidden Power [FR]

This routine makes the game calculate and display the actual type of Hidden Power in battle and in status screens. If, for example, a Pok�mon's Hidden Power type is Water, it will display as a Water-type move, just like Surf or any other Water-type move.

https://github.com/Sagiri/unhidden-power/blob/master/in-battle.png?raw=true https://github.com/Sagiri/unhidden-power/blob/master/status-screen.png?raw=true

Note that this only calculates and displays the type, not the base power.

I try remade it for Ruby

PokemonXO April 6th, 2019 2:48 PM

Hello, I am looking to add battle items X Sp Def and X Evasion to the game (And perhaps, if it's workable, X HP)

I do not own IDA Pro, so it's going to be a real challenge trying to locate the correct offsets for the Battle Items. I don't know how it's done, but I guess I can request a tutorial here.

I will give credit when requested!

This is the location of the battle effect:

0FE4B9

ShinypikachuX April 11th, 2019 8:24 AM

I have a great idea for fire red I was thinking of in game player name change like to set the player name to a predefined name.
For example if the player name is David by setflag or setvar it could be changed to Mike I.e.,name decided by the hacker.
Sorry if this is too complicated and thanks in advance.

ghoulslash April 12th, 2019 6:26 AM

Quote:

Originally Posted by ShinypikachuX (Post 10004838)
I have a great idea for fire red I was thinking of in game player name change like to set the player name to a predefined name.
For example if the player name is David by setflag or setvar it could be changed to Mike I.e.,name decided by the hacker.
Sorry if this is too complicated and thanks in advance.

The player's name can be changed from the overworld via callasm 0x809FC91

I have a pretty old routine I wrote to change the OT name of your pokemon to the new name based on matching OTIDs, so traded pokemon will retain their OT names. Note that I wrote it a while ago so there may be bugs

Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func
.global ChangePokeNames
/*
Function to change all pokemon OT names to the players new name (unless IDs dont match aka traded pokemon)

Inputs:
        -none
Outputs:
        -none

Usage:
        callasm 0x809FC91  //rename player
        waitstate
        callasm [this_routine]+1
*/

Start:
        push {r0-r7, lr}

ChangePartyNames:
        ldr r7, .PartyPoke
        mov r6, #0x64
        mov r5, #0x5
        bl NameChanges

ChangeBoxNames:
        ldr r7, .BoxDMA
        ldr r7, [r7]
        add r7, #0x4
        mov r6, #0x50
        mov r5, #0x69
        lsl r5, r5, #0x2                @420 box pokemon total
        bl NameChanges

Exit:
        pop {r0-r7, pc}

/*
Name Change Call Function
        r5 = num pokes to check
        r6 = data size per poke
        r7 = start address
*/
NameChanges:
        push {lr}
        mov r4, #0x0       

OuterLoop:
        mov r0, r4
        mul r0, r6

GetPokeDataLoc:
        add r0, r0, r7
        ldrh r1, [r0, #0x4]       

GetPlayerID:
        ldr r2, .Saveblock
        ldr r3, [r2]
        ldrh r2, [r3, #0xA]       

CompareIDs:
        cmp r1, r2
        bne OuterLoopRestart                @OTIDs do not match -> no name change

PrepInnerLoop:
        add r0, #0x14
        mov r2, #0x0       

charLoop:
        ldrb r1, [r3]
        strb r1, [r0]
        cmp r2, #0x6                @7 bytes for OT name
        beq OuterLoopRestart
        add r3, #0x1
        add r0, #0x1
        add r2, #0x1
        b charLoop

OuterLoopRestart:
        cmp r4, r5
        beq Return
        add r4, #0x1
        b OuterLoop

Return:
        pop {r0}
        bx r0

.align 2
.PartyPoke:        .word 0x02024284
.Saveblock:        .word 0x0300500C
.BoxDMA:        .word 0x03005010



mattymannnn April 17th, 2019 9:28 AM

Does anyone know of a routine that blocks the user from releasing certain species of pokemon?

Super Versekr Dark April 17th, 2019 2:41 PM

Quote:

Originally Posted by Chacha Dinosaur (Post 8786554)
EV-enhancing items (Power Items)


Spoiler:


The routine now does not require any new Held Effect Item Byte. The new power items are tied to Macho Brace's Held Item Effect Byte. (Thanks to MrDollSteak for giving the idea.)
The type of EV gain is now differentiated by the Second Held Effect Byte (the byte just after the Primary Held Effect Byte in the Item Table).
There is no need to code the Speed Drop explicitly for Power Items.

Usage is now like this by using the following parameters in the Item Table:
Primary Byte | Secondary Byte | Item Name
0x18 | 0x0 | Macho Brace
0x18 | 0x1 | Power Weight
0x18 | 0x2 | Power Bracer
0x18 | 0x3 | Power Belt
0x18 | 0x4 | Power Anklet
0x18 | 0x5 | Power Lens
0x18 | 0x6 | Power Band

Also, there are additional byte changes mentioned in the Spoiler to limit the EVs for each stat from 255 to 252 to avoid wastage of EVs by normal battling.

Fire Red:-
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

Main:
    push {r2}
    mov r0, r8  /*Load pokemon slot no*/
    mov r1, #0xC
    mov r2, #0x0
    bl Decrypter /* Load pokemon's item */
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    pop {r2} /* Restore Pokerus Factor*/
    cmp r0, #0xAF
    beq EnigmaBerry
    add r3, r0, #0x0
    bl GetItemEffect /* Get Held Item's Effect Byte*/
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #0x18
    bne NoPowerItem
    add r0, r3, #0x0
    bl GetSecondEffectByte
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #0x0
    beq MachoBrace
    add r1, r6, #0x1 /*Load a Power Item's Secondary Effect Byte*/
    cmp r1, r0 /*Match items*/
    bne NoPowerItem /*No Power Item or No Match for that particular stat*/
    lsl r2, r2, #0x2
    add r4, r4, r2 /* Add 4 EVs or 8 (due to Pokerus) */
NoPowerItem:
    ldr r3, =0x080439D9
    bx r3

EnigmaBerry:
    ldr r3, =0x0804398F
    bx r3

MachoBrace:
    ldr r3, =0x080439D5
    bx r3

Decrypter:
    ldr r3, =0x0803FBE9
    bx r3

GetItemEffect:
    ldr r1, =0x0809A925
    bx r1

GetSecondEffectByte:
    ldr r1, =0x0809A949
    bx r1

/*At 43978: 04 1C 54 43 00 49 08 47 XX+1 XX XX 08 00 00 00 00 00 00 00 00 00 00*/
/*At 439FC && 43A02: FC to limit EV growth for each stat to 252 */




Emerald:-
Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func

Main:
    push {r2}
    mov r0, r8  /*Load pokemon slot no*/
    mov r1, #0xC
    mov r2, #0x0
    bl Decrypter /* Load pokemon's item */
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    pop {r2} /* Restore Pokerus Factor*/
    cmp r0, #0xAF
    beq EnigmaBerry
    add r3, r0, #0x0
    bl GetItemEffect /* Get Held Item's Effect Byte*/
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #0x18
    bne NoPowerItem
    add r0, r3, #0x0
    bl GetSecondEffectByte
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #0x0
    beq MachoBrace
    add r1, r6, #0x1 /*Load a Power Item's Secondary Effect Byte*/
    cmp r1, r0 /*Match items*/
    bne NoPowerItem /*No Power Item or No Match for that particular stat*/
    lsl r2, r2, #0x2
    add r4, r4, r2 /* Add 4 EVs or 8 (due to Pokerus) */
NoPowerItem:
    ldr r3, =0x0806DC25
    bx r3

EnigmaBerry:
    ldr r3, =0x0806DBDB
    bx r3

MachoBrace:
    ldr r3, =0x0806DC21
    bx r3

Decrypter:
    ldr r3, =0x0806A519
    bx r3

GetItemEffect:
    ldr r1, =0x080D74DD
    bx r1

GetSecondEffectByte:
    ldr r1, =0x080D7501
    bx r1

/*At 6DBC4: 04 1C 54 43 00 49 08 47 XX+1 XX XX 08 00 00 00 00 00 00 00 00 00 00*/
/*At 6DC48 && 6DC4E: FC to limit EV growth for each stat to 252 */





For Ruby:

Spoiler:
.text
.align 2
.thumb
.thumb_func

Main:
push {r2}
mov r0, r8 /*Load pokemon slot no*/
mov r1, #0xC
mov r2, #0x0
bl Decrypter /* Load pokemon's item */
lsl r0, r0, #0x10
lsr r0, r0, #0x10
pop {r2} /* Restore Pokerus Factor*/
cmp r0, #0xAF
beq EnigmaBerry
add r3, r0, #0x0
bl GetItemEffect /* Get Held Item's Effect Byte*/
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0x18
bne NoPowerItem
add r0, r3, #0x0
bl GetSecondEffectByte
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0x0
beq MachoBrace
add r1, r6, #0x1 /*Load a Power Item's Secondary Effect Byte*/
cmp r1, r0 /*Match items*/
bne NoPowerItem /*No Power Item or No Match for that particular stat*/
lsl r2, r2, #0x2
add r4, r4, r2 /* Add 4 EVs or 8 (due to Pokerus) */
NoPowerItem:
ldr r3, =0x0803FFB9
bx r3

EnigmaBerry:
ldr r3, =0x0803FF6F
bx r3

MachoBrace:
ldr r3, =0x0803FFB5
bx r3

Decrypter:
ldr r3, =0x0803CB61
bx r3

GetItemEffect:
ldr r1, =0x080A993D
bx r1

GetSecondEffectByte:
ldr r1, =0x080A9961
bx r1

/*At 3FF58: 04 1C 54 43 00 49 08 47 XX+1 XX XX 08 00 00 00 00 00 00 00 00 00 00*/
/*At 3FFDC && 3FFE2: FC to limit EV growth for each stat to 252 */

ShinypikachuX April 18th, 2019 9:52 AM

Quote:

Originally Posted by ghoulslash (Post 10005286)
The player's name can be changed from the overworld via callasm 0x809FC91

I have a pretty old routine I wrote to change the OT name of your pokemon to the new name based on matching OTIDs, so traded pokemon will retain their OT names. Note that I wrote it a while ago so there may be bugs

Spoiler:

Code:

.text
.align 2
.thumb
.thumb_func
.global ChangePokeNames
/*
Function to change all pokemon OT names to the players new name (unless IDs dont match aka traded pokemon)

Inputs:
        -none
Outputs:
        -none

Usage:
        callasm 0x809FC91  //rename player
        waitstate
        callasm [this_routine]+1
*/

Start:
        push {r0-r7, lr}

ChangePartyNames:
        ldr r7, .PartyPoke
        mov r6, #0x64
        mov r5, #0x5
        bl NameChanges

ChangeBoxNames:
        ldr r7, .BoxDMA
        ldr r7, [r7]
        add r7, #0x4
        mov r6, #0x50
        mov r5, #0x69
        lsl r5, r5, #0x2                @420 box pokemon total
        bl NameChanges

Exit:
        pop {r0-r7, pc}

/*
Name Change Call Function
        r5 = num pokes to check
        r6 = data size per poke
        r7 = start address
*/
NameChanges:
        push {lr}
        mov r4, #0x0       

OuterLoop:
        mov r0, r4
        mul r0, r6

GetPokeDataLoc:
        add r0, r0, r7
        ldrh r1, [r0, #0x4]       

GetPlayerID:
        ldr r2, .Saveblock
        ldr r3, [r2]
        ldrh r2, [r3, #0xA]       

CompareIDs:
        cmp r1, r2
        bne OuterLoopRestart                @OTIDs do not match -> no name change

PrepInnerLoop:
        add r0, #0x14
        mov r2, #0x0       

charLoop:
        ldrb r1, [r3]
        strb r1, [r0]
        cmp r2, #0x6                @7 bytes for OT name
        beq OuterLoopRestart
        add r3, #0x1
        add r0, #0x1
        add r2, #0x1
        b charLoop

OuterLoopRestart:
        cmp r4, r5
        beq Return
        add r4, #0x1
        b OuterLoop

Return:
        pop {r0}
        bx r0

.align 2
.PartyPoke:        .word 0x02024284
.Saveblock:        .word 0x0300500C
.BoxDMA:        .word 0x03005010



No no I want to set player name to another one without any freedom to player, so I decide the name not the player.
But thanks anyways.
By the way can you help me I'm stuck with the random trainer id and secret id generator routine it won't compile for me please help.

kevvic April 24th, 2019 1:52 AM

Quote:

Originally Posted by Lunos (Post 9972821)
I
EDIT:

I was testing this routine out just now, and I'm not entirely sure if it's working correctly.
It looks to me like the Eggs are inheriting 3 stats alone, when they should always inherit 5 stats :/
I've been doing tests using this routine and XXXX.

In my last attempt for example, the results of the Egg were:
-03 HP IVs. Charmander has 30 and Ditto 26.
-03 Atk IVs inherited from Charmander.
-22 Def IVs inherited from Charmander or Ditto (both have 22 Def IVs.)
-23 Spd IVs. Charmander has 31 and Ditto 25.
-19 SpAtk IVs. Charmander has 31 and Ditto 10.
-31 SpDef IVs inherited from Ditto.

If we assume that HP is the random stat in this spread, Spd and SpAtk are the issue here.
The Egg should have inherited Charmander's or Ditto's values in those stats after all, right?
Has anyone tested this yet?

I did, I checked IV with the IV display summary screen routines. I edited the save so both parents have 31 IV in all stats, yet the child only have 3 stats with 31 IV.

Also for some reasons, sometimes if I give the destiny knot to the other parent or to both it crash when I talk to get the eggs. Did you figure it out?

ghoulslash April 25th, 2019 11:33 AM

Quote:

Originally Posted by ShinypikachuX (Post 10007751)
No no I want to set player name to another one without any freedom to player, so I decide the name not the player.
But thanks anyways.
By the way can you help me I'm stuck with the random trainer id and secret id generator routine it won't compile for me please help.

Actually, that's much easier. This will let you load a new player name into loadpointer 0x0 and then force the change. Make sure the player's name is 7 characters or less or else it will fail.
Spoiler:

Code:

.text
.align 2
.thumb
.global NewPlayerName
/*
usage:
        loadpointer 0x0 @name
        callasm [this_routine+1]
*/

Main:
        push {r0-r4, lr}
        ldr r0, .loadPointer
        ldr r0, [r0]    @string pointer
        mov r4, r0
        bl StringLength
        cmp r0, #0x7
        bgt Exit
        ldr r0, .TrainerDMA
        ldr r0, [r0]        @dest
        mov r1, r4                @src
        bl StringCopy
Exit:
        pop {r0-r4, pc}

StringLength:
        ldr r1, =(0x8008E08|1)
        bx r1

StringCopy:
        ldr r2, =(0x8008D84|1)
        bx r2

.align 2
.loadPointer: .word 0x03000f14
.TrainerDMA: .word 0x0300500c




eg. if I insert the above at 0x990000, then in XSE I could do the following to force the player's name to be Fred.
Code:

#dynamic 0x800000
#org @start
lock
faceplayer
loadpointer 0x0 @name
callasm 0x8990001
msgbox @newName 0x6
release
end
#org @name
= Fred
#org @newName
= Your new name is [player]!


Quote:

By the way can you help me I'm stuck with the random trainer id and secret id generator routine it won't compile for me please help.
I'm not sure what routine you're talking about, sorry :/

ShinypikachuX April 26th, 2019 10:57 AM

Quote:

Originally Posted by ghoulslash (Post 10010682)
Actually, that's much easier. This will let you load a new player name into loadpointer 0x0 and then force the change. Make sure the player's name is 7 characters or less or else it will fail.
Spoiler:

Code:

.text
.align 2
.thumb
.global NewPlayerName
/*
usage:
        loadpointer 0x0 @name
        callasm [this_routine+1]
*/

Main:
        push {r0-r4, lr}
        ldr r0, .loadPointer
        mov r4, r0
        bl StringLength
        cmp r0, #0x7
        bgt Exit
        ldr r0, .TrainerDMA
        ldr r0, [r0]        @dest
        mov r1, r4                @src
        bl StringCopy
Exit:
        pop {r0-r4, pc}

StringLength:
        ldr r1, =(0x8008E08|1)
        bx r1

StringCopy:
        ldr r2, =(0x8008D84|1)
        bx r2

.align 2
.loadPointer: .word 0x03000f14
.TrainerDMA: .word 0x0300500c




eg. if I insert the above at 0x990000, then in XSE I could do the following to force the player's name to be Fred.
Code:

#dynamic 0x800000
#org @start
lock
faceplayer
loadpointer 0x0 @name
callasm 0x8990001
msgbox @newName 0x6
release
end
#org @name
= Fred
#org @newName
= Your new name is [player]!



I'm not sure what routine you're talking about, sorry :/

Thanks for this quick response and for the routine not tried it yet though.
The routine I was talking about is this http://www.pokecommunity.com/showpost.php?p=8536952&postcount=333

TheWolfProd April 26th, 2019 12:30 PM

Quote:

Originally Posted by ghoulslash (Post 10010682)
Actually, that's much easier. This will let you load a new player name into loadpointer 0x0 and then force the change. Make sure the player's name is 7 characters or less or else it will fail.
Spoiler:

Code:

.text
.align 2
.thumb
.global NewPlayerName
/*
usage:
        loadpointer 0x0 @name
        callasm [this_routine+1]
*/

Main:
        push {r0-r4, lr}
        ldr r0, .loadPointer
        mov r4, r0
        bl StringLength
        cmp r0, #0x7
        bgt Exit
        ldr r0, .TrainerDMA
        ldr r0, [r0]        @dest
        mov r1, r4                @src
        bl StringCopy
Exit:
        pop {r0-r4, pc}

StringLength:
        ldr r1, =(0x8008E08|1)
        bx r1

StringCopy:
        ldr r2, =(0x8008D84|1)
        bx r2

.align 2
.loadPointer: .word 0x03000f14
.TrainerDMA: .word 0x0300500c




eg. if I insert the above at 0x990000, then in XSE I could do the following to force the player's name to be Fred.
Code:

#dynamic 0x800000
#org @start
lock
faceplayer
loadpointer 0x0 @name
callasm 0x8990001
msgbox @newName 0x6
release
end
#org @name
= Fred
#org @newName
= Your new name is [player]!



I'm not sure what routine you're talking about, sorry :/

I tried running this script with the same offsets in FireRed but when I go to speak to the NPC i assigned the script to the game freezes. Is there something I could've missed? I compiled the ASM, assigned the correct offsets in the hex editior. Thankyou:)

ShinypikachuX April 28th, 2019 5:10 AM

Someone help like all the asm routine I compile won't work for some god damn reason someone reply if you know how to fix this and if you post a compiler which works for you it would be more helpful.

Diego98 May 13th, 2019 11:23 AM

Quote:

Originally Posted by Koople (Post 9924710)
Side Quest Menu [FR]

This hack converts the PC item storage menu into a side quest menu, or task list, etc.

Here is the repository, the compilation instructions are included in the readme. You will need to define your own parameters/ram in src/headers/defs.asm and create your own tables of string pointers for all of the quest names, descriptions, item images, and quest details. I kept the item image part to allow hackers to include items that might be symbolic of their quest, eg. a scroll or key or pokeball.

To use in a script (XSE)
Code:

writebytetooffset 0x1 <your questflag ram in src/headers/defs.asm>
fadescreen 0x1
callasm 0x80EBCD9
waitstate


Enjoy! And please let me know of any bugs.

I'm trying to build that but I'm getting an error code:
Code:

arm-none-eabi-as -mthumb -c src/quest_select_msg.asm -o build/src/quest_select_msg.o
make: arm-none-eabi-as: Command not found
make: *** [makefile:17: build/src/quest_select_msg.o] Error 127


I built lots of other things but never got this error. What should I do?

EDIT: Ok, forgot it. It was a typing mistake on my system path to the DevkitARM bin folder.


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.