• 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: ASM Resource Thread

anonyboy

Pokemon Aerial Emerald Creator&Pokemon Hybrid Co-C
286
Posts
10
Years
hi, i have problems with the EV berries script.... always reboots the ROM even when i set the asm offset to +1 since it's thumb.... please help..
 

Blah

Free supporter
1,924
Posts
11
Years
hi, i have problems with the EV berries script.... always reboots the ROM even when i set the asm offset to +1 since it's thumb.... please help..

My apologies, the code I posted before would crash on the case that the player's Pokemon's EVs would go negative. I've changed it now, if the berry doesn't effect the Pokemon it's used on, it will return 0xFF to lastresult.
 
200
Posts
10
Years
  • Age 30
  • Seen Jun 19, 2022
Oooh, your storage system was exactly what I wanted for making a 'leader of a team' (like Rocket/Magma) hack / any hack where you have a team larger than 6 / any hack where you play as more than one person. However, I have just one question.

Can I manually set the experience gained in the counter variable so I can alter the pokemon stored to the levels I want? It would be a pain, but I could do a check for instance to see what level the rest of your party is, what level the stored pokemon are, and then alter the EXP variable accordingly, and it would be like they were genuinely part of your party, sorta. I mean, it would be a little clumsy - the best version would be to check the EXP and set that to exactly the parties' (I didn't check your stat checker program yet; if that does EXP checking then epic! and with a little math would solve that neatly)- but it would be pretty dang cool.

Also, if I made said script (I prolly will), would you like me to post it here as an example for other people?
 

Blah

Free supporter
1,924
Posts
11
Years
Oooh, your storage system was exactly what I wanted for making a 'leader of a team' (like Rocket/Magma) hack / any hack where you have a team larger than 6 / any hack where you play as more than one person. However, I have just one question.

Can I manually set the experience gained in the counter variable so I can alter the pokemon stored to the levels I want? It would be a pain, but I could do a check for instance to see what level the rest of your party is, what level the stored pokemon are, and then alter the EXP variable accordingly, and it would be like they were genuinely part of your party, sorta. I mean, it would be a little clumsy - the best version would be to check the EXP and set that to exactly the parties' (I didn't check your stat checker program yet; if that does EXP checking then epic! and with a little math would solve that neatly)- but it would be pretty dang cool.

Also, if I made said script (I prolly will), would you like me to post it here as an example for other people?

