• 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

Turtl3Skulll

Blue Turtl3
76
Posts
10
Years

Special Shiny Pokemon box!


Navigate to offset 0x44472 and insert the following byte changes:
Code:
01 48 00 47 00 00 01 00 84 08

Upon replacing these bytes, if I open the pokemon summary page the game goes to & stays in a black screen, the asm hasn't even been called at this point, any suggestions??
 
Last edited:

Blah

Free supporter
1,924
Posts
11
Years
Upon replacing these bytes, if I open the pokemon summary page the game goes to & stays in a black screen, the asm hasn't even been called at this point, any suggestions??
Sorry, I completely forgot :X
It should be
Code:
01 4D 28 47 00 00 XX XX XX 08
where XX XX XX is the pointer to the routine +1. I inserted my test routine at 0x840000, and forgot to change it to xx xx xx in the temple :P
I'll edit my post!

I recently began planning for a hack and for what I wanted to do, it involved changing the overworld colors inbetween segments. Although it is graphical hack, I am curious(since it sort of has to do with the mechanics of Fire Red)

Turn the coloring of the game's overworld to the same Black and White Filter used in Flashbacks.

By this, flashbacks use a filter that turns all colors to Black and White. If you could set some var and use this on the spot, that'd be cool. I mainly want to do this because detective monolouges are always cool(or super emotional cutscenes, your preference)
Looks like it's already been implemented. Keep the suggestions coming though :D

I'm really enjoying this thread. Its great seeing so many interesting routines being churned out, whether they're big or small. Its the first thread I open up whenever I log on to PC now. Keep up the excellent work FBI and the same goes for all of the hard-working elves who pop-in now and then to assist :P

You can already do this with a writebytetooffset command as shown here. There's also some talk about it on the 19th page of the Quick R&D thread which should allow you to revert the game's colour back to normal without warping.

Thanks for saving me the work. I actually knew that this was already done before, but I couldn't find it! I think Colcostyles figured this out many years ago, but he built a routine for it and back then no one knew enough to utilize his findings (I might be dreaming all along though).


Announcement:


I'm going to be working on two major projects, both of which are rather massive in size. They are new battle modes and a completely reworked daycare/breeding system!



Battle modes:

I'm going to be doing a battle overhaul, so the requests coming up are going to be a little slower on the implementations (current my todo list is just implementing the deletion of fainted Pokemon, which got me here).

