• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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: Trainers with EVs

1
Posts
6
Years
  • Age 27
  • Seen May 17, 2019
Hello. :]

I can't seem to get this to work on my own, so I thought, maybe somebody could help me figure out, what I'm doing wrong...

I wanted to implement this into FireRed, so I took the ASM in the OP and assembled it into a .bin file.
I left the ASM unedited, didn't change any values. (I tried this with unedited version of both FireRed and LeafGreen v 1.0)

Then, after reading through this thread I came to the conclusion, that I have to change the values at 0x115f6, 0x1162c, 0x3dc70 and 0xf90000 by replacing the HEX in the ROM with the HEX in the assembled .bin file at those values. The copied HEX-values are identical to those I found in the posts in this thread.

So I changed
0x115f6 to:
Spoiler:


0x1162c to:
Spoiler:


0x3dc70 to:
Spoiler:


and 0xf90000 to: (Note that I entered it HEX. The conversion to DEC is just from copy-pasting it in here)
Spoiler:


Additionally I changed the values starting at 0xf00000 to create my custom Ev spread table.
I started by adding the two first entries to test if i it's working.
So I changed 0xf00000 to:
Spoiler:


(Maybe that's too few entries to work with for the game?)

So i would assign a trainerbattle to an NPC through AdvanceMap and XSE and change the Pokemon possessed by that trainer with A-Trainer by changing the Pokemon to the Custom Item/Custom Attacks category and setting their AI-Value to 0 and 1 respectively to use both my custom spreads.

Now either this is not the correct way to implement this function and I'm missing some important steps or I executed the steps wrong...
Whenever any Pokemon would be encountered in game, be it via Trainerbattle, a wild encounter or er recieving a Pokemon from an NPC (your starter for example) the game stops working.
So i guess it cant generate any Pokemon properly with my setup and I must have made a mistake, maybe in repointing some of these 0x...


I would appreciate any help you can give me and I would be very thankful for ideas and tips you have for me. :]
 
82
Posts
6
Years
If you are using jpan's hacked tool for the set level trainer, follow this! I just got this working.

Assemble asm and put it into your rom. For noobs, make sure to copy the data from these offsets in the .bin file.
115f6
1162c
3dc70

Once that is in, it still wont work. Follow Akamethebulbasaurs guide and it will work. I used the hack tool so the offsets were different. My offset was at 7999A0 so i say check that first. You can ctrl + F and search for "03 4E 30 47" but be careful. There are 2 locations that have those hex values and both have "01 4E 30 47" after. The only way to tell which is which is one offset will have a 5 byte gap between to the hex values. You want the offset that has 4 bytes between the hex values.

Thank you DoesntKnowHowToPlay and Akamethebulbasaur!
 
12
Posts
7
Years
  • Age 30
  • Seen Apr 2, 2024
I almost got everything working in the spread (Ivs, Evs, and Pokeballs). "Almost" because I can't seem to get some Natures working.
Here's how I found out in my Firered hack: I gave Blaine (Cinnabar's Gym Leader) a level 70 Ninetales with 31 IVs and 252 EVs in Speed and Sp. Attack with a Timid Nature.

This is the EV spread in the Hex Editor: 0A 00 00 00 1F 04 00 00 FC FC 00 04 00 00 00 00

Using an IV calculator (on Serebii.net) with the EVs and Nature, its Speed came up as 231.
Now comes my Salamence, Level 70, 17 IVs, and 252 Evs in Speed with Jolly Nature. Speed is 221.

My Salamence VS Ninetales: Salamence goes first. ??? :confused:
Now my Modest Gardevoir, who's Speed is 184 at Level 72, gets outspeed by Ninetales.

It seems as if Ninetales' Nature was treated as Bashful, Serious, Docile, or Hardy (These don't change stats).
It's real Speed is 210.

I tried giving it a different Nature so with Modest , it did more damage with Fire Blast.
So something is up with the Speed Natures.


*Never mind all of this. I updated my Rom with Leon's Ultimate FireRed Patch. No Speed problems.*
 
Last edited:
10
Posts
4
Years
Hello, sorry if I'm bumping an old thread, there is something I don't understand, hope someone can help me.

This phrase: "To assign an EV spread to a trainer's pokemon, set the value that was formerly their IVs to which slot in the table you want that pokemon to use"
I completely don't understand it, what does that mean? On A-Trainer the AI Value (which was formerly used for IV spreading if I'm not wrong) is just one value, how do I Handle the entirety of this structure after implementing this ASM routine?

For example, how do I set the first Pokemon of a determined trainer to have X amount of IVs, Y amount of EVs, Z Nature, and a Master Ball as shown Pokeball?

Thanks for the answers.


