• 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

Criminon

Forever Spriting
265
Posts
11
Years

Ability switching:


Very simple, it turned out to not have to adjust the PID.

How to insert:

Just compile the following routine into free space:

Spoiler:


Usage:

Set in variable 0x8004 the slot number of the Pokemon who's ability you want to swap. Note that Pokemon with only 1 ability won't have their abilities swapped. I've made it so it's easy to use with special 0x9F in your ability swap item script.



Am I supposed to be calling the ASM on this?

Spoiler:


This is what I'm using for it, but it doesn't seem to be doing anything. I AM using the JPAN engine if that helps. I know it references 8004 a lot, but it shouldn't matter on this, right?

Also! I have a few ASM ideas, and as long as its not against the rules, I would be happy to pay you for them!

Would it be possible to make it so you permanently have a chance to receive a held item from wild pokemon after fainting them? Kind of like a loot system? Maybe even a check to see if you have enough item space and then maybe spawning a pokeball with the item for a later pickup that disappears once you leave the map? I'm imagining the later would be harder, but would love to hear back from you. Everything you do is amazing, and I can't wait to understand ASM more.

Another interesting one would be modifying the trainer views to have it when a certain variable is set, they don't see you. I've been planning on adding in the cardboard box from MSG, haha.

And finally a variable that when toggled causes a certain amount of money to be taken from each battle you have. with a message. IE: "20% of your rewards have gone to Team Rocket" I plan on making being a team rocket member a possibility, allowing you to catch trainer pokemon, (which is already done) but at the same time you lose funds from trainer battles, as well as people treat you differently.
 
Last edited:

Trainer 781

Guest
0
Posts
Damage Reduction Berries

1. Assemble the following table and insert it somewhere in Free Space:
Spoiler:


2. Assemble this routine and make bytes changes mentioned in the code
Spoiler:


3. Battle Script at BBBBBB:
Spoiler:
 
Last edited:

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
Damage Reduction Berries

1. Assemble the following table and insert it somewhere in Free Space:
Spoiler:

That's awesome KDS! Have you found where the other berries activate ? (to try and make it more like 6th gen, where they activate in the end of a battle script as opposed to the start/end of turn).

I guess this would be pretty separate to that, but still I'd love to try and fix that, and buff the sitrus berry too while I'm at it.
 

Trainer 781

Guest
0
Posts
That's awesome KDS! Have you found where the other berries activate ? (to try and make it more like 6th gen, where they activate in the end of a battle script as opposed to the start/end of turn).

I guess this would be pretty separate to that, but still I'd love to try and fix that, and buff the sitrus berry too while I'm at it.

Yes. It is located where I made the hook for blacksludge. It reads a table using the held item effect byte as a index for pinch berries and leftovers then selects the routine from the table.
 

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
Yes. It is located where I made the hook for blacksludge. It reads a table using the held item effect byte as a index for pinch berries and leftovers then selects the routine from the table.

Ooh cheers KDS, I'll look into that. It must be located after all the move / ability effects (such as Rain Dish) etc. I'll try and redo the Sitrus berry routine, and just nop the entry table, and instead trigger them from the end BS routine.