What I mean by battle overhaul is that I'm going to be implementing a few different battle types, which currently include:
- Challenger Cup and other tournament battle modes
- Oak tutorial battle (A battle which continues after you lose, minus Oak's blabbering)
- Wild battle via script (For the script to continue after the battle regardless of result - good for legendary battles)
- Battle ending early (Basically just a battle which will end if certain conditions are met)
- Trainer sliding (Big maybe, right now it's not working properly and I'm not feeling like fixing it :P)

For the battle ending early, I will make it expandable, that way YOU can add features in which you believe should end the battle.


Day care system rework:


I'm going to update the thing into new generation functionality. Right now the breeding system is rather weird, and the game's current code doesn't open itself to easy customization and expandibility for newer generation daycare systems. I'm gonna fix all of these problems, and add some customizability so you can change certain things which you want your daycare to be like. Certain features I'm thinking of allowing customization to:

- Exp gains (the speed which daycare pokemon level up in)
- Size of daycare
- Items affecting breeding
- Shiny calculations!
- Full customization possibilities for daycare eggs! (stats and moves)

For items affecting breeding, it's going to take some work for the user to expand existing items. That's because you will have to write the routines yourself (or request them, yay FBI you're so nice!).

So yeah, requests are going to be onhold until I finish these projects. I truly believe that both of these will add new possibilities for upcoming hacks and definitely make them more interesting to play :)
 
Last edited:

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
Oh! My God!
I thought youll not working in Challenge Cup!
Its very awesome feature :3
Im also waiting for your trainer interruption routine!
Awesome. I am running out of ideas, I should rest my little brain too >_<
Goodluck!
(Still waiting for Special Pokemon that calls weather even though it has no Drizzle and Drought ability)
 

Turtl3Skulll

Blue Turtl3
76
Posts
10
Years
Sorry, I completely forgot :X
It should be
Code:
01 4D 28 47 00 00 XX XX XX 08
where XX XX XX is the pointer to the routine +1. I inserted my test routine at 0x840000, and forgot to change it to xx xx xx in the temple :P

Thanks so much!! It worked, no more black screen, though I wasn't able to get the second routine to work properly on a rom patched w/ JPAN's engine, it did work on a clean rom, I won't ask you to look into it since you did me enough of a favor by working with a graphic hacks, but if you can that'd be great too.

Good luck on your projects, really looking foward to the new daycare system:D
will it be completely separate from the old one or is it playing off the old code??
 

Blah

Free supporter
1,924
Posts
11
Years
Oh! My God!
I thought youll not working in Challenge Cup!
Its very awesome feature :3
Im also waiting for your trainer interruption routine!
Awesome. I am running out of ideas, I should rest my little brain too >_<
Goodluck!
(Still waiting for Special Pokemon that calls weather even though it has no Drizzle and Drought ability)

Challenger Cup is something that I thought would be a nice "side feature", I'm adding it as an addon :3

Thanks so much!! It worked, no more black screen, though I wasn't able to get the second routine to work properly on a rom patched w/ JPAN's engine, it did work on a clean rom, I won't ask you to look into it since you did me enough of a favor by working with a graphic hacks, but if you can that'd be great too.

Good luck on your projects, really looking foward to the new daycare system:D
will it be completely separate from the old one or is it playing off the old code??

You can't get the second routine to work? I don't particularly do anything except set a byte in the Pokemon's data structure which is unused. I believe that it doesn't work maybe because you're setting the variable incorrectly? Try setting var 0x8004 to 0x0 in a script and callasming to the second routine +1. It SHOULD give your first Pokemon the border. There is no reason why it's not compatible with JPAN's hack, because it is indeed standalone :x


This means we can have a Masuda Method like feature?
Yes, comming soon to a daycare near you!

So... I want to make a feature, that poisions my pokémon, but i dont want to poision Pokémon, that is from the type poision or steel. So I have to check for the type. You have made an implimentation wit a modifided special 0x12b, but i dont need first result, i need the result in slot X (which is determined by var 0x8005 if this would be poissible).
EDIT: I modifided the offset of your routine from 8. dec.

Here is a routine I made a day ago which checks the type of a Pokemon: http://www.pokecommunity.com/showpost.php?p=8525633&postcount=185

You will need to edit this routine to return in var 0x8005 rather than 0x8000.

Also I had the idea to implement the critical capture feature, which captures a pokémon faster, if you have more pokémon in your pokédex. It would be great if you could relize that :)

Also it would be great, if you could implement new answers for the easy chat system. Here is a link if you dont know what i am talking about.
Requests are onhold right now but I will look into the easy chat system next time I'm free.
 

Turtl3Skulll

Blue Turtl3
76
Posts
10
Years
You can't get the second routine to work? I don't particularly do anything except set a byte in the Pokemon's data structure which is unused. I believe that it doesn't work maybe because you're setting the variable incorrectly? Try setting var 0x8004 to 0x0 in a script and callasming to the second routine +1. It SHOULD give your first Pokemon the border. There is no reason why it's not compatible with JPAN's hack, because it is indeed standalone :x
Well I got it working on a clean rom, I used the same routines, pointers, and scripts on both yet it doesn't work on my patched rom.

IF you can I'll leave my IPS file linked and you can try seeing if there's something there.

https://www.dropbox.com/s/x15g0lyb2ci5wlu/Turtl3Skulll's patch (idk needed a name).ips?dl=0

Yes, comming soon to a daycare near you!

!!!!!!!!! :D
 

Blah

Free supporter
1,924
Posts
11
Years

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:


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.


Addons for Battle by move:


Prevent loss (white out):
Spoiler:



Battle by turn:


This routine will run all of it's referenced routines at the end of the turn (right before the turn counter in incremented.

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.
Last entry in the table needs to be 00 00 00 00.

Credits to daniilS for helping with optimization.
Spoiler:


Now navigate to 0x13CB0 and insert the following byte changes:
Code:
00 48 00 47 XX XX XX 08


Usage:
The routine is toggled by flag 0x2F8. 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.

Battle by turn addons:


Sleeping clause:
Spoiler:


Battle end by turn:
Spoiler:
 
Last edited:
2
Posts
9
Years
  • Age 27
  • Seen Apr 25, 2020
I'm here just to say that you're doing an amazing work. All the routines you have done are incredible and I really love all of them, especially the type-check, the Silent Evolution and all the PSS thing. Thanks! ^^
 

Zehn

[color=red][font=Foto Serif]Sacred[/font][/color][
988
Posts
9
Years
hey man, I was wondering if you knew if it was possible to have implement gen 4 style double battles with AMS/scripting? by this I mean when you and another NPC can fight in the same battle on the same team, and they still have randomised attacks and what-not. Thanks in advance!
 
15
Posts
9
Years
  • Age 28
  • Seen Nov 20, 2016
If I use the "Skip Professor Oak Intro" patch on my game, is there a way to implement naming my trainer outside that introduction without sticking with the default name?

EDIT: Also, is there a way to randomize an enemy trainer's starting pokemon?
 
Last edited:

ShyRayq

Unprofessional Unprofessional
1,856
Posts
16
Years
  • Seen Apr 2, 2024
If I use the "Skip Professor Oak Intro" patch on my game, is there a way to implement naming my trainer outside that introduction without sticking with the default name?

EDIT: Also, is there a way to randomize an enemy trainer's starting pokemon?

http://www.pokecommunity.com/showpost.php?p=8520099&postcount=136
This lets you choose a name your own name using ASM, but its probably more advanced and complicated for a simple run. Its more suitable for a hack with specific characters.

And for your second point, you can use a randomiser program. There's a few in the "Tools and Resources" section. Or just use Google. Type in "Pokemon _____ Randomiser".
 

Blah

Free supporter
1,924
Posts
11
Years
I'm here just to say that you're doing an amazing work. All the routines you have done are incredible and I really love all of them, especially the type-check, the Silent Evolution and all the PSS thing. Thanks! ^^
Wow, your first post on the forums is to thank me. I'm glad you find use for all of these :)


hey man, I was wondering if you knew if it was possible to have implement gen 4 style double battles with AMS/scripting? by this I mean when you and another NPC can fight in the same battle on the same team, and they still have randomised attacks and what-not. Thanks in advance!
Touched is already working on this, though from what I hear it's very difficult.


If I use the "Skip Professor Oak Intro" patch on my game, is there a way to implement naming my trainer outside that introduction without sticking with the default name?

EDIT: Also, is there a way to randomize an enemy trainer's starting pokemon?
Yeah, here's a post by sonic about naming the player in OW: http://www.pokecommunity.com/showthread.php?p=7087946#7087946

For randomizing the enemy's starting Pokemon, I'm not sure what you mean. Can't you just pick random Pokemon in a trainer editor? what's the difference. You might end up fighting a legendary or OP pokemon if you randomize it :x

http://www.pokecommunity.com/showpost.php?p=8520099&postcount=136
This lets you choose a name your own name using ASM, but its probably more advanced and complicated for a simple run. Its more suitable for a hack with specific characters.

And for your second point, you can use a randomiser program. There's a few in the "Tools and Resources" section. Or just use Google. Type in "Pokemon _____ Randomiser".

Thanks, yes that routine is used for hacks which want static names for the player based on gender. Unfortunately, it is rather specific :/
 

Vivacity

still learning
6
Posts
9
Years
  • Age 29
  • Seen Jul 15, 2017
This is such an awesome thread! :D I've already managed to insert Snag Balls into my hack, which I never would've been able to do before, and that's just scratching the surface of all the new possibilities you've opened up. Cheers, FBI, you're awesome :D

...I mean, I was going to leave it at that, but just looking at the first post gets me excited! New Bags, the PSS, Berries, backsprites, Start Menu mods... if I ever run out of ideas, I'm just gonna come back here to get a truckload of new ones, haha. You're an inspiration to the rest of us, seriously. :)