Edit: Nevermind, I got it, for anyone who had the same problem as me: The EV Table (the one the OP used by default at EF0000) is empty at first, you gotta fill it, so each row becomes a whole EV table that handles all those things.

If you write 3 different EV table rows and want to assign the 2nd one to a trainer, just write 2 in the A-Trainer AI Value, which formerly handled IV Spreads only, and now communicates with said table.

Edit n.2:

Code:
asm:

.Method_Addr: .word 0x08F90001
.EV_Table: .word 0x08EF0000


hex on rom:
00EF0000:

03 00 00 00 1F FF FF FF FF FF FF 01 00 00 00 00 -> Adamant Nature, 31 IV, 1530 EV, Master Ball.


00F90000: 

06 35 20 1C 0C 21 2A 1C 00 F0 61 F8 30 01 34 4A 12 18 05 32 1A 21 20 1C 00 F0 59 F8 30 01 30 4A 12 18 06 32 1B 21 20 1C 00 F0 51 F8 30 01 2C 4A 12 18 07 32 1C 21 20 1C 00 F0 49 F8 30 01 28 4A 12 18 08 32 1D 21 20 1C 00 F0 41 F8 30 01 24 4A 12 18 09 32 1E 21 20 1C 00 F0 39 F8 30 01 20 4A 12 18 0A 32 1F 21 20 1C 00 F0 31 F8 30 01 1C 4A 12 18 0B 32 26 21 20 1C 00 F0 29 F8 30 01 18 4A 12 18 15 78 00 2D 0F D0 20 68 61 68 41 40 61 60 20 68 18 30 20 60 19 21 00 F0 1E F8 A8 42 F7 D1 20 68 61 68 41 40 61 60 30 01 0D 4A 12 18 16 79 40 B4 27 25 20 1C 29 1C 6A 46 00 F0 08 F8 01 35 2D 2D F7 D1 40 BC 00 F0 04 F8 04 49 08 47 05 4B 18 47 20 1C 04 49 08 47 04 4B 18 47 79 89 03 08 00 00 EF 08 AD AC 06 08 0D 8D 06 08 E1 7B 2E 08

I've put everything correctly in the ROM, and assigned 1 to the enemy Pokemon's AI Value so it gets that row, so the enemy should send out a Pokemon with those stats and a Masterball, but it's still a normal Pokeball, and I'm not noticing a power improvement. I think I didn't do it correctly or missed out something, can someone help?
 
Last edited:
61
Posts
10
Years
  • Age 28
  • Seen Feb 3, 2024
I've put everything correctly in the ROM, and assigned 1 to the enemy Pokemon's AI Value so it gets that row, so the enemy should send out a Pokemon with those stats and a Masterball, but it's still a normal Pokeball, and I'm not noticing a power improvement. I think I didn't do it correctly or missed out something, can someone help?

I am going to assume you have atleast put the Asm and the table correctly ,

Well about the part how you actually give that ev / ivs / nature to a trainer pokemon ,

Don't use the first entry its 0 , the second entry in the table is 1 to use that in " hopeless trainer editor " pick a trainer pokemon give it a custom moveset and a held item ( it can be nothing but you have to set it as " ?????? ")
in the evs box of that pokemon put 1.
 

Dr. Seuss

Will finish GS Chronicles, I swear!
523
Posts
10
Years
I have a question.

How do you hook the routine to the game?
These are automatically generated at the moment you compile the code. If you open the .bin resultant, you'll notice a bunch of 00, you just need to go to the addresses 0x115f6, 0x1162c, 0x3dc70 and the address you specified for the EV table from the .bin file, copy the bytes in there and paste them in the same addresses form your ROM
 
81
Posts
7
Years
  • Age 30
  • Seen yesterday
Ruby:

Spoiler:
 
135
Posts
3
Years
  • Age 33
  • Seen Mar 26, 2024
I see a lot of talk about how to make hacks "difficult". The typical solutions are to:

-give trainers teams full of legendaries
-make the level curve absurdly steep
-inflate the base stats of everything
-give the AI illegal moves and custom attacks with absurd BP
-make every dungeon a flash maze where you can't use flash

Because I hate everyone who plays romhacks for fun am a nice person, I've decided to release a bit of code that gives us another option- letting trainer pokemon have custom EVs. Normally, trainer pokemon have 0 EVs in every stat outside of the RSE Battle Tower/Frontier.

First you will need to insert this ASM:

Fire Red:
Spoiler:

Emerald:
Spoiler:

The bulk of this code is at xF90000- that part doesn't have to go there, it can be moved to wherever you have free space. Just make sure you change Method_Addr to whatever you change the offset to + 1.