Also while I'm at it, which command removes the item exactly? I'm just thinking for the Focus Sash (and a few other consumable items), but more importantly would like to see how the game handles consumability, so that I can make an Unburden check there somewhere (so that when an item is consumed I'd double the stat in the RAM, that way it resets on switch).
 

Trainer 781

Guest
0
Posts
Ooh cheers KDS, I'll look into that. It must be located after all the move / ability effects (such as Rain Dish) etc. I'll try and redo the Sitrus berry routine, and just nop the entry table, and instead trigger them from the end BS routine.

Also while I'm at it, which command removes the item exactly? I'm just thinking for the Focus Sash (and a few other consumable items), but more importantly would like to see how the game handles consumability, so that I can make an Unburden check there somewhere (so that when an item is consumed I'd double the stat in the RAM, that way it resets on switch).

To remove item from battling pokemon, the battle script command 6a (with a byte as a single parameter) can be used. I was also thinking to used this routine to set unburden. Also to avoid the hassle of unsetting unburden bytes you can use the special status flag structure starting at x2023dfc which automatically resets on switching and has a few vacant values left and most importantly does not stack with baton pass unlike ingrain and block.
You can disable the table by setting the entries to the fail pointer (which is same for deepseascale which does not have any end turn effect) except leftovers or change the table reader routine to only accomodate leftovers (and similar items like black sludge,sticky barb etc.)
 
Last edited:
534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
It's been some time since I've been around this thread because I have been testing every single ASM posted here. Though just yesterday, I was testing this one and found a little bit of problem.

Bag Deletion and Restoration

Delete Backup


It may be the case that you want to use this "bag swap" more than once. For that to work, you will have to delete the current backup. Normally if you don't delete the backup and you attempt to restore the bag for a second time, you will not have a problem. However, in the case that the first time you had your bag and you had more items that time than the second time it will not all be overwritten and you will add "extras". So to be on the safe side, after an event is over ALWAYS delete the backup!

How to insert:

Compile and insert into free space the following routine:

Spoiler:

Usage:
Like all of these routines, you just need to callasm to this routine somewhere in your script. That's all, the rest is handle automagically!

That part of the Bag Deletion and Restoration Routines. Whenever I try to delete the backup I made, and try to restore the "should've-been-deleted backup" of my items (for testing purposes), it proves that the only things it deletes in the backup are the Normal ITEMS (i.e. the Pokeballs and Key Items are still there and even keep adding more). Why is it? Can it be fixed?

Oh, and I have a few requests that I hope someone could fulfill.

1. A loot system routine (like what Criminon suggested earlier that I think nobody noticed) that will give you items or money after a wild battle. I know it can be done via scripting but I personally think that doing it that way is not kinda good. I think if it was ASM'd, it would be better.
2. A display money in textbox routine. I'm not sure if this is doable via scripting because the only thing I saw there was the showmoney and I wouldn't like it. I actually wanted money to be shown via some kind of a buffer.
3. A gender change routine. Well a name player in overworld routine exists, why not a gender change routine? :P
4. Uhmm... I don't think this is possible, a Display a 256color fullscreen image routine.
5. A Change trainer levels routine based on your party's average level.
6. A Bag deletion and restoration routine that only deletes the normal items and keeps the key items and pokeballs.
That's about it. I hope someone can. Thank you! :D
 

Trainer 781

Guest
0
Posts
Flame Orb and Toxic Orb

Spoiler:
 
Last edited:
218
Posts
10
Years
  • Seen Nov 12, 2021
Flame Orb and Toxic Orb

Spoiler:

This is awesome, congrats on that ! You should precise that is for firered, I didn't see it in the post
 

Trainer 781

Guest
0
Posts
This is awesome, congrats on that ! You should precise that is for firered, I didn't see it in the post

Thanks. Actually, the first post states that the routines are mainly for Fire Red so I didn't mention it.
 
457
Posts
10
Years
  • Age 29
  • Seen Apr 9, 2024
Note: This is not 100% working. I left this here just in case someone would like fix this one.

Flame Orb and Toxic Orb

Spoiler:

Nice work KDS... I have somehow change the offsets which would work on Emerald:

Spoiler:


I only changed the offsets used in the ASMs and Battle Script commands. I haven't changed offsets in Battle Scripts. I just dunno which is right which will work on Emerald. I haven't tested this yet so KDS, hope you can help me this one now.

Replace KK with the effect byte of Flame Orb.
Replace LL with the effect byte of Toxic Orb.


Quick question: What do you mean for this one? Is it the item number of those two or is it something it has to do on the expanded table on the first step? I'm really confuse with this one. :/
 
Last edited:

Trainer 781

Guest
0
Posts
Quick question: What do you mean for this one? Is it the item number of those two or is it something it has to do on the expanded table on the first step? I'm really confuse with this one. :/

http://www.pokecommunity.com/showthread.php?t=335014
Refer to this thread about info on held items and effect byte. Also good job porting, I might test this myself.

EDIT: Didn't read the first point regarding the offsets. In the battle scripts, change the first paramter of setword command to x203e320 from x203c020 in reverse hex. Also make the battle string loader has the same offset as the parameter.
 
Last edited:
218
Posts
10
Years
  • Seen Nov 12, 2021
Flame Orb and Toxic Orb

Spoiler:

I thought about something, I didn't take a look into it yet but, do you think we could use the same place for life orb ? If you can give a statut we could also make the pok takes damages. For Bad Dreams I made a simple operation and put the result at 020241F0 (if I remember well, and in Emerald), could it be possible the same way here ?
 

Trainer 781

Guest
0
Posts
I thought about something, I didn't take a look into it yet but, do you think we could use the same place for life orb ? If you can give a statut we could also make the pok takes damages. For Bad Dreams I made a simple operation and put the result at 020241F0 (if I remember well, and in Emerald), could it be possible the same way here ?

IMO, the life orb recoil should pe part of a damaging battle script. It means to make an hook in an existing BS command that appears in all damaging battle scripts and then inserting the life orb logic.
 

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
IMO, the life orb recoil should pe part of a damaging battle script. It means to make an hook in an existing BS command that appears in all damaging battle scripts and then inserting the life orb logic.

Probably the Set effect with chance command would make sense, or the faint Pokemon command.
Those are in all of them I believe.

It would also allow for life orb damage to be blocked by Sheer Force more easily as the best place for the Sheer Force check is in the set effect with chance command anyway.
 

Trainer 781

Guest
0
Posts
Probably the Set effect with chance command would make sense, or the faint Pokemon command.
Those are in all of them I believe.

It would also allow for life orb damage to be blocked by Sheer Force more easily as the best place for the Sheer Force check is in the set effect with chance command anyway.

Yes, these commands look the best place.
The only problem to solve is to make a command push more than one Battle Scripts per command.
These commands already have a chance to push another battle script for burn,recoil, item knock off, etc.
 

jiangzhengwenjzw

now working on katam
181
Posts
11
Years
  • Seen today
In the "reusable TM" you said
To insert:
Do the byte changes below
0x124F78: 00 00 00 00
0x125C80: 00 00 00 00
Make it Ungivable:
insert that at 0x1326B8: 00 00 17 E0

Make it consumable after animation:
Insert: 00 00 00 00 at 0x124F78

But in another post you said
TM deletion fix (another one):
This one is for if you try and teach a Pokemon with less than 4 moves a TM. Apparently it does the deletion else where. To fix this insert the following byte changes:
@ 0x124EAC: 00 00 00 00

Should the latter be included in the "reusable TM" post or it is for another hack?
 

Trainer 781

Guest
0
Posts
EV-enhancing items (Power Items)


Spoiler:
 
Last edited:
Back
Top