So I'm here mainly to show appreciation and say thank you, but since you're doing battle stuff anyway, I figured it couldn't hurt to suggest something. :) With the current implementation of the Snag Ball mechanic, the battle ends right after you catch a Trainer's Pokémon, even if they had more to send out. Also, I've searched Spherical Ice's script reference and there doesn't seem to be a way to check how a Trainer battle ended.

So I'm just interested in the following:

1) Might there be a way to force the battle to continue even after you've caught a Trainer's Pokémon? (Just so that players aren't restricted to snagging only one Pokémon from every Trainer they encounter.)
2) Is there any way of checking whether a Pokémon was stolen after the battle ends? (I'd like to set off a different series of events if a Pokémon was snagged - to me, it seems like a Trainer would act differently if you stole their Pokémon.)

Please don't worry about these if you think they'd take too much time, though! :) Thanks again for all your hard work already, and I hope you're having a fab day! :D
 
15
Posts
9
Years
  • Age 28
  • Seen Nov 20, 2016
Yeah I was hoping more to access the "name your trainer" screen outside the Oak Intro than a series of specific names.

And about the randomizing comment I meant that out of a trainer's own Pokemon, I want to randomize which Pokemon out that group is sent out first.
 

Blah

Free supporter
1,924
Posts
11
Years
Complements
Aww, you, I like you :3

So I'm here mainly to show appreciation and say thank you, but since you're doing battle stuff anyway, I figured it couldn't hurt to suggest something. :) With the current implementation of the Snag Ball mechanic, the battle ends right after you catch a Trainer's Pokémon, even if they had more to send out. Also, I've searched Spherical Ice's script reference and there doesn't seem to be a way to check how a Trainer battle ended.

So I'm just interested in the following:

1) Might there be a way to force the battle to continue even after you've caught a Trainer's Pokémon? (Just so that players aren't restricted to snagging only one Pokémon from every Trainer they encounter.)
2) Is there any way of checking whether a Pokémon was stolen after the battle ends? (I'd like to set off a different series of events if a Pokémon was snagged - to me, it seems like a Trainer would act differently if you stole their Pokémon.)

Please don't worry about these if you think they'd take too much time, though! :) Thanks again for all your hard work already, and I hope you're having a fab day! :D

Unfortunately, the Pokemon catch routine assumes the battle is over if you capture a trainer's Pokemon. I tried doing what I did with the whiteout routine here, and instead I'm left with an endless Pokemon selection loop. So that pretty much concludes that the only probable way is to rewrite that capture code. Actually this is a problem in later generations as well. if you recall DPPTs double wild battles, the battle prevents you from capturing a Pokemon till only one is left alive (I assume for the same reason, because the battle is signified as over once a pokemon has been caught.) So yeah, I won't be able to allow the battle to continue after a trainer has had his Pokemon stolen, but in hindsight, what kinda trainer would continue the battle after having their Pokemon snagged? :D