The experience gained is based on a step counter. Like the current daycare system, it's represents 1 exp per step.
It is located at : 0x203BFFD
Format: [(1 byte) # of steps] [(2 bytes) number of times first byte hit 0xFF]
The second portion is incremented when the first portion is at 0xFF. So if you wanted to set your own amount of experience, setting the value at 0x203BFFE would be the best way to do it.

Luckily for you, my EXP adding routine adds to exp rather than setting, so you can just modify the amount it adds to the exp to achieve that goal.

In a script that would be:
setvar LASTRESULT 0x[exp to give] 'remember this value is multiplied by 0xFF in calculation
copybyte 0x203BFFE 0x20370D0' this copies 1 byte at a time, length of variables are 2 and so it this counter
copybyte 0x203BFFF 0x20370D1
callasm 0x[Exp setting routine]

If you can create a completed script, yeah, that would be awesome.
 
416
Posts
11
Years
  • Age 35
  • Seen Feb 10, 2024
How bout an item that can capture a trainers pokemon, like a "Team Rocket Ball"... but no other balls will do it...

I was thinking use the capture trainers pokemon hack, then hack the trainers routine so it always sets var 0x8000 to 0x1, then during the capture script of this specific item, itll change 0x8000 to 0x0...

and of course at the end of any trainer battle, 0x8000 goes back to 0x0 so wild pokemon can still be caught...

problem is, i dont know where the trainer battle script it, or how to write pokeball scripts...
 

Blah

Free supporter
1,924
Posts
11
Years
How bout an item that can capture a trainers pokemon, like a "Team Rocket Ball"... but no other balls will do it...

I was thinking use the capture trainers pokemon hack, then hack the trainers routine so it always sets var 0x8000 to 0x1, then during the capture script of this specific item, itll change 0x8000 to 0x0...

and of course at the end of any trainer battle, 0x8000 goes back to 0x0 so wild pokemon can still be caught...

problem is, i dont know where the trainer battle script it, or how to write pokeball scripts...

Hmm, I've been asked to do this before and it's quite the common request. However, it's so easy and straight forward, I'm always left wondering why people don't do it themselves. Then I remember, even if it's easy for me, I guess it's not as easy if you don't know what to do :P

Trainer Capture toggle by Pokeball


Before I begin, if you want to learn how to make your own Pokeball, look at danillS work over here: http://www.pokecommunity.com/showthread.php?t=326311

What this does right now, if check if the thrown Pokeball is a masterball. If it is, allow capture. If it's not a masterball then the normal "trainer has blocked the ball" will occur. To change which ball toggles the capture look at my comments in the code and change 0x1 - masterball to something else of your choice.
Spoiler:


How to insert:
Compile and insert the following routine into freespace:
Spoiler:


Now navigate to 0x2D498 and insert the following:
Code:
 00 48 00 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer +1 of where you inserted the routine.

Usage:
No usage! It's all done with the power of ASMAGIX!
 
416
Posts
11
Years
  • Age 35
  • Seen Feb 10, 2024
Hmm, I've been asked to do this before and it's quite the common request. However, it's so easy and straight forward, I'm always left wondering why people don't do it themselves. Then I remember, even if it's easy for me, I guess it's not as easy if you don't know what to do :P

Trainer Capture toggle by Pokeball


Before I begin, if you want to learn how to make your own Pokeball, look at danillS work over here: http://www.pokecommunity.com/showthread.php?t=326311

What this does right now, if check if the thrown Pokeball is a masterball. If it is, allow capture. If it's not a masterball then the normal "trainer has blocked the ball" will occur. To change which ball toggles the capture look at my comments in the code and change 0x1 - masterball to something else of your choice.
Spoiler:


How to insert:
Compile and insert the following routine into freespace:
Spoiler:


Now navigate to 0x2D498 and insert the following:
Code:
 00 48 00 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer +1 of where you inserted the routine.

Usage:
No usage! It's all done with the power of ASMAGIX!

you sir, rock my sox off... I really should learn ASM...
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
The reason why Im active here is because your thread, and since I have Compiler now, Ill be able to test all your routines, and about the one who posted the routine for when the player losses to battle, the game restarts, I really like it!

Trainers Pokemon-Players Pokemon
A routine for a Trainers pokemon party is same in your Pokemon Party including the level.
 
31
Posts
14
Years
  • Seen Aug 2, 2015
Hey in my team rocket hack of fire red I want Jessie and James to be main characters and I don't wanna be able to pick a name o just want Jessie to be default name if u pick Jessie and James to be default name if u play as James. If u could help with this that'd be greatly appreciated thanks
 
416
Posts
11
Years
  • Age 35
  • Seen Feb 10, 2024
Hey in my team rocket hack of fire red I want Jessie and James to be main characters and I don't wanna be able to pick a name o just want Jessie to be default name if u pick Jessie and James to be default name if u play as James. If u could help with this that'd be greatly appreciated thanks

This is quite easy with a script... early on in the game (before your name is mentioned) just manually set the value of \v\h01 to "JAMES" If the player picked the male or "JESSIE" if the player picked the female...

of course if you are wanting to actually skip the naming process... thats all FBI Agents area
 

Blah

Free supporter
1,924
Posts
11
Years
The reason why Im active here is because your thread, and since I have Compiler now, Ill be able to test all your routines, and about the one who posted the routine for when the player losses to battle, the game restarts, I really like it!

Trainers Pokemon-Players Pokemon
A routine for a Trainers pokemon party is same in your Pokemon Party including the level.
Alright, I'll give it a try.

you sir, rock my sox off... I really should learn ASM...
Yeah, it's quite useful once you learn.

Hey in my team rocket hack of fire red I want Jessie and James to be main characters and I don't wanna be able to pick a name o just want Jessie to be default name if u pick Jessie and James to be default name if u play as James. If u could help with this that'd be greatly appreciated thanks
Intro skipping is already done by Knizz in the quick Research and development thread.
As for naming, I'll look into setting default names.


PSS addon: Captured Pokemon to storage


Basically, it puts a Pokemon you capture into storage as you capture it. I should remind you that the code here isn't 100% complete. There's still a few details including nicknaming, which I haven't quite done yet. This code simply takes a Pokemon you've captured, intercepts it before it goes into the party/PC storage, and puts it right into your storage.

How to insert:

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


Now navigate to 0x2D81A and insert the following:
Code:
01 48 00 47 00 00 XX XX XX 08
Where XX XX XX is the reverse hex pointer to where you've inserted the routine.

Usage:
setvar 0x8011 0x1 = toggle this routine

The rest is handled via magical ponies.
 
416
Posts
11
Years
  • Age 35
  • Seen Feb 10, 2024
Alright, I'll give it a try.
Intro skipping is already done by Knizz in the quick Research and development thread.
As for naming, I'll look into setting default names.

My intro text editor edits the default names...
 
200
Posts
10
Years
  • Age 30
  • Seen Jun 19, 2022
Alright. I took a look and it seems EXP is stored in a substructure that moves depending on poke's personality, which is extremely annoying. However, it is possible to easily calculate medium growth rate exp, which is just the level cubed, and should suffice for most purposes.

I haven't finished a script yet, don't know when I'll get to it, but it seems quite doable (at least with the hacked engine, which has division and multiplication math specials) and here's the bulk of it (I haven't tested/debugged yet, obvs) which does basically everything but the levels grab/check part that could be easily added. I will finish later, I think, but for anyone who wants to implement themselves this will get you started and does most of the hard work.

It does remind me, though; I haven't looked yet FBI Agent to see if you gave the answer to this earlier, but you can check the levels/stats of the stored team as well as the party right? That's all that's needed to finish the script. (well, besides the obligatory flavor text, like 'Ready to take out the Team for a mission?' or something silly.)

edit: actually, just had a thought; I don't need to be able to get the stored pokemons level, since I could just temporarily put them in the party and check their levels, and then put them back in storage, but that seems very silly!
edit:
okay, turned out to be redundant and convoluted. so removed the scripty.
 
Last edited:

Blah

Free supporter
1,924
Posts
11
Years
My intro text editor edits the default names...

I think he wants to set a default name while skipping the intro. If you skip the intro via ASM, the default name is left as 0s aka blank.

Setting a static name to the player


Well, this is beyond simple, lol. I'll keep my post the same format though, because first post :3

How to insert:

Before you begin to insert the routine, there are a few steps. Firstly player names are limited to 8 characters with the eighth character = 0xFF.
Convert the static name you want from ascii to hex. For OP, he wanted Jesse and James which convert into:
C4 D9 E7 E7 D9 FF FF FF - Jesse
C4 D5 E1 D9 E7 FF FF FF -James
Note that if all eight bytes don't get used, you should pad them with "FF" in your hex editor.
Now insert the 8 byte names into some free space in your ROM via hex editor and write down the pointers.

Now copy the following routine into a text editor:
Spoiler:


You'll notice that I have the lines:
Code:
.CustomNameBoy:
	.word 0x@pointer to boy name

.CustomNameGirl:
	.word 0x@pointer to girl name

Change the 0x@pointer text to 0x[offset you inserted]. No need to add one.
After you've done that compile and insert into free space.

Usage:
You must callasm to the routine, and depending on the Player's gender it will set their name. To have their name inserted before the player starts playing the game, create a level script which calls this routine. If you don't know how, ask in a relevant thread (not here).
 
Last edited:

Blah

Free supporter
1,924
Posts
11
Years
Alright. I took a look and it seems EXP is stored in a substructure that moves depending on poke's personality, which is extremely annoying. However, it is possible to easily calculate medium growth rate exp, which is just the level cubed, and should suffice for most purposes.

I haven't finished a script yet, don't know when I'll get to it, but it seems quite doable (at least with the hacked engine, which has division and multiplication math specials) and here's the bulk of it (I haven't tested/debugged yet, obvs) which does basically everything but the levels grab/check part that could be easily added. I will finish later, I think, but for anyone who wants to implement themselves this will get you started and does most of the hard work.

It does remind me, though; I haven't looked yet FBI Agent to see if you gave the answer to this earlier, but you can check the levels/stats of the stored team as well as the party right? That's all that's needed to finish the script. (well, besides the obligatory flavor text, like 'Ready to take out the Team for a mission?' or something silly.)

edit: actually, just had a thought; I don't need to be able to get the stored pokemons level, since I could just temporarily put them in the party and check their levels, and then put them back in storage, but that seems very silly!

Set Stored Team Exp Closer to Party Team Levels Script //not plug and chuggable yet

Spoiler:

What are you trying to achieve here? It's much easier to calculate average level of Player's party, then set the storage Pokemon's levels to the calculated amount. Would you like me to make a routine for that?
 

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 2023
Alright, I'll give it a try.


Yeah, it's quite useful once you learn.


Intro skipping is already done by Knizz in the quick Research and development thread.
As for naming, I'll look into setting default names.


PSS addon: Captured Pokemon to storage


Basically, it puts a Pokemon you capture into storage as you capture it. I should remind you that the code here isn't 100% complete. There's still a few details including nicknaming, which I haven't quite done yet. This code simply takes a Pokemon you've captured, intercepts it before it goes into the party/PC storage, and puts it right into your storage.

How to insert:

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


Now navigate to 0x2D81A and insert the following:
Code:
01 48 00 47 00 00 XX XX XX 08
Where XX XX XX is the reverse hex pointer to where you've inserted the routine.

Usage:
setvar 0x8011 0x1 = toggle this routine

The rest is handled via magical ponies.

Automatic name setting? I think Touched did that, but for EM.
 
416
Posts
11
Years
  • Age 35
  • Seen Feb 10, 2024
I think he wants to set a default name while skipping the intro. If you skip the intro via ASM, the default name is left as 0s aka blank.

skipping the intro via ASM still lets you set the buffer \v\h01 (players name) with a script

Code:
checkgender
compare LASTRESULT 0x0
if == jump @boyname
compare LASTRESULT 0x1
if == jump @girlname
end

#org @boyname
'-----------------------------------
virtualbuffer 0x1  @stringboy
end

#org @girlname
'-----------------------------------
virtualbuffer 0x1  @stringgirl
end

#org @stringboy
= JAMES

#org @stringgirl
= JESSE

something like that should (untested) work to set the name of the player if you skipped the intro... (PKSV)
 
Last edited:

Joexv

ManMadeOfGouda joexv.github.io
1,037
Posts
11
Years
And also (no offense to knizz) the skip into thats been made sucks. I tested it yesterday and It dosesnt support save files, which for a lot of people really sucks because they dont use save states.
So a new one would be great.
 

Blah

Free supporter
1,924
Posts
11
Years
Automatic name setting? I think Touched did that, but for EM.
I just did it for FR. :P

skipping the intro via ASM still lets you set the buffer \v\h01 (players name) with a script

Code:
checkgender
compare LASTRESULT 0x0
if == jump @boyname
compare LASTRESULT 0x1
if == jump @girlname
end

#org @boyname
'-----------------------------------
virtualbuffer 0x1  @stringboy
end

#org @girlname
'-----------------------------------
virtualbuffer 0x1  @stringgirl
end

#org @stringboy
= JAMES

#org @stringgirl
= JESSE

something like that should work to set the name of the player if you skipped the intro... (PKSV)
The trainer card, start menu, and a lot of "behind the scenes" generated scripts are going to use blank as your name regardless of any script you may try.

All praise the god and savior ASM.
 
Back
Top