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.
'---------------
#org @next
fanfare 0x71
waitfanfare
msgbox @text1 MSG_KEEPOPEN '"[buffer1]'s potential has\nbeen re..."
removeitem 0x72 0x1 ///this is set up for items. this is the item I used.
closeonkeypress
release
end
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.
Trainer 781
May 24th, 2015 2:20 AM
Damage Reduction Berries
1. Assemble the following table and insert it somewhere in Free Space:
Spoiler:
Replace YYY with the index number of the berries mentioned in the comments.
The byte below the index number for each berry represents the type of the move the berry protects it against.
Code:
.align 2
.text
main:
/*OCCA*/
.hword 0x0YYY
.byte 0x0A
/*PASHO*/
.hword 0x0YYY
.byte 0x0B
/*WACAN*/
.hword 0x0YYY
.byte 0x0D
/*RINDO*/
.hword 0x0YYY
.byte 0x0C
/*YACHE*/
.hword 0x0YYY
.byte 0x0F
/*CHOPLE*/
.hword 0x0YYY
.byte 0x01
/*KEBIA*/
.hword 0x0YYY
.byte 0x03
/*SHUCA*/
.hword 0x0YYY
.byte 0x04
/*COBA*/
.hword 0x0YYY
.byte 0x02
/*PAYAPA*/
.hword 0x0YYY
.byte 0x0E
/*TANGA*/
.hword 0x0YYY
.byte 0x06
/*CHARTI*/
.hword 0x0YYY
.byte 0x05
/*KASIB*/
.hword 0x0YYY
.byte 0x07
/*HABAN*/
.hword 0x0YYY
.byte 0x10
/*COLBUR*/
.hword 0x0YYY
.byte 0x11
/*BABIRI*/
.hword 0x0YYY
.byte 0x08
/*ROSELI*/
.hword 0x0YYY
.byte 0x17
/*end table*/
.hword 0xFFFF
.byte 0xFF
2. Assemble this routine and make bytes changes mentioned in the code
1. Assemble the following table and insert it somewhere in Free Space:
Spoiler:
Replace YYY with the index number of the berries mentioned in the comments.
The byte below the index number for each berry represents the type of the move the berry protects it against.
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
May 26th, 2015 3:15 AM
Quote:
Originally Posted by MrDollSteak
(Post 8767100)
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
May 26th, 2015 3:47 AM
Quote:
Originally Posted by KDS
(Post 8767720)
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
May 26th, 2015 4:02 AM
Quote:
Originally Posted by MrDollSteak
(Post 8767743)
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.)
robinjea
May 28th, 2015 10:49 PM
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.
Quote:
Originally Posted by FBI agent
(Post 8523908)
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:
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
May 29th, 2015 7:31 AM
Flame Orb and Toxic Orb
Spoiler:
Inserting this is a bit complicated than other items. Also this was the most challenging to implement.
Anyways, here are the steps: Step I
Spoiler:
Select the bytes from x182FC to x1834B. This is a table and we are going to repoint it.
Search for 80 (or 0x50) bytes of contiguous free space and then copy and paste the table.
Now go to x182F8 and insert a series of 4 bytes corresponding to the pointer to the new location of our table. For example, if the table is at 0x731240 then in reverse hex it would be 40 12 73 08.
Step II
Spoiler:
Insert this routine in free space.
Routine at XXXXXX:
Spoiler:
EEEEEE is location for a battle script to be inserted which I will tell about later.
Now expand the table in such a way that XX XX XX 08 (Don't use +1 in this case) is the second last entry of the table (do not remove the old entries). This ensures that the orbs will activate at the extreme end of a turn after ingrain, weather damage etc.
The last entry should be 38 8C 01 08 (which is there in the original) because it successfully terminates the operation of this table.
Since the no. of entries in the table have been changed to 0x14 from 0x13, we need to break the limiters. Goto x182e6 and x18C64 and insert 0x14 there
Step III
Spoiler:
Insert the Battle Scripts and Routines in free space and change the dummy pointers mentioned in the post according to where there are inserted.
Thie battle scripts assume that F8 is the callasm command and FB is the setword command., so change it according to your ROM.
FD 0F 00 EB D5 E7 00 D6 D5 D8 E0 ED 00 E4 E3 DD E7 E3 E2 D9 D8 FE D6 ED 00 E8 DC D9 00 CE E3 EC DD D7 00 C9 E6 D6 AB
Some info about the table
Spoiler:
This table controls the order of end turn events like (weather, some end turn abilities, pinch berries, poison damage etc.) and executes them.
Interchanging the order of the table entries results in change of the order of their execution at the end turn. i.e You can make the 'Ingrain Healing' script play after the 'Burn Damaging' script by changing the order.
By expanding the table you can add things like Aqua Ring (prefably should be placed near the 1st entry which is for Ingrain), custom counters etc.
kleenexfeu
May 29th, 2015 11:16 AM
Quote:
Originally Posted by KDS
(Post 8772423)
Flame Orb and Toxic Orb
Spoiler:
Inserting this is a bit complicated than other items. Also was the most challenging to implement.
Anyways, here are the steps: Step I
Spoiler:
Select the bytes from x182FC to x1834B. This is a table and we are going to repoint it.
Search for 80 (or 0x50) bytes of contiguous free space and then copy and paste the table.
Now go to x18F28 and insert the pointer of the new location of our table. For example, if the table is at 0x731240 then in reverse it would be 40 12 73 08.
Step II
Spoiler:
Insert this routine in free space.
Routine at XXXXXX:
Spoiler:
EEEEEE is location for a battle script to be inserted which I will tell later.
Now expand the table in such a way that XX XX XX 08 (Don't use +1 in this case) is the second last entry of the table (do not remove the old entries). This ensures that the orbs will activate at the extreme end of a turn after ingrain, weather damage etc.
The last entry should be 38 8C 01 08 (which is there in the original) because it successfully terminates the operation of this table.
Since the no. of entries in the table have been changed to 0x14 from 0x13, we need to break the limiters. Goto x182e6 and x18C64 at change it to 0x14.
Step III
Spoiler:
Insert the Battle Scripts and Routines in free space and change the dummy pointers mentioned in the post according to where there are inserted.
FD 0F 00 EB D5 E7 00 D6 D5 D8 E0 ED 00 E4 E3 DD E7 E3 E2 D9 D8 FE D6 ED 00 E8 DC D9 00 CE E3 EC DD D7 00 C9 E6 D6 AB
Some info about the table
Spoiler:
This table controls the order of end turn events like (weather, some end turn abilities, pinch berries, poison damage etc.) and executes them.
Interchanging the order of the table entries results in change of the order of their execution at the end turn. i.e You can make the 'Ingrain Healing' script play after the 'Burn Damaging' script by changing the order.
By expanding the table you can add things like Aqua Ring (prefably should be place near the 1st entry which is for Ingrain), custom counters etc.
This is awesome, congrats on that ! You should precise that is for firered, I didn't see it in the post
Trainer 781
May 29th, 2015 11:33 AM
Quote:
Originally Posted by kleenexfeu
(Post 8772618)
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.
Xencleamas
May 30th, 2015 11:01 PM
Note: This is not 100% working. I left this here just in case someone would like fix this one.
Quote:
Originally Posted by KDS
(Post 8772423)
Flame Orb and Toxic Orb
Spoiler:
Inserting this is a bit complicated than other items. Also this was the most challenging to implement.
Anyways, here are the steps: Step I
Spoiler:
Select the bytes from x182FC to x1834B. This is a table and we are going to repoint it.
Search for 80 (or 0x50) bytes of contiguous free space and then copy and paste the table.
Now go to x18F28 and insert a series of 4 bytes corresponding to the pointer to the new location of our table. For example, if the table is at 0x731240 then in reverse hex it would be 40 12 73 08.
Step II
Spoiler:
Insert this routine in free space.
Routine at XXXXXX:
Spoiler:
EEEEEE is location for a battle script to be inserted which I will tell about later.
Now expand the table in such a way that XX XX XX 08 (Don't use +1 in this case) is the second last entry of the table (do not remove the old entries). This ensures that the orbs will activate at the extreme end of a turn after ingrain, weather damage etc.
The last entry should be 38 8C 01 08 (which is there in the original) because it successfully terminates the operation of this table.
Since the no. of entries in the table have been changed to 0x14 from 0x13, we need to break the limiters. Goto x182e6 and x18C64 and insert 0x14 there
Step III
Spoiler:
Insert the Battle Scripts and Routines in free space and change the dummy pointers mentioned in the post according to where there are inserted.
Thie battle scripts assume that F8 is the callasm command and FB is the setword command., so change it according to your ROM.
FD 0F 00 EB D5 E7 00 D6 D5 D8 E0 ED 00 E4 E3 DD E7 E3 E2 D9 D8 FE D6 ED 00 E8 DC D9 00 CE E3 EC DD D7 00 C9 E6 D6 AB
Some info about the table
Spoiler:
This table controls the order of end turn events like (weather, some end turn abilities, pinch berries, poison damage etc.) and executes them.
Interchanging the order of the table entries results in change of the order of their execution at the end turn. i.e You can make the 'Ingrain Healing' script play after the 'Burn Damaging' script by changing the order.
By expanding the table you can add things like Aqua Ring (prefably should be placed near the 1st entry which is for Ingrain), custom counters etc.
Nice work KDS... I have somehow change the offsets which would work on Emerald:
Spoiler:
Inserting this is a bit complicated than other items. Also this was the most challenging to implement.
Anyways, here are the steps: Step I
Spoiler:
Select the bytes from x409C8 to x40A17. This is a table and we are going to repoint it.
Search for 80 (or 0x50) bytes of contiguous free space and then copy and paste the table.
Now go to x41644 and insert a series of 4 bytes corresponding to the pointer to the new location of our table. For example, if the table is at 0xDE4B40 then in reverse hex it would be 40 4B DE 08.
Step II
Spoiler:
Insert this routine in free space.
Routine at XXXXXX:
Spoiler:
EEEEEE is location for a battle script to be inserted which I will tell about later.
Now expand the table in such a way that XX XX XX 08 (Don't use +1 in this case) is the second last entry of the table (do not remove the old entries). This ensures that the orbs will activate at the extreme end of a turn after ingrain, weather damage etc.
The last entry should be 04 13 04 08 (which is there in the original) because it successfully terminates the operation of this table.
Since the no. of entries in the table have been changed to 0x14 from 0x13, we need to break the limiters. Goto x409B2 and x41330 and insert 0x14 there
Step III
Spoiler:
Insert the Battle Scripts and Routines in free space and change the dummy pointers mentioned in the post according to where there are inserted.
Thie battle scripts assume that F9 is the callasm command and FA is the setword command., so change it according to your ROM.
FD 0F 00 EB D5 E7 00 D6 D5 D8 E0 ED 00 E4 E3 DD E7 E3 E2 D9 D8 FE D6 ED 00 E8 DC D9 00 CE E3 EC DD D7 00 C9 E6 D6 AB
Some info about the table
Spoiler:
This table controls the order of end turn events like (weather, some end turn abilities, pinch berries, poison damage etc.) and executes them.
Interchanging the order of the table entries results in change of the order of their execution at the end turn. i.e You can make the 'Ingrain Healing' script play after the 'Burn Damaging' script by changing the order.
By expanding the table you can add things like Aqua Ring (prefably should be placed near the 1st entry which is for Ingrain), custom counters etc.
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. :/
Trainer 781
May 30th, 2015 11:35 PM
Quote:
Originally Posted by Sky High
(Post 8775210)
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. :/
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.
kleenexfeu
May 31st, 2015 1:48 AM
Quote:
Originally Posted by KDS
(Post 8772423)
Flame Orb and Toxic Orb
Spoiler:
Inserting this is a bit complicated than other items. Also this was the most challenging to implement.
Anyways, here are the steps: Step I
Spoiler:
Select the bytes from x182FC to x1834B. This is a table and we are going to repoint it.
Search for 80 (or 0x50) bytes of contiguous free space and then copy and paste the table.
Now go to x18F28 and insert a series of 4 bytes corresponding to the pointer to the new location of our table. For example, if the table is at 0x731240 then in reverse hex it would be 40 12 73 08.
Step II
Spoiler:
Insert this routine in free space.
Routine at XXXXXX:
Spoiler:
EEEEEE is location for a battle script to be inserted which I will tell about later.
Now expand the table in such a way that XX XX XX 08 (Don't use +1 in this case) is the second last entry of the table (do not remove the old entries). This ensures that the orbs will activate at the extreme end of a turn after ingrain, weather damage etc.
The last entry should be 38 8C 01 08 (which is there in the original) because it successfully terminates the operation of this table.
Since the no. of entries in the table have been changed to 0x14 from 0x13, we need to break the limiters. Goto x182e6 and x18C64 and insert 0x14 there
Step III
Spoiler:
Insert the Battle Scripts and Routines in free space and change the dummy pointers mentioned in the post according to where there are inserted.
Thie battle scripts assume that F8 is the callasm command and FB is the setword command., so change it according to your ROM.
FD 0F 00 EB D5 E7 00 D6 D5 D8 E0 ED 00 E4 E3 DD E7 E3 E2 D9 D8 FE D6 ED 00 E8 DC D9 00 CE E3 EC DD D7 00 C9 E6 D6 AB
Some info about the table
Spoiler:
This table controls the order of end turn events like (weather, some end turn abilities, pinch berries, poison damage etc.) and executes them.
Interchanging the order of the table entries results in change of the order of their execution at the end turn. i.e You can make the 'Ingrain Healing' script play after the 'Burn Damaging' script by changing the order.
By expanding the table you can add things like Aqua Ring (prefably should be placed near the 1st entry which is for Ingrain), custom counters etc.
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
May 31st, 2015 3:07 AM
Quote:
Originally Posted by kleenexfeu
(Post 8775361)
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
May 31st, 2015 3:38 AM
Quote:
Originally Posted by KDS
(Post 8775431)
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
May 31st, 2015 4:24 AM
Quote:
Originally Posted by MrDollSteak
(Post 8775448)
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
June 2nd, 2015 5:34 AM
In the "reusable TM" you said
Quote:
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
Quote:
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?
Joexv
June 2nd, 2015 5:41 PM
Quote:
Originally Posted by jiangzhengwenjzw
(Post 8778625)
In the "reusable TM" you said
But in another post you said
Should the latter be included in the "reusable TM" post or it is for another hack?
Included
jiangzhengwenjzw
June 2nd, 2015 11:24 PM
Quote:
Originally Posted by joexv
(Post 8779530)
Included
Thank you for your reply. I thought it should be included previously but I'm just not sure as he didn't edit the original post, as you know. XD
Trainer 781
June 7th, 2015 4:11 AM
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.