You will also need to find x1000 bytes of space, and change the .EV_Table variable in the method to point to it (I used xF00000). This is where the spreads will go. The method gives you 256 spreads to use- this is not full control, but it is more than you are likely to need (the Emerald Battle Frontier only uses around 36 IIRC). The EV Spread table format is:

- Nature
- 3 unused bytes
- HP EV
- Attack EV
- Defense EV
- Speed EV
- Special Attack EV
- Special Defense EV
- What pokeball the mon comes out in
- 4 more unused bytes (I may update the method later to do something with these)

To assign an EV spread to a trainer's pokemon, set the value that was formerly their IVs to which slot in the table you want that pokemon to use. If you are using A-Trainer, this value is erroneously marked as AI Value. Note that the method only works for trainers with custom movesets and items- if they use default movesets or items, it will only affect IVs. It will still work if you manually give the trainer the moves it would have by default or explicitly define their mons as being empty-handed though.

This hack now allows custom natures. The natures are enumerated like so:
x0 - Arbitrary
x1 - Lonely (+Atk, -Def)
x2 - Brave (+Atk, -Speed)
x3 - Adamant (+Atk, -SpAtk)
x4 - Naughty (+Atk, -SpDef)
x5 - Bold (+Def, -Atk)
x6 - Docile (Neutral)
x7 - Relaxed (+Def, -Speed)
x8 - Impish (+Def, -SpAtk)
x9 - Lax (+Def, -SpDef)
xA - Timid (+Speed, -Atk)
xB - Hasty (+Speed, -Def)
xC - Serious (Neutral)
xD - Jolly (+Speed, -SpAtk)
xE - Naive (+Speed, -SpDef)
xF - Modest (+SpAtk, -Atk)
x10 - Mild (+SpAtk, -Def)
x11 - Quiet (+SpAtk, -Speed)
x12 - Bashful (Neutral)
x13 - Rash (+SpAtk, -SpDef)
x14 - Calm (+SpDef, -Atk)
x15 - Gentle (+SpDef, -Def)
x16 - Sassy (+SpDef, -Speed)
x17 - Careful (+SpDef, -SpAtk)
x18 - Quirky (Neutral)

Hardy is unavailable due to the way the method works, but that doesn't really matter since it's neutral. Higher values will crash the game. If 0 is used, the method does not touch nature, so it will be determined semi-randomly like normally.

It is worth nothing that this method allows you to give trainer pokemon more than 510 EVs if you are feeling exceptionally rude.

I know this is a very old thread, but I'm having trouble implementing it into Pokémon emerald. The trainer battles cause the game to reset!
I copied the offsets that don't have 00s from the bin file into the same offsets as my Pokémon emerald ROM
unknown.png

Offsets 0x38936, 0x3896d, and 0x67d68.
Here are what the hex numbers look in my ROM:
Spoiler:

Did I have to paste the extra code from the bin into different offsets?
Also, I put the bulk of the code from the bin into 0xf90000, and started pointing my EV spreads into 0xf00000
 
8
Posts
3
Years
  • Age 26
  • Seen Mar 1, 2024
I know this is a very old thread, but I'm having trouble implementing it into Pokémon emerald. The trainer battles cause the game to reset!
I copied the offsets that don't have 00s from the bin file into the same offsets as my Pokémon emerald ROM
unknown.png

Offsets 0x38936, 0x3896d, and 0x67d68.
Here are what the hex numbers look in my ROM:
Spoiler:

Did I have to paste the extra code from the bin into different offsets?
Also, I put the bulk of the code from the bin into 0xf90000, and started pointing my EV spreads into 0xf00000

I had the same issue. Note that the code at 0x1162C includes two leading 00s.
b71dead173a1ec00aeef8d502ccd3d92.png
 
135
Posts
3
Years
  • Age 33
  • Seen Mar 26, 2024
How I fixed it was comparing the 00 bytes in various locations with Pokémon Emerald Omega. That game has trainers with EVs on their Pokémon, so I just checked the offsets that I already changed bytes in and put the 00 bytes in the proper places.
 

Akiak

dreamin'
86
Posts
10
Years
  • Age 28
  • Seen Apr 10, 2024
Hi, I'm interested in implementing this, but only the ability part. I have no plans to insert custom EV spreads or natures. I just want to be able to pick between the two abilities.

Could anyone help me with this? I feel like I should try to trim out all the other stuff so as to not take up unnecessary space, but I have no ASM writing experience so I don't really know what I'm doing. If anyone could help that'd be awesome.

EDIT: actually I don't even want to be able to pick between the two abilities, I just want them to be random (like Natures and IVs in vanilla). If there's a way to implement that, that'd be awesome. If not, then being able to pick also works for my purposes.
 
Last edited:
Back
Top