For 2, yeah there is!
I would use trainerbattle 0x9 0xID 0x0 @strings @strings
This is a special trainer battle, (which I haven't seen anyone discover before). Basically it allows for the script to continue after the battle (if you win) AND it will allow the trainer to have a view radius in A-Map. So the trainer will walk up to you. Have these commands after the trainer battle command:
Code:
checkflag 0x[flag if it's stolen
if 0x1 jump @stolen
copybyte 0x2023E8A 0x20370D0 'copy battle result into last result
compare LASTRESULT 0x7
if == jump @stolen
msgbox @goodBattle
callastd MSG_NORMAL
release
end

#org @stolen
' Maybe set a flag here so the trainer remembers all the time
msgbox @IHadMyPokemonStolen
callstd MSG_NORMAL
release
end

Use the copybyte command to access that offset, and then compare it to 0x7. Remember that the 0x7 is overwritten everybattle the trainer enters, so this is the only REAL way to do it.

Yeah I was hoping more to access the "name your trainer" screen outside the Oak Intro than a series of specific names.

And about the randomizing comment I meant that out of a trainer's own Pokemon, I want to randomize which Pokemon out that group is sent out first.

The post from sonic1 which I liked you does exactly that :D
Oh, randomize the trainer's party? You can do this in a script :)
Code:
random 0x[pick from 0 to however many Pokemon you've inserted]
addvar LASTRESULT 0x1
addpokemon LASTRESULT 0xLevelInHex 0xItemID 0x0 0x0 0x0

I'm not sure why I'm posting scripts for people, perhaps I'm in a good mood :3
 
15
Posts
9
Years
  • Age 28
  • Seen Nov 20, 2016
Aww, you, I like you :3



Unfortunately, the Pokemon catch routine assumes the battle is over if you capture a trainer's Pokemon. I tried doing what I did with the whiteout routine here, and instead I'm left with an endless Pokemon selection loop. So that pretty much concludes that the only probable way is to rewrite that capture code. Actually this is a problem in later generations as well. if you recall DPPTs double wild battles, the battle prevents you from capturing a Pokemon till only one is left alive (I assume for the same reason, because the battle is signified as over once a pokemon has been caught.) So yeah, I won't be able to allow the battle to continue after a trainer has had his Pokemon stolen, but in hindsight, what kinda trainer would continue the battle after having their Pokemon snagged? :D

For 2, yeah there is!
I would use trainerbattle 0x9 0xID 0x0 @strings @strings
This is a special trainer battle, (which I haven't seen anyone discover before). Basically it allows for the script to continue after the battle (if you win) AND it will allow the trainer to have a view radius in A-Map. So the trainer will walk up to you. Have these commands after the trainer battle command:
Code:
checkflag 0x[flag if it's stolen
if 0x1 jump @stolen
copybyte 0x2023E8A 0x20370D0 'copy battle result into last result
compare LASTRESULT 0x7
if == jump @stolen
msgbox @goodBattle
callastd MSG_NORMAL
release
end

#org @stolen
' Maybe set a flag here so the trainer remembers all the time
msgbox @IHadMyPokemonStolen
callstd MSG_NORMAL
release
end
Use the copybyte command to access that offset, and then compare it to 0x7. Remember that the 0x7 is overwritten everybattle the trainer enters, so this is the only REAL way to do it.



The post from sonic1 which I liked you does exactly that :D
Oh, randomize the trainer's party? You can do this in a script :)
Code:
random 0x[pick from 0 to however many Pokemon you've inserted]
addvar LASTRESULT 0x1
addpokemon LASTRESULT 0xLevelInHex 0xItemID 0x0 0x0 0x0
I'm not sure why I'm posting scripts for people, perhaps I'm in a good mood :3

For the first thing, sorry, I was thinking of another link back there. Thanks.

As for the second thing, I meant pick from random which of an enemy trainer's first pokemon he or she will send out first, like if he or she has a rattata, a pidgey, and a charmander in his team, than I want to make it so that the game selects which of these he or she will send out first. I could hackishly create multiple entries in A-Trainer, but is there a way for the game to pick one of an enemy trainer's pokemon to be sent out first?

EDIT: Well, the trainer name screen screen comes up and makes the change when I callasm 0x09FC91, but I seem to come back to the map with the start menu active and my character still being able to move, but at least the name changes.
 
Last edited:
107
Posts
10
Years
Thank you for this thread it helps so many people even though I've only used a couple of these ams routines because I haven't fully understood asm too much I thank you for this thread! :)
 

daniilS

busy trying to do stuff not done yet
409
Posts
10
Years
  • Age 24
  • Seen Jan 29, 2024
The battle system needs its own thread. It's amazing, I'll definitely be writing a few addons for it.
Also, won't it be more user-friendly to put the addons into a table? That way you never need to recompile.
 
Back
Top