PDA

View Full Version : Research: Adding New Moves to Gen 3


Jambo51
September 27th, 2011, 04:02 AM
Hello, Jambo51 here again, and I'm here today to ask and hopefully answer the following statement:

How do we add the new moves to our beloved Generation 3 ROMs?

The answers I will provide will be for BPRE 1.0 (aka FR US 1.0), but they will also be applicable to Ruby and Emerald with a bit of thinking and some reading of ini files.

PLEASE NOTE: You can only successfully add attacks which actually do damage at this time. Status inflicting moves (whether purely status or damage and status inflicting) are a no go for now.

What's needed:
A Hex Editor
Pokémon Game Editor by Gamer2020, it perfectly supports the extended data!
Some knowledge of how the INI for PGE works
A Brain
Some PATIENCE

So, there are 2 different ways to add the new moves. The first, in the spoiler below, only supports up to 511 moves (there are a total of 559 in generation 5), but keeps support for the standard style of moveset used in generation 3.

This is so easy to do, it's not even funny.
All you need to do is repoint the attack table and the attack names array, and add the extra attacks.
How easy is that!?!

In all seriousness, you want to navigate to 0x250C04 and select 4260 bytes of data, then copy it to some aligned free space in your rom, and then repoint all references to that table. This is the silly part, there are ALSO pointers to 0x250C08 in the ROM which must also be repointed, which are used when writing the new moves' PP onto your Pokémon's data. Obviously, when repointing the PP part, you add 4 to the location you replaced 0x250C04 with. Ie, if you replaced 0x2504C04 with 0x960000, then you'd replace 0x250C08 with 0x960004.

Now, navigate back to 0x250C04 and copy (12 * number of new attacks) worth of data. This should ensure that the new attacks you add inherit some sensible data which PGE can work with.

Then navigate to 0x247094, and copy 4615 bytes and paste it into free space, then repoint as necessary.

Go back to 0x247094 and now copy (13 * number of new attacks) worth of attack names. Again, this will ensure that PGE will inherit names it can work with.

Next, navigate to 0x1C68F4, and copy 1420 bytes, and paste them into free space in the ROM, making sure the pointer is THUMB aligned. That is, ends with a 0, 4, 8 or C.

Then, go back to 0x1C68F4 and copy (4 * number of new attacks) bytes of data, and paste it into the area after the already copied data. So for example, if you repointed to 0x9F0000, you would paste this latest data starting at 0x9F058C.

Finally, repoint the pointer to 0x1C68F4 to your new data. This will allow the new moves to have animations. As of now, they will simply inherit the animations of the first however many attacks you added. Ie, Attack 355 will have Attack 0's animation (Attack 0 shares Pound's animation, so don't worry about that little problem), and so on and so forth.

Then, update PGE's ini to add support in the tool for the new moves.
You simply need to change the pointer to the attack data table to the location you repointed your data to, and update the number of attacks parameter so that it accounts for all your nice, shiny new attacks.

That is change:

NumberOfAttacks=354
AttackData=&H250C04
AttackNames=&H247094

to:

NumberOfAttacks=[Number of attacks]
AttackData=&[Location of repointed attack data table]
AttackNames=&[Location of repointed attack name array]


Then, using PGE, simply modify the attacks after Psycho Blast to comply with the base stats of the moves you want to use.

Now, for the effects, see the post further down this page where I give a worked example of how to do Flare Blitz's effect to work out how to create custom effects. You will need to repoint the table as well, I give the offset of the table in that post.

Please note, the new attacks will have blank names at this stage if you correctly repointed. So make sure you don't put anything else into that area of the ROM until you've finished at least marking out where the names will end.

You can easily update the movesets to include these new moves without any further hassle.

Finally, overwrite the bytes at 0xD75FC with 00 00 00 00 00 00 to disable the only limiter in the ROM. If you do not edit this, rather than saying "Bulbasaur used VenoShock!", it will say "Bulbasaur used a POISON move!"

From here, your new attacks should work (almost - wrong animations) perfectly.


And this is how to add more than 511 moves. Please note, this is substantially more difficult and awkward than the above method, and requires you to redo every single moveset in the game.

Firstly, do exactly what is above. Everything which follows is based on the simple foundation of what is above. *Waits*
Done that? Good.

Now we must insert some ASM routines to rewrite how the movesets are read.

So, insert the following routine:

.text
.align 2
.thumb
.thumb_func
.global newmovesetstyle
main:
mov r1, r9
lsl r1, r1, #0x2
ldr r0, table
add r0, r0, r1
ldr r0, [r0, #0x0]
ldr r6, there
add r6, #0x6
ldrb r7, [r6, #0x0]
loop: lsl r1, r7, #0x1
add r1, r1, r7
add r3, r0, r1
ldrb r1, [r3, #0x2]
mov r4, r10
cmp r4, r1
beq learn
cmp r1, #0xFF
beq exit
add r7, #0x1
b loop
learn: ldr r2, there
add r7, #0x1
strb r7, [r6, #0x0]
ldrb r1, [r3, #0x1]
lsl r1, r1, #0x8
ldrb r0, [r3, #0x0]
orr r0, r1
strh r0, [r2, #0x0]
ldr r1, return
bx r1
exit: ldr r0, return2
bx r0
.align
return: .word 0x0803EB65
return2: .word 0x0803EB73
table: .word 0x08FFFFFF /*Replace with your table's location/*
there: .word 0x02024022



Change 0x3EB20 to 18 49 08 47. Then navigate to 0x3EB84 and change it to XX XX XX 08, where the XX XX XX stands for the pointer to your new routine plus 1.

The table I reference in here is the moveset table. So change your 0x8FFFFFF to point to it. This applies to all 3 routines here, so make sure you change them all.

This only fixes the PLAYER's learnsets, so you now need to insert this next routine:


.text
.align 2
.thumb
.thumb_func
.global newmovesetstyle2
main:
ldrb r1, [r0, #0x2]
mov r2, #0xFF
cmp r1, r2
beq exit2
mov r9, r2
mov r3, #0x0
loop: lsl r0, r3, #0x1
add r0, r0, r3
ldr r1, movesettable
add r1, r1, r6
ldr r1, [r1, #0x0]
add r7, r0, r1
ldrb r0, [r7, #0x2]
mov r4, r10
cmp r0, r4
bgt exit2
ldrb r1, [r7, #0x1]
ldrb r0, [r7, #0x0]
lsl r1, r1, #0x8
orr r1, r0
mov r0, r8
str r3, [sp, #0x0]
bl branchone
mov r5, r9
ldr r3, [sp, #0x0]
cmp r0, r9
bne exit
mov r0, r8
add r1, r4, #0x0
bl branchtwo
ldr r3, [sp, #0x0]
exit: add r3, #0x1
lsl r1, r3, #0x1
add r1, r1, r3
add r0, r7, r1
ldrb r0, [r0, #0x2]
cmp r0, r5
bne loop
exit2: add sp, #0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
branchone: push {r4-r7,lr}
add sp, #-0x4
ldr r7, gothere
bx r7
branchtwo: push {r4-r7}
ldr r7, gothere2
bx r7
.align
gothere: .word 0x0803E8B5
gothere2: .word 0x0803EC43
movesettable: .word 0x08FFFFFF



Change 0x3EA10 to 00 49 08 47 XX XX XX 08 where the XX XX XX stands for the pointer to your new routine plus 1.

This will fix the moveset loading to it can now support up to 0xFFFF moves (instead of 0x1FF).

Finally, in order for the Move Relearner to work with the new system, insert this routine in your ROM:


.text
.align 2
.thumb
.thumb_func
.global newmovesetstyle
main:
lsl r2, r5, #0x1
add r2, r2, r5
ldr r1, [sp, #0x10]
add r0, r2, r1
ldrb r0, [r0, #0x2]
ldr r1, [sp, #0xC]
add r7, r2, #0x0
add r5, #0x1
mov r12, r5
cmp r0, r1
bgt later
mov r4, #0x0
cmp r1, r0
beq later2
mov r4, #0x1
neg r4, r4
ldr r0, [sp, #0x14]
ldr r1, table
add r6, r0, r1
mov r3, sp
sub r3, #0x2
add r5, r7, #0x0
there: add r3, #0x2
add r4, #0x1
cmp r4, #0x3
bgt later2
ldr r0, [r6, #0x0]
add r0, r5, r0
ldrb r2, [r0, #0x0]
ldrb r0, [r0, #0x1]
lsl r0, r0, #0x8
orr r0, r2
ldrh r2, [r3, #0x0]
cmp r0, r2
bne there
later2: cmp r4, #0x4
bne later
mov r4, #0x0
cmp r4, r10
bge later3
mov r1, r9
ldr r0, [r1, #0x0]
add r0, r7, r0
ldrb r2, [r0, #0x0]
ldrb r1, [r0, #0x1]
lsl r1, r1, #0x8
orr r1, r2
ldr r0, [sp, #0x8]
ldrh r2, [r0, #0x0]
cmp r1, r2
beq later3
ldr r1, [sp, #0x14]
ldr r2, table
add r6, r1, r2
ldr r3, [sp, #0x8]
add r5, r7, #0x0
there2: add r3, #0x2
add r4, #0x1
cmp r4, r10
bge later3
ldr r0, [r6, #0x0]
add r0, r5, r0
ldrb r2, [r0, #0x0]
ldrb r0, [r0, #0x1]
lsl r0, r0, #0x8
orr r0, r2
ldrh r2, [r3, #0x0]
cmp r0, r2
bne there2
later3: cmp r4, r10
bne later
mov r0, r10
add r0, #0x1
mov r10, r0
lsl r2, r4, #0x1
ldr r1, [sp, #0x8]
add r2, r2, r1
mov r4, r9
ldr r0, [r4, #0x0]
add r0, r7, r0
ldrb r1, [r0, #0x0]
ldrb r0, [r0, #0x1]
lsl r0, r0, #0x8
orr r0, r1
strh r0, [r2, #0x0]
later: mov r5, r12
mov r1, r9
ldr r0, [r1, #0x0]
lsl r1, r5, #0x1
add r1, r1, r5
add r1, r1, r0
ldrb r0, [r1, #0x2]
cmp r0, #0xFF
bne main
mov r0, r10
add sp, #0x18
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
.align
table: .word 0x08FFFFFF



Change 0x43CE8 to 00 4A 10 47 XX XX XX 08 where the XX XX XX stands for the pointer to your new routine plus 1.

In PGE, you now need to open up the settings drop-down menu, and select "Use Jambo's Moveset hack" to support the new moveset style.

It is good practise (and will help avoid crashes) to repoint all your movesets to free space and start fresh with the new movesets.

Hey, I never said it would be easy!

Bear in mind, the same rules apply here as before. No status inflicting moves will work, so don't try them.

And you are done!

NOTE: For any intrepid people who wish to use the new moveset style without using PGE (I wouldn't advise it!), this is a short explanation of how they now work:

The new movesets are collections of 3 bytes each which are set up thus:
[MOVE - Half-Word - Reverse Hex] [Level - Byte]
So if I wanted my Pokémon's moveset to contain Pound at level 52, it would be:
01 00 34
To end the moveset, you put:
00 00 FF


So far, I'm betting you're wondering why I decided to post this in R&D when it's clearly a tutorial, right?

Wrong! It's just a necessary evil before we can discuss the REAL thing I want to research!

What I want us to research is the ANIMATIONS and BATTLE SCRIPTS associated with the moves and how we can extend both of the above so that we can create new moves which truly imitate their "real" counterparts.

So, does anyone have any pertinent information (above and beyond what we already know) about either subject mentioned above?

FWIW, this is (AFAIK) our best understanding of Battle Scripts. (http://www.pokecommunity.com/showpost.php?p=5731099&postcount=1)

EDIT: Since I posted this, I found the table which controls animations and was able to make a new move use an existing animation. Based on what I saw, I suspect that the game uses an "Animation Script" in the same vein as the "Battle Scripts". A specially set aside set of commands specifically used for creating move animations.

Gamer2020
September 27th, 2011, 07:16 PM
What I want us to research is the ANIMATIONS and BATTLE SCRIPTS associated with the moves and how we can extend both of the above so that we can create new moves which truly imitate their "real" counterparts.

So, does anyone have any pertinent information about either of the above(above and beyond what we already know) about either subject mentioned above?

FWIW, this is (AFAIK) our best understanding of Battle Scripts.


I would just like to add that I do have a very basic working Battle Script decompiler. I will be adding a battle script editor to PGE when I have documentation on all the commands so any help on this subject will actually help everyone.

NintendoBoyDX
September 27th, 2011, 11:06 PM
Search up Pokemon Vega as a Japanese hacker has already done this for Japanese firered. I'm currently researching it but my computer is havin problems atm.

Wiznatts
October 19th, 2011, 02:47 AM
http://www.youtube.com/watch?v=jbQP4--Z0Vg&feature=player_detailpage#t=118s

Here is a link to a video from Vega. The move Aerodactyl is using is indeed Brave Bird (I checked the Japanese characters on Bulbapedia). Animation and Effect are functional, though I'm not sure if this an animation that the game already used

Crimson5M
October 19th, 2011, 03:43 AM
http://www.youtube.com/watch?v=jbQP4--Z0Vg&feature=player_detailpage#t=118s

Here is a link to a video from Vega. The move Aerodactyl is using is indeed Brave Bird (I checked the Japanese characters on Bulbapedia). Animation and Effect are functional, though I'm not sure if this an animation that the game already used

Brave Bird and Sky attack use the same animation.

Ongekibou
October 19th, 2011, 08:27 AM
Are we sure battle scripts are programmed for each attack? Wouldn't it just be for each move effect?

Jambo51
October 19th, 2011, 02:41 PM
The battle script commands aren't specifically designed only to work with a certain attack. They are (generally) a bunch of commands, which, when put together, produce the effect of the attack in question.

Wiznatts
November 3rd, 2011, 06:20 PM
Based on your edit, does that mean that you could edit the data for Howl to, say, X-Scissor and then make it use the animation for Cross Chop? Because that would be useful as well.

Jambo51
November 4th, 2011, 03:26 AM
Yes. You can edit existing data, although there's little point. If you read the main post, you'll see that you can just add 1 extra attack onto the end of the table, instead of overwriting.

What we CAN'T do at this stage is change the EFFECTS of the attack. That is, we can't make it lower/raise stats, cause status ailments etc. This is because we don't understand the battle scripts well enough to use them to create new effects yet.

Yes, you can indeed use existing animations, and with great ease. I found the animation table in the ROM and it was linked to what I believe are Animation Scripts. All you would need to do would be point your new attack to that animation, and it would use it. I actually copied the existing table into the new slots for the expansion I've done thus far.

Wiznatts
November 5th, 2011, 09:25 AM
Well, there are many attacks that are exact duplicates of each other in terms of effect, such as Withdraw/Defense Curl/Harden (aside from the added effect of Rollout). I was looking to take these duplicates and replace them with attacks from later Generations. Obviously, being able to add them without replacing is the goal, but I'd rather have a few fully functional new attacks now than sacrifice animations for attacks that just do damage.

Jambo51
November 5th, 2011, 01:11 PM
Well, there are many attacks that are exact duplicates of each other in terms of effect, such as Withdraw/Defense Curl/Harden (aside from the added effect of Rollout). I was looking to take these duplicates and replace them with attacks from later Generations. Obviously, being able to add them without replacing is the goal, but I'd rather have a few fully functional new attacks now than sacrifice animations for attacks that just do damage.

I've worked out how to use existing animations for now actually. I don't have anything noted down though, so I'll need to look it up again.

Chaos Rush
December 10th, 2011, 08:51 PM
This might help with adding new moves, but here's a list of all effect numbers:

0 = no added effect
1 = puts target to sleep
2 = posion the target
3 = abosrbs half the damage inflicted (Absorb, Mega Drain, etc.)
4 = burn the target
5 = freeze the target
6 = paralyze the target
7 = Selfdestruct, Explosion
8 = takes 1/2 of damage inflicted on sleeping foe (Dream Eater)
9 = Mirror Move
10 = raises user's Attack
11 = raises user's Defense
12 = raises user's Speed
13 = raises user's Special Attack
14 = raises user's Special Defense
16 = raises user's evasion
17 = never misses
18 = lowers opponent's Attack
19 = lowers opponent's Defense
20 = lowers opponent's Speed
21 = lowers opponent's Special Attack
22 = lowers opponent's Special Defense
23 = lowers opponent's Accuracy
24 = lowers opponent's evasion
25 = Haze (there's many effects associated exclusively with this move)
26 = Bide
27 = Thrash/Petal Dance/Outrage
28 = Whirlwind/Roar effect
29 = happens 2-5 times
30 = Conversion
31 = may cause flinching
32 = Recover 1/2 of maximum HP
33 = badly poisons foe
34 = Pay Day
35 = Light Screen
36 = may freeze, paralyze, or burn
37 = Rest
38 = 1-hit KO
39 = takes 2 turns + high critical hit ratio (Razor Wind)
40 = always cuts half of foe's current HP
41 = always do 40 HP damage (Dragon Rage)
42 = Bind/Fire Spin/Clamp/Whirlpool effect
43 = high critical hit ratio
44 = hits twice (Double Kick)
45 = if miss, then user receives 1/8 of damage it would have dealt (Jump Kick)
46 = stops stat changes (Mist)
47 = raises user's critical-hit ratio
48 = recoil damage, 1/4 of damage (Take Down)
49 = Confuse target
50 = sharply raises users Attack
51 = sharply raises users Defense
52 = sharply raises users Speed
53 = sharply raises users Special Attack
54 = sharply raises users Special Defense
57 = Transform
58 = sharply reduces foe's Attack
59 = sharply reduces foe's Defense
60 = sharply reduces foe's Speed
61 = sharply reduces foe's Special Attack
62 = sharply reduces fow's Special Defense
65 = Reflect
66 = poisons the target (again, for some reason)
67 = paralyzes the target (again, for some reason)
68 = lower opponent's Attack
69 = lower opponent's Defense
70 = lower opponent's Speed
71 = lower opponent's Special Attack
72 = lower opponent's Special Defense
73 = lower opponent's accuracy
75 = takes 2 turns, may cause opponent to flinch
76 = may Confuse target
77 = hits twice, may poison opponent (Twineedle)
78 = never misses, but attacks second
79 = Substitute
80 = immobile next turn (Hyper Beam)
81 = raises user's Attack every time is hit (Rage)
82 = Mimic
83 = Metronome
84 = steals opponent HP every turn (Leech Seed)
85 = Splash
86 = Disable
87 = damage is equal to user's level (Seismic Toss/Night Shade)
88 = amount of damage done varies (Psywave)
89 = Counter
90 = Encore
91 = Pain Split
92 = can only use this attack if user is asleep (Snore)
93 = Conversion 2
94 = next move after will not miss (Mind Reader)
95 = Sketch
97 = Sleep Talk
98 = Destiny Bond
99 = inflicts more damage if user has less HP (Flail, Reversal)
100 = Spite (cuts opponent's PP)
101 = False Swipe (will never make opponent faint)
102 = heals all status problems
103 = always attacks first
104 = attacks 3 times, gets stronger each time (Triple Kick)
105 = steal foe's held item
106 = prevents foe from fleeing/switching
107 = inflicts 1/4 damage on sleeping foe (Nightmare)
108 = raises user's evasion, receives double damage from Stomp
109 = Curse
111 = Protect/Detect
112 = Spikes
113 = Foresight
114 = Perish Song
115 = Sandstorm
116 = Endure
117 = Rollout/Ice Ball
118 = Swagger
119 = Fury Cutter
120 = Attract
121 = higher attack power if Pokemon happiness is higher
122 = Present
123 = higher attack power if Pokemon happiness is lower
124 = prevents all status problems from user
125 = thaw out if frozen, may burn target (Flame Wheel/Sacred Fire)
126 = Magnitude
127 = Baton Pass
128 = Pursuit
129 = Rapid Spin (removes Fire Spin, Whirlpool, etc.)
130 = always do 20 HP damage (SonicBoom)
132 = Morning Sun
133 = Synthesis
134 = Moonlight
135 = Hidden Power
136 = Rain Dance
137 = Sunny Day
138 = 10% chance of raising user's Defense (Steel Wing)
139 = may raise user's Attack (Metal Claw)
140 = may raise user's Attack, Defense, Speed, Special Attack, and Special Defense
142 = maximizes Attack, HP is cut in half (Belly Drum)
143 = Psych Up
144 = Mirror Coat (special version of Counter)
145 = takes 2 turns, raises user's Defense (Skull Bash)
146 = may flinch opponent, double the damage if opponent uses Fly or Bounce
147 = does double the damage if opponent is using Dig
148 = Future Sight
149 = does double the damage is opponent is using Fly or Bounce
150 = may cause flinching + attack power is doubled if opponent used Minimize
151 = takes 2 turns, unless Sunny Day is in effect. Only 1/2 the damage if Rain Dance, Sandstorm, or Hail
152 = Thunder (there's many effects associated exclusively with this move)
153 = Teleport
154 = Beat Up
155 = takes 2 turns
156 = raises user's Defense, power of Rollout and Ice Ball is now doubled
157 = Softboiled/Milk Drink (Recover, but usable out of battle)
158 = Attacks first, causes flinching (Fake Out)
159 = Prevents sleep, attacks for 2-5 turns (Uproar)
160 = Stockpile
161 = Spit Up
162 = Swallow
164 = Hail
165 = Torment
166 = Confuses foe, but raises foe's Special Attack
167 = Burns the foe, but doesn't affect Fire types
168 = Memento
169 = Boosts Attack when burned, paralyzed, or poisoned
170 = takes 2 turns, but if hit user flinches (Focus Punch)
171 = Stronger against paralyzed foes, but heals the paralysis (SmellingSalt)
172 = Makes foes attack only the user (Follow Me)
173 = Nature Power
174 = Next electric move used is now stronger (Charge)
175 = Taunt
176 = Helping Hand
177 = Trades held items with foe
178 = copies opponent's special ability
179 = Wish
180 = attacks randomly with one of partner's moves (Assist)
181 = Ingrain
182 = lowers user's Attack and Defense
183 = Magic Coat
184 = Recycle
185 = double the damage if user was hurt by opponent in the same turn
186 = destroyes Light Screen and Reflect (Brick Break)
187 = Yawn
188 = opponent loses held item (Knock Off)
189 = Endeavor
190 = the higher user's HP, the more damage
191 = user swaps abilities with opponenet (Skill Swap)
192 = Imprison
193 = Refresh
194 = Grudge
195 = Snatch
196 = more damage on heavier foes (Low Kick)
197 = Secret Power
198 = recoil damage, 1/3 of damage (Double-Edge)
199 = confuses all Pokemon on the scene (Teeter Dance)
200 = high critical hit ratio + may cause burn (Blaze Kick)
201 = Mud Sport
202 = damage + badly poison target
203 = type and power depends on weather (Weather Ball)
204 = sharply lowers Special Attack after use (Overheat)
205 = lower's opponent's Attack and Defense (Tickle)
206 = raises user's Defense and Special Defense (Cosmic Power)
207 = can hit an opponent using Fly or Bounce (Sky Uppercut)
208 = raises user's Attack and Defense (Bulk Up)
209 = high critical hit ratio + poison
210 = Water Sport
211 = raises user's Special Attack and Special Defense (Calm Mind)
212 = raises user's Attack and Speed (Dragon Dance)
213 = Camouflage

Note that there are some (well hardly any) numbers that are missing, and that's only because no attack uses the effect number.

Jambo51
December 11th, 2011, 03:45 AM
This could (in fact) be very helpful, as I can use it to track down what battle script command does what. The only difference now is that I won't be doing it blindly. So thank you. You may possibly have saved me a huge amount of time.

Chaos Rush
December 11th, 2011, 09:43 AM
This could (in fact) be very helpful, as I can use it to track down what battle script command does what. The only difference now is that I won't be doing it blindly. So thank you. You may possibly have saved me a huge amount of time.
You're welcome lol, I guess it also helps that some moves have exclusive effects, such as Thunder. I would imagine that if you were to do Fusion Bolt on a Gen III game, it would look like Fly + Thunder.

Also here's a Japanese rom hack that has plenty of Gen IV moves incorporated, perhaps it could help give you ideas for animations:
http://www.youtube.com/watch?v=XGpqbjA-aow&feature=related

(I can read Japanese, so here's where you can see the new moves)
0:33 - Focus Blast
1:07 - Gunk Shot
1:58 - Energy Ball
2:15 - Aqua Jet
3:39 - a custom attack using katakana to spell out, "Hurricane", which is kinda odd because Hurricane's japanese name is Boufou, not Harikeen
4:54 - Hammer Arm


EDIT: Since I posted this, I found the table which controls animations and was able to make a new move use an existing animation. Based on what I saw, I suspect that the game uses an "Animation Script" in the same vein as the "Battle Scripts". A specially set aside set of commands specifically used for creating move animations.
EDIT: Um... is there any reason why you didn't tell us the offset of the animation table? If you force everyone to find it themselves, it's gonna be a lot harder for people to help with the research.

Gamer2020
December 18th, 2011, 10:12 AM
Finally, overwrite the bytes at 0xD75FC with 00 00 00 00 00 00 to disable the only limiter in the ROM. If you do not edit this, rather than saying "Bulbasaur used VenoShock!", it will say "Bulbasaur used a POISON move!"


I had a couple of free minutes so I did a little tinkering. I think that the location for this in Emerald should be 0x14E504. I will find the locations of other stuff when I get a chance.

Jambo51
December 18th, 2011, 03:13 PM
EDIT: Um... is there any reason why you didn't tell us the offset of the animation table? If you force everyone to find it themselves, it's gonna be a lot harder for people to help with the research.

There's no reason per sé, I just forgot to post it what with my exams and everything.
The table (in FR) is at 0x1C68F4. It starts with move 0x0 (an invalid move - left in as an error handler) and carries on in order of the moves in the game.

This is a table of pointers to animation scripts. Somehow they link together from the script to animation on screen, though i've not worked it out yet.

colcolstyles
December 18th, 2011, 07:27 PM
EDIT: Since I posted this, I found the table which controls animations and was able to make a new move use an existing animation. Based on what I saw, I suspect that the game uses an "Animation Script" in the same vein as the "Battle Scripts". A specially set aside set of commands specifically used for creating move animations.

Yeah, I've been doing some research and that seems to be the case. In Emerald, the table of animation scripts is at 0x2c8d6c and the table of animation commands is at 0x525e98. I only just started so I don't know what the majority of the commands do but (and these are just educated guesses) 0x00 loads graphics, 0x02 starts an animation, and 0x05 waits for all current 0x02 animations to finish before continuing the script execution. It seems like all the interesting stuff will be located inside 0x02. I'll take a look at it when I get the chance.

I had a couple of free minutes so I did a little tinkering. I think that the location for this in Emerald should be 0x14E504. I will find the locations of other stuff when I get a chance.

Yeah, that's where the limiter is. I changed the byte at 0x14e50b to 0xe0 which changes the 'bls' instruction to a 'b' instruction.

DoesntKnowHowToPlay
February 21st, 2012, 11:45 AM
I've been messing around with these a bit, and thought I'd post some of the stuff I found. All of this is for FR, although I assume it'll be similar for other versions. It's also a bit rambly and unprofessional, as I haven't spent too much time investigating these, for which I apologize.

0x00 loads image data, and seems to always take 2 bytes as an argument.

As colcolstyles said, 0x2 seems to execute animations while 0x5 waits for them to finish before continuing.

0x08 terminates execution.
Jump functions seem to exist, but since they go to other places in the ROM this means scripts always seem to end in 08 (although an 08 is not always a terminator).

0x19 does something with sounds.

14 17 16 03 2D B8 0B 08 05 04 00 XX 00 YY 00 00 FF FF starts the Silver Wind background. XX determines how fast the background scrolls horizontally, while YY determines how fast it scrolls vertically. These default to FA and 00, and should probably be left as such. The FFs at the end, if changed, cause the background to continue scrolling after execution.

This script:

14 17 16 03 2D B8 0B 08 05 04 00 FA 00 00 00 00 FF FF
Stuff
04 00 03 F9 A7 0B 08 0A 05 01 00 00 00 04 00 04 00 00 00 17 04 00 04 00 04 06 04 00 04 00 05 19 7E 00 3F 0B 03 04 00 15 16 03 3D A8 0B 08 0A 05 01 00 00 00 04 00 00 00 00 00 10 07 FF FF 17 08

Starts the silver wind animation, executes whatever is in Stuff, and then stops the Silver Wind animation. There may be a few commands that aren't needed in there, but I was able to create animations for Quiver Dance and X-Scissor.

Jambo51
March 17th, 2012, 06:30 AM
Ok - This is what I have managed to come up with over the last few weeks/months.

Once I stopped getting caught up in understanding what each and every command actually does, and started looking at the bigger picture, I realised that there are groups of commands which, when executed together, produce the effect we are looking for. If we were ever to create a compiler for battle scripts - I would term these as "super commands".

So, without further ado - the combination of commands which activates the stat changing effects:


48 [Side - Byte] [Colour - Byte] [Unknown - Byte] // Stat Change Animation
2E [RAM Pointer - Always 0x02023FDE for this! - Word] [Effect - Byte] // Stores what effect to execute
89 [Side - Byte] [ROM Pointer - Script to execute if failed (I think)] // Actually changes the stat, based on what you stored into 02023FDE above.
12 40 00 // Puts [stat] fell/rose onto screen, and delays for a little over a second.


Obviously, these differing bytes will all need quantified. I'll start at the top:

Command 48:As far as I can tell, this is simply one of many animation commands, but this one is specifically set aside for the stat changing animations.

Side - Can be either 0 or 1. 0 is the opponent, and 1 is the user.

Colours - These are weird. There are only 3 colours however, so I've taken to using 3 numbers.
0x2 - Red (Attack and Special Attack)
0x3 - Blue (Everything else)
0x4 - Green (Defense and Special Defense)

Unknown Byte - This may control the direction of the animation, though I'm not sure.
0x9 - Down
0x0 - Up


Command 2E (storebyte):This command stores a given byte into the RAM address given to the command.

RAM Address - It can obviously be different for different effects, but most effects store a byte into the RAM Address 0x02023FDE.

Effect to Trigger - This is gonna be a fairly long list!Note: There are far more effects than this, but I don't have a list of them to hand.

Raising One Level:
0x11 - Attack
0x12 - Defense
0x13 - Speed
0x14 - Special Attack
0x15 - Special Defense
0x16 - Accuracy
0x17 - Evasion

Raising Two Levels:
0x21 - Attack
0x22 - Defense
0x23 - Speed
0x24 - Special Attack
0x25 - Special Defense
0x26 - Accuracy
0x27 - Evasion

Lowering One Level:
0x91 - Attack
0x92 - Defense
0x93 - Speed
0x94 - Special Attack
0x95 - Special Defense
0x96 - Accuracy
0x97 - Evasion

Lowering Two Levels:
0xA1 - Attack
0xA2 - Defense
0xA3 - Speed
0xA4 - Special Attack
0xA5 - Special Defense
0xA6 - Accuracy
0xA7 - Evasion



Command 89 (executestatchange):Executes the effect stored at 0x02023FDE.

Side - It's actually more than this, but I wasn't able to work out what exactly. It definitely controls side as well, however.

0xC1 - User
0x41 - Opponent

Script Pointer - A pointer to a battle script to branch to. Not entirely sure if this is for failure, but I suspect it is since the ROM continues execution of the existing script if the stat change succeeds.


Command 12 (showstatus):Prints the result of the changed stat to screen. Takes a frame delay as a parameter. This seems to work out in the background (possibly by reading 0x02023FDE) what effect was executed.

40 00 - 0x40 - 64 frame delay. At GBA's running speed. That is almost exactly 1 second of delay.

Fantastic - So far I've only talked about changing stats. What about burning, poisoning or damaging the foe? Well, these require yet more different commands!

So, we want to create a basic attack that does damage. This is how it's structured (all numbers are in hex):00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 15 19 00 00 00 00 00 00 2E D8 3F 02 02 00 49 00 00 3D

See why I put it in a spoiler? The thing is, if you search for this string in your BPRE ROM, you will find it already exists, so why do we need to know about it at all? Why not just directly call that existing script? The answer is because a lot of the new moves use combinations of existing effects. This is something we cannot achieve simply by using the existing scripts. However, what we CAN do, and I advise you should do, is branch back to this script at the earlist available opportunity, after executing your effects.

Now, the most important part of that script for our purposes is towards the end. The 0x15 byte is the byte which takes care of any added effects that the attack may have. It reads from 0x02023E85 to find what effect it should execute. So why did I bother showing you what's above, I hear you asking.

The stuff that is above isn't reliant on a branch back to this code! You can simply end the execution of the effect(s) by using the return command (0x3C or 0x3D).
It basically comes down to this: If your attack does damage - use this new way, if it doesn't, use the older way from above.

I'll try to explain this with an example: Let's say we want to have Flare Blitz. Flare Blitz does damage, causes recoil AND can cause a burn. This is a combination of 2 existing effects, but because it has to do damage as well, we can't simply use the stat changing method. What do we do?

Firstly, we take care of the damage part of the attack. This is the section of the huge script from above that is in italics. All that nonsense takes care of causing damage to the opponent. So we need that:

Current Code for Flare Blitz:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00

Excellent. Our attack would now do damage, carry an animation and all that good stuff.
Now, what effect gets executed next for Flare Blitz? Well - The recoil effect, of course! So, how to we go about finding how to use this effect?

The recoil effect we want is already in the ROM, however, we cannot simply call that one, because the game wouldn't then go on to execute the burn effect. What we need to do is take the relevant part of the recoil effect and insert it into our script, then execute it.

So, knowing that the recoil effect we want is number 198 (the same recoil effect as Double-Edge for anyone wondering where I pulled that number from), we can find the corresponding script easily enough. The table of effects starts at 0x1D65A8 in BPRE. So, we find the 198th entry in that table, and go to the script's location. What we see is what byte is stored, and to where, to execute the recoil effect. So we copy the storebyte command (2E) and all it's parameters to gain the effect.

Current Code:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6

Now we must execute the effect. Well, that's easy. Command 0x15 executes effects, so we simply add a 15 to the script.

Current Code:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6 15

Excellent - but so far, we've only added 1 of the 2 effects, and it's taken a lot of work! Thankfully, from here on out, it gets easier, as for each effect, you simply repeat the cycle of store and execute until completion. So we want to add the burn effect now. The burn effect byte is 0x3, so we now stick a storebyte for that byte into the end of the script, as well as an execute effect command.

Current Code:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6 15 2E 85 3E 02 02 03 15

Now, that's all of the effects which can be added for this attack directly (the defrosting is handled passively elsewhere), so now what do we do?
Ah yes, as per what I said earlier, we should return to the original script as soon as possible. So now we simply put a Goto command onto the end of the script, returning back to normal execution.

Flare Blitz Code:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6 15 2E 85 3E 02 02 03 15 28 47 69 1D 08

There we have it! One functional Flare Blitz effect.The recoil will ALWAYS happen, so you don't need to worry about clashes between the recoil and the CHANCE of burning, but if you have 2 effects such as flinch and burning which both rely on chance, they both must share the same chance of happening. This is simply a limiation of the code's design. It is possible for BOTH effects to happen at the same time, so you can't have a chance for poison combined with a chance for paralysis (for example).

Feel free to test out and use this battle script! Using this methodology, it is possible to combine any existing effects in the BPRE 1.0 ROM, which makes the vast majority of Gen 4's (and a fair number of Gen 5's) moves possible on Gen 3 ROMs, animations notwithstanding. A short health warning, all the pointers I include in this post apply specifically to BPRE. However, this string of commands:02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 15 19

should appear in all of the Gen 3 ROMs.

redriders180
March 17th, 2012, 09:02 PM
Post

This is really neat...now I can put new moves in my game? I just have one question...making this script makes plenty of sense, but what exactly do I do with it? Forgive me for sounding noobish, but I can't find an offset, or a way to find an offset, anywhere :(. I just did the tutorial you posted in the OP, so I really hope this new revelation is supported by that...

Speaking of which, is said tutorial updated? I'm confused, since before, it was "make sure effect byte is set to zero". Is this still true? Basically, I don't understand what we can and can't do.

Fiori
March 18th, 2012, 12:48 AM
i think in this script it also need something to do when the opponent use "protect"

DoesntKnowHowToPlay
March 18th, 2012, 08:33 AM
In FR, the battle script pointer table is at 0x1D6926. If you want to add a new move effect, you'll need to repoint one of the pointers there to your new battle script, and make sure your new moves are using that effect. There are a number of "holes" in the table, such as at #12 (which would be, going by the pattern, an effect that gives +1 to the user's speed), but if you use those the AI probably won't interpret them correctly (or at all).

Also, thank you very much for that very helpful post Jambo. I wouldn't have been able to find the table at all without your attack script.

redriders180
March 18th, 2012, 09:49 AM
In FR, the battle script pointer table is at 0x1D6926. If you want to add a new move effect, you'll need to repoint one of the pointers there to your new battle script, and make sure your new moves are using that effect. There are a number of "holes" in the table, such as at #12 (which would be, going by the pattern, an effect that gives +1 to the user's speed), but if you use those the AI probably won't interpret them correctly (or at all).

Also, thank you very much for that very helpful post Jambo. I wouldn't have been able to find the table at all without your attack script.

But is it possible to expand the battle script pointer table as well? For instance, it only goes up to 213 right now, surely it can go to 255?

Jambo51
March 19th, 2012, 04:28 AM
i think in this script it also need something to do when the opponent use "protect"

No, we don't. It's all handled by the damage part of the script. Quite clever, isn't it?

Also, thank you very much for that very helpful post Jambo. I wouldn't have been able to find the table at all without your attack script.

You're welcome, although the pointer you posted isn't the pointer table to the battle scripts, it's the actual basic damage script itself, lol!

I actually gave the location in my post, so use that instead. The great thing is that all text and delays and such are ALL handled by the script, so it makes adding new attacks much easier! :)

Xenesis
March 19th, 2012, 05:04 AM
Haha, this is amazing.

It's like playing legos with attacks.

Jambo51
March 19th, 2012, 11:07 AM
Haha, this is amazing.

It's like playing legos with attacks.

Yes, it rather is. Nice analogy.

But is it possible to expand the battle script pointer table as well? For instance, it only goes up to 213 right now, surely it can go to 255?

I just updated the OP now. Yeah, it can support up to 255 effects without a rewrite.

droomph
March 19th, 2012, 02:52 PM
Where's a compilation of your findings? Just asking.

But anyways, if I'm not mistaken, there's a lot of differences between the games, right?Oh and btw in Emerald 0xC is "set-transparency" or something. It takes two parameters, usually 0xC and 0x8, as front-transparency (the yellow part), and the back-transparency (the black part). How the yellow-and-black got there, however, I don't know.

Also, 0x8 is "end", and takes no arguments.I'm sorry if I'm so stupid sometimes.

Many apologies, I'm only 15.

Jambo51
March 19th, 2012, 03:57 PM
Where's a compilation of your findings? Just asking.

But anyways, if I'm not mistaken, there's a lot of differences between the games, right?Oh and btw in Emerald 0xC is "set-transparency" or something. It takes two parameters, usually 0xC and 0x8, as front-transparency (the yellow part), and the back-transparency (the black part). How the yellow-and-black got there, however, I don't know.

Also, 0x8 is "end", and takes no arguments.I'm sorry if I'm so stupid sometimes.

Many apologies, I'm only 15.

No. The thing you quoted is an ANIMATION SCRIPT, while the thing I posted about is a BATTLE SCRIPT. One is used to execute the animation played when you use the move, while the other is used to actually execute the move and all its effects. Hope that helps.

I somewhat suspect that the battle scripts and animations scripts will be identical (offsets aside, of course) between RSE and FRLG. I could be wrong, though.

I don't really have a compilation of findings - I simply posted how you can go about creating any combination of effects by showing an example. Obviously, you can simply swap in different effects from the ones I showed (or add extra ones). Earlier in this thread, ChaosRush posted a very useful list of effect ID numbers and what they actually do, which I used to find the effects I needed.

droomph
March 19th, 2012, 04:43 PM
Yeah, it seemed too good to be true anyways.

Thanks! Yeah, it was kinda weird.

Although, when I ran something from one of the posts before, it called the animation script, e.g. it actually ran (the commands I just mentioned) for the move. I don't really know...

Never mind. I was reading something wrong.

Jambo51
March 19th, 2012, 05:15 PM
Yeah, the Battle Scripts call the Animation Scripts as part of their procedure. It's not all that weird, really.

redriders180
March 19th, 2012, 07:21 PM
OK, I'm either crazy, or just not seeing it...there aren't any existing effect bytes that lower the users stats? That seems crazy...surely there was one move out of the 354 introduced that would lower the users something >.>

If I can't lower my own stats, It seems like alot of Gen IV and Gen V moves are undoable!

Edit: I'm trying to reproduce Hammer Arm, so it needs to do damage as well...It's this "lowering stats" bit that's making me hit a road block.

droomph
March 20th, 2012, 12:11 AM
OK, I'm either crazy, or just not seeing it...there aren't any existing effect bytes that lower the users stats? That seems crazy...surely there was one move out of the 354 introduced that would lower the users something >.>

If I can't lower my own stats, It seems like alot of Gen IV and Gen V moves are undoable!

Edit: I'm trying to reproduce Hammer Arm, so it needs to do damage as well...It's this "lowering stats" bit that's making me hit a road block.I believe Overheat lowers your Sp. Atk. by two levels, you could probably look over on that.

Xenesis
March 20th, 2012, 02:21 AM
Superpower also lowers your attack and defence by one stage.

Fiori
March 20th, 2012, 06:19 AM
2E 85 3E 02 02 E6 15
about the "E6"
i think the highest bit means whether the effect depends on the effect accuracy
1 means the effect always occurs,
0 means the effect only has x%(effect accuracy) chance to occur.

so "E6" always causes recoil , while "66" dpends on the effect accuracy

Rasenshurikenbum
March 20th, 2012, 12:27 PM
Is it possible to make new command for battle script? For example attack and lowering user's defense and special defense by one stage (like close combat)

Jambo51
March 20th, 2012, 02:18 PM
2E 85 3E 02 02 E6 15
about the "E6"
i think the highest bit means whether the effect depends on the effect accuracy
1 means the effect always occurs,
0 means the effect only has x%(effect accuracy) chance to occur.

so "E6" always causes recoil , while "66" dpends on the effect accuracy

Hmm, that could be a really good shout. The game definitely does check this highest bit on reading it to execute effects.

Is it possible to make new command for battle script? For example attack and lowering user's defense and special defense by one stage (like close combat)

It's possible, but pointless. I explicitly explained how to use existing commands in a combination to produce effects like close combat. For creating NEW effects, I wrote a "callasm" command.

droomph
March 20th, 2012, 02:25 PM
Also, for you Emerald people out there, the table of battle-instructions is located at 0x31BD10.

redriders180
March 20th, 2012, 03:52 PM
Hmm, that could be a really good shout. The game definitely does check this highest bit on reading it to execute effects.



It's possible, but pointless. I explicitly explained how to use existing commands in a combination to produce effects like close combat. For creating NEW effects, I wrote a "callasm" command.

I tried to make a close combat that works, but it kept freezing up after the animation for the defense drop. I guess it's just bad programming...but I have a small annoyance. I wrote the following script for Hammer Arm:

00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6 15 2E 85 3E 02 02 03 15 28 47 69 1D 08

And while the speed drop does occur, it doesn't say so. How do I make it say that _____s speed dropped?

I know this seems like its turning into a question thread, but can someone maybe explain how to make multiple stats drop without freezing up?

droomph
March 20th, 2012, 09:35 PM
I tried to make a close combat that works, but it kept freezing up after the animation for the defense drop. I guess it's just bad programming...but I have a small annoyance. I wrote the following script for Hammer Arm:

00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6 15 2E 85 3E 02 02 03 15 28 47 69 1D 08

And while the speed drop does occur, it doesn't say so. How do I make it say that _____s speed dropped?

I know this seems like its turning into a question thread, but can someone maybe explain how to make multiple stats drop without freezing up?Hm...Have you tried looking into the script for AincentPower? Although that raises your stats, not decrease it, I think it could be the same process for the opposite...

Fiori
March 20th, 2012, 11:35 PM
For creating NEW effects, I wrote a "callasm" command.
Could you share your code? and i'm curious what effects you did?

2E 85 3E 02 02 E6 15
also about "E6"
the second bit means the objective of the effect
0 : opponent
1 : user

the else 6 bits means what effect it does
01: sleep
02: poison
03: burn
04: freeze
05: paralyze
06: badly poison
07: confusion
08: flinch
09: paralyze
0a: uproar
0b: get money
0c: fight to death
0d: sand tomb
0e: recoil 1/4
0f: Attack Raising One Level
10: Defense
11: Speed
12: Special Attack
13: Special Defense
14: Accuracy
15: Evasion
16: Attack Lowering One Level
17: Defense
18: Speed
19: Special Attack
1a: Special Defense
1b: Accuracy
1c: Evasion
1d: need recovery energy
1e:
1f: steal item
20:
21:
22: ALL states Raising One Level
23:
24:
25: Attack and Defense Lowering One Level
26: recoil 1/3
27: Attack Raising Two Levels
28: Defense
29: Speed
2a: Special Attack
2b: Special Defense
2c: Accuracy
2d: Evasion
2e: Attack Lowering Two Levels
2f: Defense
30: Speed
31: Special Attack
32: Special Defense
33: Accuracy
34: Evasion
35: similar as Outrage
36: Knock Off
37:
38:
39:
3a:
3b: Special Attack Lowering Two Levels
3c:
3d:
3e:
3f:

over

Jambo51
March 21st, 2012, 12:09 PM
I wrote the following script for Hammer Arm:

00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6 15 2E 85 3E 02 02 03 15 28 47 69 1D 08

You didn't write that, I did. You copied the Flare Blitz effect verbatim. I explained step by step how to find the effect you want, and how to use it. You haven't done any of it in this case. Also, as I said, it will only work on BPRE 1.0. It WILL NOT work on any other ROM, or at least, not in the form that I gave it.

Hm...Have you tried looking into the script for AincentPower? Although that raises your stats, not decrease it, I think it could be the same process for the opposite...

Hammer Arm lowers the user's speed, doesn't it? In which case, the code should be thus:

00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 48 01 03 09 2E DE 3F 02 02 93 89 C1 62 8F 1D 08 12 40 00 28 47 69 1D 08

I knocked this up quickly, so it might not be 100% right.

DoesntKnowHowToPlay
March 21st, 2012, 01:07 PM
Jambo, he probably made the same goof I did and copied the wrong thing, as he claimed to have a partially working Hammer Arm (which that clearly isn't). And your Flare Blitz actually seems to work just fine in vanilla FR.

If you don't mind piggybacking off the game's code (and are using FR), try this:

2E 85 3E 02 02 58 28 00 69 1D 08

The 58 may be incorrect as I haven't tested this...it's basically Metal Claw/Steel Wing with the effect byte changed.

As for making a version that doesn't use the game's scripts, I knocked this up real quick from the Close Combat I made last night:

00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 58 15 28 47 69 1D 08

And if anyone was curious about the Close Combat script...it works, but it doesn't apply the debuffs in the graceful manner Superpower does- it plays the -defense animation twice rather than doing one animation appropriate to what is being debuffed.

00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 57 15 2E 85 3E 02 02 5A 15 28 47 69 1D 08

Jambo51
March 21st, 2012, 02:13 PM
I also made a close combat one which rather ungracefully applies the stat changes. I'm not awfully sure why this happens, in all honesty.

I'm glad to see that people are willing to test this stuff out and push its limits though! I put a lot of time and effort into working out how and why the game did certain things, so it's nice to see it's appreciated. :)

redriders180
March 22nd, 2012, 08:25 AM
Sorry Jambo! It must've been a typo, because I was sure I copied the code from my Hex Editor, but I guess I selected the wrong thing.

The code you gave me does the same thing, it lowers the speed, and plays the animation, but it doesn't say "______s Speed fell!". I wonder if this is something worth trying to figure out. Actually, I think we should figure out how to make moves to display types of strings...It's probably dependent on the effect bytes, and not the move itself, but I'm sure you all knew that.

Also, Jambo, do you mind giving some insight on making moves that are NOT combinations of existing effects? I know you mentioned ASM, but I don't know where you'd put the ASM. Thanks!

droomph
March 24th, 2012, 03:49 PM
Could you share your code? and i'm curious what effects you did?2E 85 3E 02 02 E6 15also about "E6"
the second bit means the objective of the effect
0 : opponent
1 : user

the else 6 bits means what effect it does01: sleep
02: poison
03: burn
04: freeze
05: paralyze
06: badly poison
07: confusion
08: flinch
09: paralyze
0a: uproar
0b: get money
0c: fight to death
0d: sand tomb
0e: recoil 1/4
0f: Attack Raising One Level
10: Defense
11: Speed
12: Special Attack
13: Special Defense
14: Accuracy
15: Evasion
16: Attack Lowering One Level
17: Defense
18: Speed
19: Special Attack
1a: Special Defense
1b: Accuracy
1c: Evasion
1d: need recovery energy
1e:
1f: steal item
20:
21:
22: ALL states Raising One Level
23:
24:
25: Attack and Defense Lowering One Level
26: recoil 1/3
27: Attack Raising Two Levels
28: Defense
29: Speed
2a: Special Attack
2b: Special Defense
2c: Accuracy
2d: Evasion
2e: Attack Lowering Two Levels
2f: Defense
30: Speed
31: Special Attack
32: Special Defense
33: Accuracy
34: Evasion
35: similar as Outrage
36: Knock Off
37:
38:
39:
3a:
3b: Special Attack Lowering Two Levels
3c:
3d:
3e:
3f:overI dunno what you mean, but here's what I've got:callable effects (0x02024335):
0x0…0x80 - Nothing (May have some effects in between)
0x81 - Opponent sleep
0x82 - Opponent poison
0x83 - Opponent burned
0x84 - Opponent frozen
0x85 - Opponent paralyzed
0x86 - Opponent badly poisoned (Toxic)
0x87 - Opponent confused
0x88 - Opponent flinch
0x89 - Opponent burned, frozen, paralyzed (Tri-Attack)
0x8A - User causes UPROAR
0x8B - Coins scattered everywhere (Payday)
0x8C - Opponent uses same move as you (until faint?)
0x8D - Trapped by SAND TOMB! Buffers move that caused being trapped, plays Constrict anim. okay wtf
0x8E - Recoil
-----0x8F - Opponent's attack is raised (Swagger)
0x90 - Opponent's defense is raised (For completion?)
0x91 - Opponent's speed is raised
0x92 - Opponent's special attack is raised
0x93 - Opponent's special defense is raised
0x94 - Opponent's accuracy is raised
0x95 - Opponent's evasiveness is raised
-----0x96 - Opponent's attack is lowered
0x97 - Opponent's defense is lowered
…(same pattern as above)
0x9C - Opponent's evasiveness is lowered
-----0x9D - Opponent must recharge! (Hyper Beam?)
0x9E…0xA4 - Nothing (might have some in between)
0xA5 - User's attack and defense fell!
0xA6 - User got hit by recoil!
-----0xA7 - Opponent's attack sharply rose

0xAD - Opponent's evasiveness sharply rose
-----0xAE - Opponent's attack harshly fell

0xB4 - Opponent's evasiveness harshly fell
0xB5…0xC8 - Nothing (might have some in between)
0xC9 - Opponent frozen, burned, or paralyzed (Tri-Attack)
0xCA - User is making an Uproar! (I don't know why)
0xCB - Payday

0xCD - Constricted
0xCE - User is hit with recoil
-----0xCF - User's attack is raised

0xD5 - User's evasiveness is raised
-----0xD6 - User's attack fell

0xDC - User's evasiveness fell
0xDD…0xE4 - Nothing (might have some in between)
0xE5 - User's Attack and Defense fell
0xE6 - User is hit by recoil
-----0xE7 - User's attack sharply rose

0xED - User's evasiveness sharply rose
-----0xEE - User's attack harshly fell

0xF4 - User's evasiveness harshly fellIt's probably because I have Emerald (or because I called it directly through 0x15), but yeah. Nothing below 0x80 seems to do anything

PS How do you do the do um...How do you find the actual move-script (not the effects-script)?

Jambo51
March 25th, 2012, 02:20 AM
Sorry Jambo! It must've been a typo, because I was sure I copied the code from my Hex Editor, but I guess I selected the wrong thing.

No need to apologise, everyone makes mistakes, but I had to assume you were using the wrong thing and try to correct you if you were.

Also, Jambo, do you mind giving some insight on making moves that are NOT combinations of existing effects? I know you mentioned ASM, but I don't know where you'd put the ASM. Thanks!

Basically, I wrote a custom BS command which is just a clone of the scripting (over world scripting, I mean) Callasm.

I use it to check various things which need ASM and to write data to the RAM.

I also hacked the text string writer to use one index as a print anything sort of command. How that works is that I store the pointer using BS commands to a set RAM address, and then call the battle string writer with that index. It then reads the RAM address for the pointer, and then uses the pointer to write the actual text. Works kinda like the OW scripting message box command.

ShadowTails
May 4th, 2012, 10:05 PM
So, I've been tinkering around in Emerald with this, and I've gotten new attacks to work. However I'm wondering about the whole animations thing, reusing existing ones. I have two new moves currently and the first move is using Pound, as expected, but the second move is using a poisoned animation. I looked for similar data to the animation pointer table, but it doesn't seem to be effecting anything in game animation wise for the new moves I've added, I definitely found a pointer table and re-pointed the data. I'm just not getting the results I expected, and it doesn't seem like all the bytes in the pointer table are pointers, assuming there are 355 animations in the game, and I jumped in the pointer data in Fire Red as well to check, and there appears to be more than 355 animation pointers for attacks, and the final bit of the 1420 bytes from 1C68F4 don't look like pointer data. Unless I have the wrong pointer, which is entirely possible, as I'm doing this in Emerald. These bytes 2F00C3004001FFFF both appear before a pointer table in both roms, and in Fire Red those bytes are before 1C68F4 and in Emerald the pointer table after those bytes is at 2C8D6C.

I decided to see if replacing the data at 2C8D6C in Emerald with 0's after re-pointing it to another part of the rom (which ends in 0, so like the first post warned, I did put it in the right place) would have any effect on the game, and now Sand Stream, Switching, Throwing a Pokeball, and various other things causes the game to reset. I'm not sure what's going on at all, is there another pointer for the animations table? I'm assuming that's what I've found, but I have no way of knowing. I guess I could try the same stuff I'm doing in Fire Red. I don't suppose this whole animation thing is on the top of my priorities, but it's still something I'd like to figure out...

Nevermind I figured it out.

Leafbarrett
May 14th, 2012, 06:22 AM
Ok - This is what I have managed to come up with over the last few weeks/months.

Once I stopped getting caught up in understanding what each and every command actually does, and started looking at the bigger picture, I realised that there are groups of commands which, when executed together, produce the effect we are looking for. If we were ever to create a compiler for battle scripts - I would term these as "super commands".

So, without further ado - the combination of commands which activates the stat changing effects:


48 [Side - Byte] [Colour - Byte] [Unknown - Byte] // Stat Change Animation
2E [RAM Pointer - Always 0x02023FDE for this! - Word] [Effect - Byte] // Stores what effect to execute
89 [Side - Byte] [ROM Pointer - Script to execute if failed (I think)] // Actually changes the stat, based on what you stored into 02023FDE above.
12 40 00 // Puts [stat] fell/rose onto screen, and delays for a little over a second.


Obviously, these differing bytes will all need quantified. I'll start at the top:

Command 48:As far as I can tell, this is simply one of many animation commands, but this one is specifically set aside for the stat changing animations.

Side - Can be either 0 or 1. 0 is the opponent, and 1 is the user.

Colours - These are weird. There are only 3 colours however, so I've taken to using 3 numbers.
0x2 - Red (Attack and Special Attack)
0x3 - Blue (Everything else)
0x4 - Green (Defense and Special Defense)

Unknown Byte - This may control the direction of the animation, though I'm not sure.
0x9 - Down
0x0 - Up


Command 2E (storebyte):This command stores a given byte into the RAM address given to the command.

RAM Address - It can obviously be different for different effects, but most effects store a byte into the RAM Address 0x02023FDE.

Effect to Trigger - This is gonna be a fairly long list!Note: There are far more effects than this, but I don't have a list of them to hand.

Raising One Level:
0x11 - Attack
0x12 - Defense
0x13 - Speed
0x14 - Special Attack
0x15 - Special Defense
0x16 - Accuracy
0x17 - Evasion

Raising Two Levels:
0x21 - Attack
0x22 - Defense
0x23 - Speed
0x24 - Special Attack
0x25 - Special Defense
0x26 - Accuracy
0x27 - Evasion

Lowering One Level:
0x91 - Attack
0x92 - Defense
0x93 - Speed
0x94 - Special Attack
0x95 - Special Defense
0x96 - Accuracy
0x97 - Evasion

Lowering Two Levels:
0xA1 - Attack
0xA2 - Defense
0xA3 - Speed
0xA4 - Special Attack
0xA5 - Special Defense
0xA6 - Accuracy
0xA7 - Evasion



Command 89 (executestatchange):Executes the effect stored at 0x02023FDE.

Side - It's actually more than this, but I wasn't able to work out what exactly. It definitely controls side as well, however.

0xC1 - User
0x41 - Opponent

Script Pointer - A pointer to a battle script to branch to. Not entirely sure if this is for failure, but I suspect it is since the ROM continues execution of the existing script if the stat change succeeds.


Command 12 (showstatus):Prints the result of the changed stat to screen. Takes a frame delay as a parameter. This seems to work out in the background (possibly by reading 0x02023FDE) what effect was executed.

40 00 - 0x40 - 64 frame delay. At GBA's running speed. That is almost exactly 1 second of delay.

Fantastic - So far I've only talked about changing stats. What about burning, poisoning or damaging the foe? Well, these require yet more different commands!

So, we want to create a basic attack that does damage. This is how it's structured (all numbers are in hex):00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 15 19 00 00 00 00 00 00 2E D8 3F 02 02 00 49 00 00 3D

See why I put it in a spoiler? The thing is, if you search for this string in your BPRE ROM, you will find it already exists, so why do we need to know about it at all? Why not just directly call that existing script? The answer is because a lot of the new moves use combinations of existing effects. This is something we cannot achieve simply by using the existing scripts. However, what we CAN do, and I advise you should do, is branch back to this script at the earlist available opportunity, after executing your effects.

Now, the most important part of that script for our purposes is towards the end. The 0x15 byte is the byte which takes care of any added effects that the attack may have. It reads from 0x02023E85 to find what effect it should execute. So why did I bother showing you what's above, I hear you asking.

The stuff that is above isn't reliant on a branch back to this code! You can simply end the execution of the effect(s) by using the return command (0x3C or 0x3D).
It basically comes down to this: If your attack does damage - use this new way, if it doesn't, use the older way from above.

I'll try to explain this with an example: Let's say we want to have Flare Blitz. Flare Blitz does damage, causes recoil AND can cause a burn. This is a combination of 2 existing effects, but because it has to do damage as well, we can't simply use the stat changing method. What do we do?

Firstly, we take care of the damage part of the attack. This is the section of the huge script from above that is in italics. All that nonsense takes care of causing damage to the opponent. So we need that:

Current Code for Flare Blitz:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00Excellent. Our attack would now do damage, carry an animation and all that good stuff.
Now, what effect gets executed next for Flare Blitz? Well - The recoil effect, of course! So, how to we go about finding how to use this effect?

The recoil effect we want is already in the ROM, however, we cannot simply call that one, because the game wouldn't then go on to execute the burn effect. What we need to do is take the relevant part of the recoil effect and insert it into our script, then execute it.

So, knowing that the recoil effect we want is number 198 (the same recoil effect as Double-Edge for anyone wondering where I pulled that number from), we can find the corresponding script easily enough. The table of effects starts at 0x1D65A8 in BPRE. So, we find the 198th entry in that table, and go to the script's location. What we see is what byte is stored, and to where, to execute the recoil effect. So we copy the storebyte command (2E) and all it's parameters to gain the effect.

Current Code:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6Now we must execute the effect. Well, that's easy. Command 0x15 executes effects, so we simply add a 15 to the script.

Current Code:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6 15Excellent - but so far, we've only added 1 of the 2 effects, and it's taken a lot of work! Thankfully, from here on out, it gets easier, as for each effect, you simply repeat the cycle of store and execute until completion. So we want to add the burn effect now. The burn effect byte is 0x3, so we now stick a storebyte for that byte into the end of the script, as well as an execute effect command.

Current Code:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6 15 2E 85 3E 02 02 03 15Now, that's all of the effects which can be added for this attack directly (the defrosting is handled passively elsewhere), so now what do we do?
Ah yes, as per what I said earlier, we should return to the original script as soon as possible. So now we simply put a Goto command onto the end of the script, returning back to normal execution.

Flare Blitz Code:
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 2E 85 3E 02 02 E6 15 2E 85 3E 02 02 03 15 28 47 69 1D 08There we have it! One functional Flare Blitz effect.The recoil will ALWAYS happen, so you don't need to worry about clashes between the recoil and the CHANCE of burning, but if you have 2 effects such as flinch and burning which both rely on chance, they both must share the same chance of happening. This is simply a limiation of the code's design. It is possible for BOTH effects to happen at the same time, so you can't have a chance for poison combined with a chance for paralysis (for example).

Feel free to test out and use this battle script! Using this methodology, it is possible to combine any existing effects in the BPRE 1.0 ROM, which makes the vast majority of Gen 4's (and a fair number of Gen 5's) moves possible on Gen 3 ROMs, animations notwithstanding. A short health warning, all the pointers I include in this post apply specifically to BPRE. However, this string of commands:02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 15 19

should appear in all of the Gen 3 ROMs.First, is that Flare Blitz script compatible with Emerald?

Second, am I supposed to be able to find free space somewhere in the table? Because the earliest available free space big enough for a command is nearly 600,000 bytes past the (apparent) first entry in the table (2D8A2E? in Emerald). Somehow I get the feeling I'm going to have to repoint the entire table if I want any free space for commands.

Third, is there a full list of animations? And how do I tell the game to call a certain order of animations (for example, call Harden, then call Hidden Power)? I'm editing Emerald, if that changes anything.

Lastly, can I get someone to better explain repointing the attack table (specifically in Emerald)? Because I'm reading the instructions right now and it's like trying to read Japanese: I have no idea what the hell any of it means. Not to mention I have no idea where the attack table in Emerald is. Scratch that, reverse it. I know exactly where the Emerald attack table is: 0x31C898. I don't know what to do with this information, though.

Jambo51
May 14th, 2012, 06:57 AM
1) No, but it's pretty close to compatible. You would only need to change the pointer which follows the 01 command, as that is ROM specific. This is assuming the battle scripts are the same between FR and Emerald. They may not be.

2) No, there isn't any free space in the table as standard. I keep pointing out what I post are research notes, no better. This is meant to be a semi-tutorial on how to combine existing move effects in BPRE 1.0. (aka FR US 1.0). At no stage do I ever claim it would be a good tutorial, that there is free space in the table, or that it would work on Emerald. In fact, I state that it is only applicable to BPRE!

3) We know little to nothing about the animations. Research is ongoing. Chaos Rush has had some success creating custom animations, perhaps you could contact him?

4) Repointing the attack table? Which one? There are at LEAST 3 tables related to attacks (if not more on Emerald). The main table (with base damage etc on it) is a simple repoint. The animation table is repoint and fill out with placeholders for now.
The battle script pointers are somewhat more complicated. I have a solution for FR, which could theoretically work on Emerald, but right now, I have no intention of porting it to Emerald.

Leafbarrett
May 14th, 2012, 07:49 PM
So basically I'm screwed and Flare Blitz is stuck with goddamn Odor Sleuth's animation, and I don't know what I'm supposed to be doing with that Flare Blitz script or where it needs to go. Absolutely fantastic.

Jambo51
May 15th, 2012, 03:27 AM
So basically I'm screwed and Flare Blitz is stuck with goddamn Odor Sleuth's animation, and I don't know what I'm supposed to be doing with that Flare Blitz script or where it needs to go. Absolutely fantastic.

Bit much on the attitude! Chill out. For what it's worth, my post had a bit too much attitude yesterday, so I'm sorry about that.

You can only have a maximum of 255 battle script effects due to how the data table for the attacks is laid out. The effect it uses is only allocated a single byte, which is obviously too little for any more. My solution on FR uses one of the padding bytes to set a table value. What this means is that I have a table of tables in my ROM, and the aforementioned value sets which of the tables I want to get the Battle Script from, and then it reads the effect byte to get the actual script from the wanted table. It works, but is not ideal, since there are potential clashes (and also helpful coincidences - like I set Flare Blitz to Table 1 Effect 75 (or something like that) and because the existing code in the ROM doesn't check the table ID, Flare Blitz inherits its melting ice effect as well).

I explicitly stated in the post that you quoted that if you searched for a certain string of bytes that it would most likely be in the ROM. I ensured I left out anything BPRE specific in that string, so try searching for it. It should only appear once in the entire ROM and it should appear in a string looking somewhat like this:

00 01 XX XX XX 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 15 19 00 00 00 00 00 00

This string of commands is the workhorse of the battle scripting attack system. It generally executes most attacks, and most of their effects, which is why I branch back to it after executing the first effect (the recoil) to continue execution. The goto command in Battle Scripting is 28, so if you see a 28 followed by a pointer, it is likely to be a goto command.

The script should work as is as long as you "correct" the pointers after the 01 and 28 commands. I told you above how to track down the script which I go to after executing the Flare Blitz script. You can find the necessary pointer to go after the 01 command by finding that string of commands.

This should help somewhat. Sadly, I genuinely can't help with the animations.

Chaos Rush
May 29th, 2012, 02:48 PM
I'm confused at how to use custom battle scripts, though. Do we need to manually expand the battle script table? (and yes, I know you can only have up to 255)

EDIT: I just went ahead and expanded the table. Working on Roost, if you assign Featherdance's animation to it, then set the battle script to this:
00 02 03 7B D1 7D 1D 08 01 09 0A 35 D0 32 02 02 00 01 00 00 45 07 16 00 00 00 00 0B 01 0C 01 10 4B 00 12 40 00 28 4E 69 1D 08
You'll have a move identical to Roost but without the flying type removal. It will even play the healing animation. The bytes that I bolded is the command to play the healing animation.
http://i1151.photobucket.com/albums/o625/ChaosRush/1-3.png http://i1151.photobucket.com/albums/o625/ChaosRush/2-3.png http://i1151.photobucket.com/albums/o625/ChaosRush/3-2.png http://i1151.photobucket.com/albums/o625/ChaosRush/4-2.png http://i1151.photobucket.com/albums/o625/ChaosRush/5-1.png


EDIT: Does the callasm command work in battle scripts? I need it for removing the Flying type for 1 turn. (Not sure if this matters, but I'm working with FireRed)

Jambo51
May 30th, 2012, 01:13 AM
Nah, I wrote a completely custom command for the callasm command. It's fairly simple to do, all things considered. Also, my script is somewhat more simplistic, since mines just has the callasm, and then I just branch to the Milk Drink script to take care of the rest.

I've now written 5 custom commands for the game:
F8 (Callasm)
F9 (Store Half-Word)
FA (Store Word)
FB (Check Used Attack)
FC (Set Pledge Effect)

These sit on top of the existing commands, and the 1 index for all hack I applied to command 0x10. All in all, it works rather well.

Gamer2020
May 31st, 2012, 06:14 PM
Well guys I have made some progress on BSE!

It now compiles! I tested it a little while ago with this very simple script.

#org 0x800000
capture
end
It's still very basic in nature though and not every command is implemented. It is still a step in helping everyone be able to create their own move effects. These are the commands I have implemented to far. They're kind of blah so please give me some feedback on their names.
(Credit to JPAN and Jambo51 for their research!)

"&H0" = "unknownCommand0x00NoArgs"
"&H1" = "SomeCompare"
"&H2" = "usedattackmsg"
"&H3" = "hitmisscalc"
"&H4" = "critcalc"
"&H5" = "basedmgcalc"
"&H6" = "typedmgcalc"
"&H7" = "effectcheck1"
"&H8" = "effectcheck2"
"&H9" = "baexe"
"&HA" = "turncheck"
"&HB" = "healthbardec"
"&HC" = "healthvaldec"
"&HD" = "critcheck"
"&HE" = "unkloopcheck"
"&H10" = "msgdisplay"
"&H12" = "seffectmsgdisplay"
"&H1A" = "faintdisplay"
"&H23" = "battleendfunc"
"&H24" = "ifwildend"
"&H26" = "storebyteforjump"
"&H27" = "jumpifbyte"
"&H28" = "goto"
"&H2E" = "storebyte"
"&H2F" = "addbyte"
"&H30" = "subtractbyte"
"&H31" = "copyarray"
"&H32" = "addarray"
"&H39" = "pause"
"&H3A" = "wait"
"&H3C" = "return1"
"&H3D" = "return2"
"H3F" = "end"
"&H41" = "call"
"&H45" = "animationprint"
"&H4C" = "pokemondataswitch"
"&H4D" = "pokemonbattledataswitch"
"&H4E" = "pokemonandhealthbardisplay"
"&H53" = "trainerdisplay"
"&H55" = "lvlupsnd"
"&H56" = "pkmfntsnd"
"&H57" = "flee"
"&H5C" = "hitflash"
"&H61" = "pkmswianimation"
"&H91" = "givemoney"
"&HEF" = "capture"

Darkrai Lv.1000
July 18th, 2012, 07:10 PM
I have a question regarding the first method of adding moves.
By "supports up to 511 moves", do you mean that I can add up to 511 extra moves, or add to the existing 354 until I have exactly 511 (basically adding 157 new moves)?

Ark_Silvanos
July 18th, 2012, 08:39 PM
511 total. The game's default coding i believe only supports 512 moves. So we get (511 moves + struggle). if you want more, you gotta use Jambo's asm routine to change the way moves are loaded.

Darkrai Lv.1000
July 18th, 2012, 08:50 PM
Thanks. Doing this, I've successfully added the 157 extra moves in Ruby. I also have those extra 157 slots in PGE after Psycho Boost. But am I supposed to get "unhandled exception" errors when I click on any one of them? Clicking continue lets me go as normal, but I think it might be tied to the free space I gave. When it says I have to leave 13 x the number of new attacks free bytes, I calculated it and replaced those corresponding FF's with 00's. Am I supposed to do that, or leave them as FF's?

EDIT: it just doesn't seem to matter whether I use 00's or FF's (I still don't know which is the right one, though), I just keep getting that error. It still works as normal, but that error is annoying. I'm sure I've done it right... :/

Jambo51
August 1st, 2012, 08:42 AM
Thanks. Doing this, I've successfully added the 157 extra moves in Ruby. I also have those extra 157 slots in PGE after Psycho Boost. But am I supposed to get "unhandled exception" errors when I click on any one of them? Clicking continue lets me go as normal, but I think it might be tied to the free space I gave. When it says I have to leave 13 x the number of new attacks free bytes, I calculated it and replaced those corresponding FF's with 00's. Am I supposed to do that, or leave them as FF's?

EDIT: it just doesn't seem to matter whether I use 00's or FF's (I still don't know which is the right one, though), I just keep getting that error. It still works as normal, but that error is annoying. I'm sure I've done it right... :/

Hmm, that free space is for the attack names. If you leave it as all 00's, it will definitely cause an error in PGE. The all 0xFF's may do so as well since it would cause PGE to display an "empty" name. Try copying and pasting the first 157 move names into that space, it may help.

Darkrai Lv.1000
August 1st, 2012, 02:48 PM
I've just now tried that, but the errors still came up. Turns out, the cause of the error had to do with the effect of the new moves. All of them had effect 255 preset, same as the number in the error (SelectedIndex=255), and changing that to an existing effect got rid of it. However, I still get another one, where the SelectedIndex=47, that only comes up when I open the attack editor, and when selecting the first Pound attack. Other than that, everything's smooth sailing now. Thanks for the tutorial!

Winter Fountain
August 3rd, 2012, 05:45 PM
Sorry for sounding like a noob (because I've never hex edited anything before,) but... What's all this repointing about and how do you do it? And how much is 4260 bytes?

crowlover
August 4th, 2012, 11:36 AM
I'm trying to figure out how to implement Dragon Tail's effect, but I'm not sure if the Whirlwind/Roar effect has anything built into it to handle doing damage.

How would you modify the Whirlwind/Roar effect to have it do damage before it switches the target out?

timson733333
August 4th, 2012, 03:07 PM
Sorry for sounding like a noob (because I've never hex edited anything before,) but... What's all this repointing about and how do you do it? And how much is 4260 bytes?

Correct me if I'm wrong, but repointing is when you take the reverse offset of the regular table and replace all instances of it in the ROM with the reverse offset of the new table...? That's what I've been doing, so I hope I haven't been screwing it up.

Make sure you leave (13 * number of new attacks) free bytes after the end of the data you just copied before doing this next stage.

Next, navigate to 0x1C68F4, and copy 1420 bytes, and paste them into free space in the ROM, making sure the pointer is THUMB aligned. That is, ends with a 0, 4, 8 or C.

Then, go back to 0x1C68F4 and copy (4 * number of new attacks) bytes of data, and paste it into the area after the already copied data. So for example, if you repointed to 0x9F0000, you would paste this latest data starting at 0x9F058C.


I don't get these steps.

EDIT: Okay, now I get it. I've expanded the move table! But when I view the moves in PGE, they're all glitched and have random powers/effects, and when I boot up my ROM, it crashes after gender selection. Am I doing something wrong? I selected the bytes in hex; should I have selected the bytes in decimal (e.g. converting 4260 to 10A4?) Other than that I think I repointed right (unless my definition of repointing was wrong, then please correct me) and I put everything into free space.

EDIT AGAIN: I selected the bytes in decimal and this time the moves came out clear. I made the move after Psycho Boost have a name, and then I booted up the ROM. Still crashes at gender selection. Is there something else I need to do?

EDIT YET AGAIN: Ok, it looks like whenever there's a name input, the game crashes. But the moves work just fine if I upload another savestate and bypass the name selection.

I'm trying to figure out how to implement Dragon Tail's effect, but I'm not sure if the Whirlwind/Roar effect has anything built into it to handle doing damage.

How would you modify the Whirlwind/Roar effect to have it do damage before it switches the target out?

I've played a hack where the creator has effects play one after another (like Close Combat, the special defense drop is applied separately after the defense drop; or Growth, where the Special Attack rise is applied as a separate effect after the Attack rise.) So you might be able to make it have a damaging effect first, and then the Whirlwind effect afterwards. However, it will break through a Substitute.

Winter Fountain
August 4th, 2012, 05:44 PM
Correct me if I'm wrong, but repointing is when you take the reverse offset of the regular table and replace all instances of it in the ROM with the reverse offset of the new table...? That's what I've been doing, so I hope I haven't been screwing it up.

Uh. Sorry, I still don't get it, Timson. >.< Sorry for being such a noob...

EDIT: Okay, now I get it. I've expanded the move table! But when I view the moves in PGE, they're all glitched and have random powers/effects, and when I boot up my ROM, it crashes after gender selection. Am I doing something wrong? I selected the bytes in hex; should I have selected the bytes in decimal (e.g. converting 4260 to 10A4?) Other than that I think I repointed right (unless my definition of repointing was wrong, then please correct me) and I put everything into free space.

EDIT AGAIN: I selected the bytes in decimal and this time the moves came out clear. I made the move after Psycho Boost have a name, and then I booted up the ROM. Still crashes at gender selection. Is there something else I need to do?

EDIT YET AGAIN: Ok, it looks like whenever there's a name input, the game crashes. But the moves work just fine if I upload another savestate and bypass the name selection.

You're just lucky you got it to work. All I've done is crash my ROMs. I don't know where to paste or what to do or what to "repoint."

timson733333
August 4th, 2012, 05:48 PM
Uh. Sorry, I still don't get it

Gonna try my best to explain...

Ok, so you know that pointers in the hex are the reverse of the offset that it points to, right? So if we have some stuff at 0xABCDEF, there will be instances of the hex code "EF CD AB" in the ROM. These instances are read to "point" towards 0xABCDEF. If you move some stuff from and after 0xABCDEF to a free space offset, let's say 0x900000, you haven't yet told the ROM to read off of there. So what you do is replace all instances of "EF CD AB" with "00 00 90" (the reverse of 900000.) That way the ROM knows to read from 0x900000, and not 0xABCDEF.

crowlover
August 5th, 2012, 05:24 AM
I've got something that might work for Dragon Tail. I pretty much wrote the code and added the bit between the Whirlwind/Roar pointer and the next pointer. Not sure if this would work or I would need to do something different with it:

00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 00 02 03 1E 00 15 08 94 1D 08 21 00 00 04 00 00 00 27 8F 1D 08 01 F2 7D 1D 08 FF FF 01 60 69 1D 08 00 00 8F F2 7D 1D 08

Also, I unfortunately don't know where the table with the pointers for individual attack effects is in Fire Red. If this is where I'm supposed to have a pointer to this, or if it's a different table, could you please tell me?

Sorry fo the trouble.

timson733333
August 5th, 2012, 01:47 PM
EDIT YET AGAIN: Ok, it looks like whenever there's a name input, the game crashes. But the moves work just fine if I upload another savestate and bypass the name selection.

I recently tried doing everything again, only to be met with the same result. Do I need to use JPAN's hacked engine, or am I repointing things wrong?

Darkrai Lv.1000
August 9th, 2012, 02:40 AM
Is there a resource that tells where the list of effects and commands are for doing battle script work in Ruby? Everything seems to be only for Fire Red, as far as I can see. xD

Jambo51
August 9th, 2012, 06:23 AM
I recently tried doing everything again, only to be met with the same result. Do I need to use JPAN's hacked engine, or am I repointing things wrong?

I just tested with a fresh save (a completely fresh save on the 649 patch, which has had this hack applied) and it got through to Pallet Town with no issues whatsoever.

However, I may have missed out some steps or something somewhere along the line in this thread. I'll see if I can find any such missed steps.

ETA: Did a quick dry run, and it worked absolutely fine, so I genuinely don't know what the problem is.

Is there a resource that tells where the list of effects and commands are for doing battle script work in Ruby? Everything seems to be only for Fire Red, as far as I can see. xD

Answer to this is simple - I'm the only person researching these commands. I researched them for FR because I need them for FR. Simples.

However, the good news is that the BS system was carried over from Ruby to FR in the first place, so if you update your pointers correctly, it should still be compatible.

Darkrai Lv.1000
August 9th, 2012, 02:28 PM
I see. I'll just search for the table of battle scripts. I'll amend(sp?) with the offset and similar findings if I happen to find it.

So, once I've created my custom script, how do I go about using it in game? Do I need to repoint the effect table and add a new effect at the end for the new move? Or could I replace what looks like effect 214? Scratch that, I've figured it out.

EDIT: I have located the table of the 214(213?) different effects in Ruby. That offset is 0x1D6BBC.
The basic damage script seems to be located at 0x1D6F3A as well.

I've noticed that the basic damage script is completely identical between Ruby and Fire Red. The only difference is that pointer at the beginning.

Never thought I'd say this, but this is actually quite fun, searching for the bits and pieces that make up a game. But how do I know what I need to copy after the storebyte command? How would I create a 2-turn attack? Does the "first turn fly/bounce/dig/invincible" go before the part that does damage? Same with the high crit rate effect.

timson733333
August 21st, 2012, 02:12 PM
Now, navigate back to 0x250C04 and copy (12 * number of new attacks) worth of data. This should ensure that the new attacks you add inherit some sensible data which PGE can work with.

I didn't see this step before. o_o

Anyways, where am I supposed to paste this data?

Edit: Ok, I posted it directly after the corresponding pasted data and the moves work like a charm in Emerald. But I don't think I've found the limiter. I did a hex string search for the corresponding limiter in FireRed (B1 20 40 00 81 42), but when I overwrote that with 0s it still didn't work. Help?

Jambo51
August 22nd, 2012, 08:07 AM
I didn't see this step before. o_o

Anyways, where am I supposed to paste this data?

Edit: Ok, I posted it directly after the corresponding pasted data and the moves work like a charm in Emerald. But I don't think I've found the limiter. I did a hex string search for the corresponding limiter in FireRed (B1 20 40 00 81 42), but when I overwrote that with 0s it still didn't work. Help?

You're not crazy. It wasn't there before. I added it because I noticed that PGE didn't like having a bunch of 0xFFs as the "data".

Same applies to the names.

The limiter is in a different location in Emerald, and may not use that string of hex commands. I believe Gamer2020 posted the location of that limiter a few posts after the first post. Check his post out.

You ARE correcting the offsets for Emerald, right? I just want to make sure you are, because all the pointers in my first post are for FR specifically.

timson733333
August 22nd, 2012, 12:33 PM
You're not crazy. It wasn't there before. I added it because I noticed that PGE didn't like having a bunch of 0xFFs as the "data".

Same applies to the names.

The limiter is in a different location in Emerald, and may not use that string of hex commands. I believe Gamer2020 posted the location of that limiter a few posts after the first post. Check his post out.

You ARE correcting the offsets for Emerald, right? I just want to make sure you are, because all the pointers in my first post are for FR specifically.

Yep, I found the corresponding offsets in roms.ini. I saw Gamer2020's post and replaced the bytes, and it worked. Nothing seems to be wrong now (name input doesn't screw up the game, like my first attempt with FireRed did) but I'll post here if I encounter any further errors.

EDIT: I uploaded the .ips of the FireRed modification I did. The move table is expanded, but it always crashes at name selection. Test it, I really want to know what I'm doing wrong in FireRed because the expanded move table works flawlessly in Emerald.

Offsets I repointed to:

Attack names - 0x8DC410
Attack data - 0x723D80
Attack animations - 0x7F8F60

itman
October 11th, 2012, 02:51 PM
I made move effects for U-turn/Volt Tackle, Wake-Up Slap, and Hammer Arm.

I tested them and they work.

U-Turn/Volt Tackle
00 01 5E 69 1D 08 00 00 02 03 04 05 06 07 09 0A 0E 5C 00 3A 0B 00 0C 00 0D 12 40 00 0F 12 40 00 4F 81 47 69 1D 08 50 01 F2 7D 1D 08 E2 01 3A 51 01 02 58 01 4C 01 4D 01 73 01 10 03 00 4E 01 01 3A 52 01 28 4E 69 1D 08 28 47 69 1D 08

Wake-Up Slap
1D 00 00 00 00 01 00 69 1D 08 2E 85 3E 02 02 A3 1C 00 07 00 00 00 77 04 90 08 28 00 69 1D 08 2E D2 3F 02 02 02 28 00 69 1D 08

Hammer Arm
2E 85 3E 02 02 D8 28 00 69 1D 08

timson733333
October 13th, 2012, 11:10 AM
Can anyone please test the patch I made?

itman
October 13th, 2012, 11:52 AM
Can anyone please test the patch I made?

I just did everything that JPAN said in his post and it worked without any problems, so to be honest you probably did something wrong. I would just start over and try again. Make sure you correctly repoint ALL the pointers to the new locations of each table, since there are A LOT.

Jambo51
October 13th, 2012, 12:35 PM
I just did everything that JPAN said in his post and it worked without any problems, so to be honest you probably did something wrong. I would just start over and try again. Make sure you correctly repoint ALL the pointers to the new locations of each table, since there are A LOT.

JPAN?! WHAT?! How very dare you?! Lol.

In actual response, I've tried it several times on both clean and pre-hacked ROMs, and every time it's worked, and I followed my own tutorial to do it, I may add, so it does work.

itman
October 13th, 2012, 07:53 PM
JPAN?! WHAT?! How very dare you?! Lol.

In actual response, I've tried it several times on both clean and pre-hacked ROMs, and every time it's worked, and I followed my own tutorial to do it, I may add, so it does work.

I am so sorry! I meant Jambo, I get you two confused because I've used both of your resources and such so much. AH. I'm sorry. :'(

But yeah, you're way definitely works. Would you be okay if I made kind of a more tutorial? With pictures and things, since this is huge and I don't want this to not be used, it's just incredible.

timson733333
October 14th, 2012, 11:53 AM
I'll try it again for FireRed, I'm doing it for Ruby right now to see if it works, but roms.ini doesn't have the attack animations. Can someone tell me where that is?

Mr155555
December 27th, 2012, 07:37 PM
can you do a video explaining everything so it can be less complicated

DoesntKnowHowToPlay
December 28th, 2012, 11:29 AM
So I figured out a nifty trick that would have been nice to know earlier:

The command 2A can be used in battle scripts to read arbitrary halfwords and jump depending on their value- by checking x02023D4a, this can be used to detect which attack is calling the script. This is actually done by the game to detect Surf and Whirlpool so it can make them pierce Dive. For example:

2A 00 4A 3D 02 02 5D 01 FB 85 1D 08This command will cause a jump to x1D85FB if the move being used is x15D- Dragon Dance. If the move is not Dragon Dance, the script simply continues. We can utilize this to map different effects to a single effect byte- this allows us to make our new attacks AI-friendly by mapping them to similar effect bytes. For example, if we put Shift Gear's script after this check, we can give it Dragon Dance's effect byte, and the AI will treat Dragon Dance and Shift Gear the same way. It also allows us to easily take advantage of effects that aren't handled by script- we can make Flare Blitz defrost the user by giving it script x7D (Flame Wheel) without losing the recoil effect, for example. It also means there is no need to repoint the battle script table, as we only need to branch off the existing scripts rather than add new ones to the table.

Speaking of defrosting- if any moves in the expanded move table have effect byte x7D (such as Scald and Flare Blitz), they will produce garbage text when they defrost the user. To fix this, go to 0xD7E96 and place six 00s there.

Jambo51
December 28th, 2012, 12:50 PM
Cut for brevity

Indeed. That is how I should have done it. Retrospect is a wonderful thing.

On the downside, this only works for moves which have a similar move already in existance. I know the AI needs modified to support the new moves either way, but at least with using your method, that amount of work is cut substantially.

Battle Script Editors are being worked on to make this sort of work easier, so maybe I'll go back and retrospectively change the system to use the style you show above.

It would certainly make any modifications to the AI easier!

I thank you for pointing this out!

Darkrai Lv.1000
January 17th, 2013, 04:53 PM
Wow, it's been a while since I've been on this side of the forums. xD
Anyways, I've got my hack stuff back on my new computer, and I'm continuing work on my project, but one problem still persists:

How do I give my new moves proper descriptions?

pawell6
February 20th, 2013, 03:06 PM
Wow, it's been a while since I've been on this side of the forums. xD
Anyways, I've got my hack stuff back on my new computer, and I'm continuing work on my project, but one problem still persists:

How do I give my new moves proper descriptions?

You can use XSE to change descritptions of moves.

GoGoJJTech
February 22nd, 2013, 01:21 PM
You can use XSE to change descritptions of moves.

Not just xse
search for it in advance text, add it to the ini then edit the description

Omega Zero
February 22nd, 2013, 07:07 PM
Wow, it's been a while since I've been on this side of the forums. xD
Anyways, I've got my hack stuff back on my new computer, and I'm continuing work on my project, but one problem still persists:

How do I give my new moves proper descriptions?

Find the pointer for move descriptions
Copy all of it plus 4xnumber of new moves

and paste it somewhere in the rom,
then repoint everything to the new move descriptions place.

ShadowTails
June 17th, 2013, 06:22 PM
Regarding move descriptions, when I try to point to other areas in the rom for the descriptions, it will bring up other random text, no matter where I point it.

At first I just repointed the pointer table, and that worked just fine, but trying to add a new pointer at the end for the 355th move in the rom would never work. It would just pick a random thing of text, and if I changed another move, like Growl, to the description that I put in free space, it would pick another text even if it was the same offset as the custom move.
http://i.imgur.com/ln5ZRR8.png
http://i.imgur.com/lav5F5K.png


The only time any new description would work is if I put it after Psycho Boost without repointing all of the move descriptions, and when I tried repointing all the move descriptions, nothing works.

Is there another pointer that I have to set to get this to work right? I've been trying all sorts of different things, but I've run into this problem. After trying everything, I figured I should ask here. I got everything else to work, my new move does damage and it does everything that it should do, but I can't figure out what to do about move descriptions for the life of me.

Zeifyl
September 6th, 2013, 01:51 PM
This is the first time I am trying to mod a Pokémon Game, and this looked very amazing to me, so I figured I'd give it a shot, but I encountered an error.
I'm sure I did everything as it said I should, but anyway, this happens (Images in attachments)

JoshandJR5
September 26th, 2013, 12:21 PM
forgive me for being new to this but how could I just do something simple like make howl raise accuracy instead of attack? I know its not a standard effect but still doesn't seem like it should be too difficult. I don't necessarily wanna have to repoint a bunch of code is all. (This would be for Emerald.)

I can't seem to find the right byte or bytes to change... knowing how the data structure is outlined for attack effects, animations or whatever would help like how bulbapedia formats it on their "Move_data_structure_in_Generation_III" page

BugMania
October 5th, 2013, 10:24 AM
Jambo 51, ​​it seems that you are not entered programming ASM to jump movements according to the levels of the Pokemon ... ... happens that a pokemon on level 35 appears with the same movements of a level 1.

... excuse me if I'm wrong speaking

DoesntKnowHowToPlay
December 11th, 2013, 01:29 PM
So while fiddling with the 649 patch I noticed a rather nasty bug in the second move table extension method detailed in the OP. While it works fairly well, pokemon are generated with the first four moves in their movepool, regardless of how high level they are. Movepools looked like this:

http://i.imgur.com/4bMiQif.png

when they should have looked like this:

http://i.imgur.com/noalzq0.png

This can be fixed by using the following routine in place of the second one Jambo provides:

.text
.align 2
.thumb
.thumb_func
.global newmovesetstyle2
main:
ldrb r1, [r0, #0x2]
mov r2, #0xFF
cmp r1, r2
beq exit2
lsl r2, #0x8
add r2, #0xFF
mov r9, r2
mov r3, #0x0
loop: lsl r0, r3, #0x1
add r0, r0, r3
ldr r1, movesettable
add r1, r1, r6
ldr r1, [r1, #0x0]
add r7, r0, r1
ldrb r0, [r7, #0x2]
mov r4, r10
cmp r0, r4
bgt exit2
ldrb r1, [r7, #0x1]
ldrb r0, [r7, #0x0]
lsl r1, r1, #0x8
orr r1, r0
mov r0, r8
str r3, [sp, #0x0]
mov r4, r1
bl branchone
mov r5, #0xFF
ldr r3, [sp, #0x0]
cmp r0, r9
bne exit
mov r0, r8
add r1, r4, #0x0
bl branchtwo
ldr r3, [sp, #0x0]
exit: add r3, #0x1
# lsl r1, r3, #0x1
# add r1, r1, r3
# add r0, r7, r1
mov r1, #0x3
add r0, r7, r1
ldrb r0, [r0, #0x2]
cmp r0, r5
bne loop
exit2: add sp, #0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
branchone: push {r4-r7,lr}
add sp, #-0x4
ldr r7, gothere
bx r7
branchtwo: push {r4-r7,lr}
ldr r7, gothere2
bx r7
.align
gothere: .word 0x0803E8B5
gothere2: .word 0x0803EC43
movesettable: .word 0x0825D7B4The changes are fairly simple. First, Jambo's code seemed to assume that the method called by "branchone" returned 0xFF if the pokemon didn't have a spare slot in its movepool- not only would this cause problems with Spit Up (which is move 0xFF), but in actuality it returns 0xFFFF. (Note that this means you won't be able to use slot 0xFFFF for a move and have it behave properly without further tweaking). I modified the code to look for that instead. I also fixed two other issues that were never reached previously- the call to "branchtwo" now properly pushes last register, and the move being learned is stored in r4 before branchone is called at all, which means that pokemon don't constantly learn their level instead of actual moves.

This only applies to the method that enables you to have more than 512 moves- if all you did was repoint a few tables this doesn't impact you.

(implying anyone cares when over two years have passed and only one other person noticed)

EDIT: don't use this by its own. I was working with the 649 to patch this, and assumed the only tweaks were what Jambo documented here; he made a bunch of other changes as well. Read the next page, there's a byte tweak for it that should fix things most of the time.

11/4/2014 edit: updated this method, it should work properly now even without the one following it.

Tlachtli
January 1st, 2014, 11:22 PM
I just want to add that Jambo's first method in the OP works perfectly for Emerald if you substitute the addresses below. Also if you want to add in Contest data for new moves (only applies to R/S/E), the table locations and lengths are listed with the rest below below. I also copied the extra addresses from the end of the table instead of the beginning, but that shouldn't make any difference.

Table locations and lengths for Emerald/BPEE:

Attack Names - Start at 0x31977C, 4615 bytes (0x1207 hex) + 13*new
Attack Data - Start at 0x31C898, 4260 bytes (0x10A4 hex) + 12*new
(PP Data - Start at 31C898+4)
Contest Move Data - Start at 0x58C2B4, 2840 bytes (0xB18 hex) + 8*new
Contest Effect Data - Start at 0x58CDCC, 1420 bytes (0x58C hex) + 4*new
Attack Description Table - Start at 0x61C524, 1420 bytes (0x58C hex) + 4*new
Attack Animation Table - Start at 0x2C8D6C, 1420 bytes (0x58C hex) + 4*new

ShyRayq
January 20th, 2014, 07:05 PM
Okay, so, I've correctly inserted the 3 routines for extending the move table past 512 moves.
I also inserted Doesn't reworked routine instead of Jambo's one.
Now there's a new(?) problem.
So my moves a working fine, everything part 512 works fine. But the problem is that my pokemon will now, now longer learn a new move, regardless of whether it is a new move or an old move.
I've checked the routines, and pointers and everything. Is there something else wrong with the routine or am I just stupid?

BugMania
January 21st, 2014, 11:55 AM
Okay, so, I've correctly inserted the 3 routines for extending the move table past 512 moves.
I also inserted Doesn't reworked routine instead of Jambo's one.
Now there's a new(?) problem.
So my moves a working fine, everything part 512 works fine. But the problem is that my pokemon will now, now longer learn a new move, regardless of whether it is a new move or an old move.
I've checked the routines, and pointers and everything. Is there something else wrong with the routine or am I just stupid?





See this routine I wrote:

.text
.align 2
.thumb

Matriz:
mov r3, #0x0
ldr r1, Contador2
str r3, [r1]
ldr r1, moves
str r3, [r1]
add r1, #0x4
str r3, [r1]
add r1, #0x4
str r3, [r1]
add r1, #0x4
str r3, [r1]
LDR R1, movesettable
ADD R1, R6, R1
LDR r2, [R1]
LDR r3, var
STR r2, [r3]
Start:
mov r2, r10
LDR r3, var
LDR r3, [r3]
LDRB r3, [r3, #0x2]
CMP r3, r2
BLS Frente
ldr r1, var
ldr r2, [r1]
sub r2, #0x3
str r2, [r1]
B Compare
Frente:
LDR r2, var
LDR r2, [r2]
ADD r2, #0x3
LDR r3, var
STR r2, [r3]
B Start
Compare:
LDR r2, Contador
LDRB r2, [r2]
CMP r2, #0x4
BEQ end
LDR r2, var
LDR r2, [r2]
LDRH r2, [r2]
LDR r3, moves
LDRH r3, [r3]
LDR R7, Contador2
LDRB R7, [R7]
ADD r3, R7, r3
CMP r2, r3
BEQ Traz
LDR R7, Contador2
LDRB R7, [R7]
ADD R7, #0x3
LDR r2, Contador2
STRH R7, [r2]
LDR R7, Contador2
LDRB R7, [R7]
CMP R7, #0xC
Blo Compare
LDR R7, Contador2
MOV r2, #0x0
STRB r2, [R7]
B Insert
end:
MOV r3, #0x0
LDR r2, Contador
STR r3, [r2]
ldr r1, var
ldr r2, [r1]
add r2, #0x3
str r2, [r1]
LDR R1, movesettable
ADD R1, R6, R1
LDR r2, [R1]
ldr r1, var
ldr r3, [r1]
cmp r3, r2
bhs end1
str r2, [r1]
end1:
mov r2, #0x0
mov r3, #0x0
mov r4, #0x0
mov r7, #0x0
LDR R1, Go
bx r1
Traz:
LDR r1, var
LDR r2, [r1]
sub r2, #0x3
str r2, [r1]
B Compare


Insert:
LDR R7, Contador
LDRB R7, [R7]
MOV r2, #0x3
MUL R7, r2, R7
LDR r3, moves
ADD r3, R7, r3
LDR r2, var
LDR r2, [r2]
LDRB r2, [r2]
STRB r2, [r3]
LDR r2, var
LDR r2, [r2]
LDRB r2, [r2, #0x1]
STRB r2, [r3, #0x1]
LDR r2, var
LDR r2, [r2]
LDRB R2, [R2, #0x2]
STRB R2, [R3, #0x2]
LDR R7, Contador
LDRH R7, [R7]
ADD R7, #0x1
LDR r2, Contador
STRB R7, [r2]
b Traz

.align 2
var: .word 0x02FF7d24
Contador2: .word 0x02FF7D2C
moves: .word 0x02FF7D50
movesettable: .word 0x08XXXXXX
Contador: .word 0x02FF7D28
Go: .word 0xJAMBO51ROUTINEOFFSET

So, instead of using the routine of the Jambo51, use this:

.text
.align 2
.thumb
.thumb_func
.global newmovesetstyle2
main:
ldrb r1, [r0, #0x2]
mov r2, #0xFF
cmp r1, r2
beq exit2
mov r9, r2
mov r3, #0x0
loop: lsl r0, r3, #0x1
add r0, r0, r3
ldr r1, =0x02FF7D24
ldr r1, [r1, #0x0]
add r7, r0, r1
ldrb r0, [r7, #0x2]
mov r4, r10
cmp r0, r4
bgt exit2
ldrb r1, [r7, #0x1]
ldrb r0, [r7, #0x0]
lsl r1, r1, #0x8
orr r1, r0
mov r0, r8
str r3, [sp, #0x0]
bl branchone
mov r5, r9
ldr r3, [sp, #0x0]
cmp r0, r9
bne exit
mov r0, r8
add r1, r4, #0x0
bl branchtwo
ldr r3, [sp, #0x0]
exit: add r3, #0x1
lsl r1, r3, #0x1
add r1, r1, r3
add r0, r7, r1
ldrb r0, [r0, #0x2]
cmp r0, r5
bne loop
exit2: add sp, #0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
branchone: push {r4-r7,lr}
add sp, #-0x4
ldr r7, gothere
bx r7
branchtwo: push {r4-r7}
ldr r7, gothere2
bx r7
.align
gothere: .word 0x0803E8B5
gothere2: .word 0x0803EC43
movesettable: .word 0x08FFFFFF

This causes, instead of loading the movesettable adding to the level of the Pokemon, directly loading a byte of memory to your taste!
...
In this case, the movements were loaded with my previous routine.

ShyRayq
January 21st, 2014, 10:43 PM
Wait wait, how would I insert those routines? I only inserted the second one and replaced Doesn't fixed routine with yours, so I essentially replaced the second routine.
That still wouldn't work, so I'm going to ask that, do I just insert the first routine anywhere? What other bytes do I have to modify to branch to the first routine?

My theory is that, maybe, the first routine is the problem, since the 512+ moves are loading correctly, and its just that I'm not learning any moves. But I don't know...

BugMania
January 22nd, 2014, 01:24 AM
Wait wait, how would I insert those routines? I only inserted the second one and replaced Doesn't fixed routine with yours, so I essentially replaced the second routine.
That still wouldn't work, so I'm going to ask that, do I just insert the first routine anywhere? What other bytes do I have to modify to branch to the first routine?

My theory is that, maybe, the first routine is the problem, since the 512+ moves are loading correctly, and its just that I'm not learning any moves. But I don't know...

Ok, sorry if I was not very clear ...

--------------------------------------------------------------------------------
The first routine (which I wrote) serves to locate the pokemon data.
You will insert it into any free space.
Instead of directly inserting the routine of the Jambo 51 (Change 0x3EA10 to 00 49 08 47 XX XX XX 08), insert this XXXXXX my routine +1.
Now you will have the data of the movements of the pokemon in an area of ​​memory, the 0x02FF7D24.
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------
The second routine is almost the same of the routine of the Jambo 51, ​​so this does not do the calculations, only handle the movements directly in 0x02FF7d24.
Now, where do you see what is written "JAMBO51ROUTINEOFFSET" you must put in this place to offset it a second routine that showed +1 (in any space).
--------------------------------------------------------------------------------

ShyRayq
January 22nd, 2014, 02:05 AM
After all of that, my Pokemon still won't learn any new moves.
However, the error in Jambo's original routine (the one Doesn't points out) has been erased so, that's a plus.

I'm sorry for causing you this trouble, but, I just think that figuring this out is something that needs to be done.

Leafbarrett
January 25th, 2014, 11:00 PM
Welp, since nobody else wants to try to help out Emerald hackers, I guess I'll throw these in here.
These are all Emerald pointers, obviously.
Attack data: 31C898
Name data: 31977C
Anim data: 2C8D6C
Limiter: 14e504
Effects data: Haven't got a ****ing clue, the tutorial fails me for this one

bcrobert
January 26th, 2014, 11:59 PM
Welp, since nobody else wants to try to help out Emerald hackers, I guess I'll throw these in here.
These are all Emerald pointers, obviously.
Attack data: 31C898
PP data: 31c89d
Name data: 31977C
Anim data: 2C8D6C
Limiter: 14e504
Effects data: 2d86a8
Contest data: 58c2b4

Does this help? My additions are in bold. I haven't tested these myself but I believe they're correct. Thought I'd chime in since you saved me the trouble of tracking down the limiter. ;)

EDIT. Tlachtli had covered literally everything except the limiter without me realizing it somehow. These are correct but scroll up to post 91 for a more detailed answer.

Teh Blazer
January 27th, 2014, 11:31 AM
I repointed my table and added new moves, but now my status effect animations have changed to my new moves (ex: instead of z's when you're asleep a bunch of rocks fall on your head). Was there something I forgot to repoint?

ShyRayq
January 27th, 2014, 01:36 PM
I repointed my table and added new moves, but now my status effect animations have changed to my new moves (ex: instead of z's when you're asleep a bunch of rocks fall on your head). Was there something I forgot to repoint?

Is this just on the new moves or the old moves as well? If it's just the new moves, don't worry, that's normal because the animation pointers get shifted over one place. But if it's the old moves as well, you might have don't something very wrong with the pointers to the animation pointer table or messed up one of the animation script pointers. Make sure you backup and quintuple check everything.

Tlachtli
January 27th, 2014, 10:37 PM
Does this help? My additions are in bold. I haven't tested these myself but I believe they're correct. Thought I'd chime in since you saved me the trouble of tracking down the limiter. ;)

Check my post from earlier if you aren't sure. It has the table locations and lengths for BPEE, and they all work.

Phenom2122
July 2nd, 2014, 07:55 PM
The second routine is almost the same of the routine of the Jambo 51, ​​so this does not do the calculations, only handle the movements directly in 0x02FF7d24.

Sorry to quote you from so long ago, I am busy porting all this ASM to Emerald and your ASM is the last one I need to do.
May I ask why that offset in particular? Does that just point to unused space in Fire Red?

Well in any case, here are the ASM scripts with the correct Emerald offsets. My hack progress is nowhere near the point I can actually test this but maybe someone can make use of it in the mean time, the offsets are sound.
@Jambo51's first ASM:
.text
.align 2
.thumb
.thumb_func
.global newmovesetstyle
main:
mov r1, r9
lsl r1, r1, #0x2
ldr r0, table
add r0, r0, r1
ldr r0, [r0, #0x0]
ldr r6, there
add r6, #0x6
ldrb r7, [r6, #0x0]
loop: lsl r1, r7, #0x1
add r1, r1, r7
add r3, r0, r1
ldrb r1, [r3, #0x2]
mov r4, r10
cmp r4, r1
beq learn
cmp r1, #0xFF
beq exit
add r7, #0x1
b loop
learn: ldr r2, there
add r7, #0x1
strb r7, [r6, #0x0]
ldrb r1, [r3, #0x1]
lsl r1, r1, #0x8
ldrb r0, [r3, #0x0]
orr r0, r1
strh r0, [r2, #0x0]
ldr r1, return
bx r1
exit: ldr r0, return2
bx r0
.align
return: .word 0x080693F5
return2: .word 0x08069403
table: .word 0x8FFFFFF
there: .word 0x020244E2Change 0x693B0 to 18 49 08 47
Then navigate to 0x69414 and change it to XX XX XX 08, where the XX XX XX stands for the pointer to your new routine plus 1.
Then, from what I've read, instead of Jambo's second ASM routine we first need this one by @BugMania (there are ram offsets in this script that I assume point to free space in Fire Red, for now I am assuming the same for Emerald):
.text
.align 2
.thumb

Matriz:
mov r3, #0x0
ldr r1, Contador2
str r3, [r1]
ldr r1, moves
str r3, [r1]
add r1, #0x4
str r3, [r1]
add r1, #0x4
str r3, [r1]
add r1, #0x4
str r3, [r1]
LDR R1, movesettable
ADD R1, R6, R1
LDR r2, [R1]
LDR r3, var
STR r2, [r3]
Start:
mov r2, r10
LDR r3, var
LDR r3, [r3]
LDRB r3, [r3, #0x2]
CMP r3, r2
BLS Frente
ldr r1, var
ldr r2, [r1]
sub r2, #0x3
str r2, [r1]
B Compare
Frente:
LDR r2, var
LDR r2, [r2]
ADD r2, #0x3
LDR r3, var
STR r2, [r3]
B Start
Compare:
LDR r2, Contador
LDRB r2, [r2]
CMP r2, #0x4
BEQ end
LDR r2, var
LDR r2, [r2]
LDRH r2, [r2]
LDR r3, moves
LDRH r3, [r3]
LDR R7, Contador2
LDRB R7, [R7]
ADD r3, R7, r3
CMP r2, r3
BEQ Traz
LDR R7, Contador2
LDRB R7, [R7]
ADD R7, #0x3
LDR r2, Contador2
STRH R7, [r2]
LDR R7, Contador2
LDRB R7, [R7]
CMP R7, #0xC
Blo Compare
LDR R7, Contador2
MOV r2, #0x0
STRB r2, [R7]
B Insert
end:
MOV r3, #0x0
LDR r2, Contador
STR r3, [r2]
ldr r1, var
ldr r2, [r1]
add r2, #0x3
str r2, [r1]
LDR R1, movesettable
ADD R1, R6, R1
LDR r2, [R1]
ldr r1, var
ldr r3, [r1]
cmp r3, r2
bhs end1
str r2, [r1]
end1:
mov r2, #0x0
mov r3, #0x0
mov r4, #0x0
mov r7, #0x0
LDR R1, Go
bx r1
Traz:
LDR r1, var
LDR r2, [r1]
sub r2, #0x3
str r2, [r1]
B Compare


Insert:
LDR R7, Contador
LDRB R7, [R7]
MOV r2, #0x3
MUL R7, r2, R7
LDR r3, moves
ADD r3, R7, r3
LDR r2, var
LDR r2, [r2]
LDRB r2, [r2]
STRB r2, [r3]
LDR r2, var
LDR r2, [r2]
LDRB r2, [r2, #0x1]
STRB r2, [r3, #0x1]
LDR r2, var
LDR r2, [r2]
LDRB R2, [R2, #0x2]
STRB R2, [R3, #0x2]
LDR R7, Contador
LDRH R7, [R7]
ADD R7, #0x1
LDR r2, Contador
STRB R7, [r2]
b Traz

.align 2
var: .word 0x02FF7d24
Contador2: .word 0x02FF7D2C
moves: .word 0x02FF7D50
movesettable: .word 0x08FFFFFF
Contador: .word 0x02FF7D28
Go: .word 0xJAMBO51ROUTINEOFFSETChange 0x692A0 to 00 49 08 47 XX XX XX 08 where the XX XX XX stands for the pointer to your new routine plus 1.
Then Jambo's second routine slightly modified by BugMania:
.text
.align 2
.thumb
.thumb_func
.global newmovesetstyle2
main:
ldrb r1, [r0, #0x2]
mov r2, #0xFF
cmp r1, r2
beq exit2
mov r9, r2
mov r3, #0x0
loop: lsl r0, r3, #0x1
add r0, r0, r3
ldr r1, =0x02FF7D24
ldr r1, [r1, #0x0]
add r7, r0, r1
ldrb r0, [r7, #0x2]
mov r4, r10
cmp r0, r4
bgt exit2
ldrb r1, [r7, #0x1]
ldrb r0, [r7, #0x0]
lsl r1, r1, #0x8
orr r1, r0
mov r0, r8
str r3, [sp, #0x0]
bl branchone
mov r5, r9
ldr r3, [sp, #0x0]
cmp r0, r9
bne exit
mov r0, r8
add r1, r4, #0x0
bl branchtwo
ldr r3, [sp, #0x0]
exit: add r3, #0x1
lsl r1, r3, #0x1
add r1, r1, r3
add r0, r7, r1
ldrb r0, [r0, #0x2]
cmp r0, r5
bne loop
exit2: add sp, #0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
branchone: push {r4-r7,lr}
add sp, #-0x4
ldr r7, gothere
bx r7
branchtwo: push {r4-r7}
ldr r7, gothere2
bx r7
.align
gothere: .word 0x08069145
gothere2: .word 0x080694D3
movesettable: .word 0x08FFFFFFThis will fix the moveset loading to it can now support up to 0xFFFF moves (instead of 0x1FF).
Then Jambo's final routine:
.text
.align 2
.thumb
.thumb_func
.global newmovesetstyle
main:
lsl r2, r5, #0x1
add r2, r2, r5
ldr r1, [sp, #0x10]
add r0, r2, r1
ldrb r0, [r0, #0x2]
ldr r1, [sp, #0xC]
add r7, r2, #0x0
add r5, #0x1
mov r12, r5
cmp r0, r1
bgt later
mov r4, #0x0
cmp r1, r0
beq later2
mov r4, #0x1
neg r4, r4
ldr r0, [sp, #0x14]
ldr r1, table
add r6, r0, r1
mov r3, sp
sub r3, #0x2
add r5, r7, #0x0
there: add r3, #0x2
add r4, #0x1
cmp r4, #0x3
bgt later2
ldr r0, [r6, #0x0]
add r0, r5, r0
ldrb r2, [r0, #0x0]
ldrb r0, [r0, #0x1]
lsl r0, r0, #0x8
orr r0, r2
ldrh r2, [r3, #0x0]
cmp r0, r2
bne there
later2: cmp r4, #0x4
bne later
mov r4, #0x0
cmp r4, r10
bge later3
mov r1, r9
ldr r0, [r1, #0x0]
add r0, r7, r0
ldrb r2, [r0, #0x0]
ldrb r1, [r0, #0x1]
lsl r1, r1, #0x8
orr r1, r2
ldr r0, [sp, #0x8]
ldrh r2, [r0, #0x0]
cmp r1, r2
beq later3
ldr r1, [sp, #0x14]
ldr r2, table
add r6, r1, r2
ldr r3, [sp, #0x8]
add r5, r7, #0x0
there2: add r3, #0x2
add r4, #0x1
cmp r4, r10
bge later3
ldr r0, [r6, #0x0]
add r0, r5, r0
ldrb r2, [r0, #0x0]
ldrb r0, [r0, #0x1]
lsl r0, r0, #0x8
orr r0, r2
ldrh r2, [r3, #0x0]
cmp r0, r2
bne there2
later3: cmp r4, r10
bne later
mov r0, r10
add r0, #0x1
mov r10, r0
lsl r2, r4, #0x1
ldr r1, [sp, #0x8]
add r2, r2, r1
mov r4, r9
ldr r0, [r4, #0x0]
add r0, r7, r0
ldrb r1, [r0, #0x0]
ldrb r0, [r0, #0x1]
lsl r0, r0, #0x8
orr r0, r1
strh r0, [r2, #0x0]
later: mov r5, r12
mov r1, r9
ldr r0, [r1, #0x0]
lsl r1, r5, #0x1
add r1, r1, r5
add r1, r1, r0
ldrb r0, [r1, #0x2]
cmp r0, #0xFF
bne main
mov r0, r10
add sp, #0x18
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
.align
table: .word 0x08FFFFFFChange 0x06E118 to 00 4A 10 47 XX XX XX 08 where the XX XX XX stands for the pointer to your new routine plus 1.
Hopefully this can be useful to someone. I will test it myself soon.

Artemis64
September 15th, 2014, 08:44 PM
For some reason, my Pokemon don't learn any new moves after inserting Phenom2122's ASM routines. The same thing occurs when I use Jambo51's routine with Emerald's offsets. Exactly what is wrong?

Chaos Rush
October 11th, 2014, 10:11 AM
So for those of you having the problem where Pokémon don't learn moves upon level-up if you expanded to more than 512 moves, I think I've found a fix.

(for FireRed)
1. Insert Jambo's routines from the first post, but for the 2nd routine use Doesnt's routine seen here: http://www.pokecommunity.com/showpost.php?p=7982882&postcount=90
2. Put 2E D1 at 0803EAE8

Things I tested:
*givepokemon command
*opponent Trainer's Pokémon with non-custom moveset
*wild Pokémon

Everything seems to be working correctly, Pokémon learn their correct moves even if it's a move past #512 regardless of what level they were generated at.

I'm not fully sure why this works, so use at your own risk. Also make sure that you give PP to your moves past #512 (or even the ones past #355, which is Psycho Boost, the last move of Gen III) because you might mistake the opponent's use of Struggle as a "glitch".

Artemis64
October 11th, 2014, 06:39 PM
The corresponding offset seems to be 0x69378 for Emerald

Phenom2122's routines cause my Pokemon not to learn any moves at all. Then, after using Chaos Rush's method and using the offset 69378 for Emerald, my Pokemon learn Growl every time they level up. Chaos Rush, can you please tell me how you found the above bytes so I can apply the same method to Emerald?

Edit: Scratch that, it seems that Pokemon learn their first move in the learnset as per the regular learnset style instead every time they level up. There is something we're missing for Emerald.

Chaos Rush
October 13th, 2014, 05:48 AM
Phenom2122's routines cause my Pokemon not to learn any moves at all. Then, after using Chaos Rush's method and using the offset 69378 for Emerald, my Pokemon learn Growl every time they level up. Chaos Rush, can you please tell me how you found the above bytes so I can apply the same method to Emerald?

Edit: Scratch that, it seems that Pokemon learn their first move in the learnset as per the regular learnset style instead every time they level up. There is something we're missing for Emerald.
The problem is that Phenom's routines are BugMania's routines. My fix is for DoesntKnowHowToPlay's routine, which is different.

DoesntKnowHowToPlay
October 13th, 2014, 06:19 AM
Use Phenom's, my fixes were meant for the 649 match, which has tweaks that Jambo didn't document. I'd repost my stuff but I haven't tested it sufficiently to feel comfortable with it.

edit: give me a sec actually and I'll post what I have since it looks like nothing's working.


.org 0x3ea88
push {r4-r7, lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
add sp, #-0x4
mov r8, r0
lsl r4, r1, #0x18
lsr r4, r4, #0x18

#r8 == pointer to mon
#r4 == restarting or not

mov r0, #0x0
str r0, [sp, #0x0]
mov r0, r8
mov r1, #0xb
mov r2, #0x0
bl 0x3fbe8

lsl r0, r0, #0x10
lsr r0, r0, #0x10
mov r9, r0
mov r0, r8
mov r1, #0x38
mov r2, #0x0
bl 0x3fbe8

lsl r0, r0, #0x18
lsr r0, r0, #0x18
mov r10, r0

#r4 = restarting or not
#r8 = pointer to mon
#r9 = species
#r10 = exp level of mon

cmp r4, #0x0
beq Continue

Restart:
ldr r4, .PositionPointer
mov r1, sp
ldrb r1, [r1, #0x0]
strb r1, [r4, #0x0]
b Merge

Continue:
ldr r4, .PositionPointer
ldrb r1, [r4, #0x0]
add r1, r1, #0x1
strb r1, [r4, #0x0]

Merge:


Loop:
ldr r1, .MovepoolTable
mov r2, r9
lsl r2, r2, #0x2
add r0, r1, r2
ldr r0, [r0, #0x0]

ldrb r5, [r4, #0x0]
mov r3, #0x3
mul r3, r5
add r0, r3
ldrb r1, [r0, #0x2]

mov r6, #0xFF
cmp r1, r6
beq Abort
cmp r1, r10
beq Learn

add r5, r5, #0x1
strb r5, [r4, #0x0]
b Loop

Learn:
ldrb r1, [r0, #0x0]
ldrb r0, [r0, #0x1]
lsl r0, r0, #0x8
orr r1, r0, r1
ldr r0, .MoveStorage
strh r1, [r0, #0x0]

mov r0, r8
bl 0x3e89c
lsl r0, #0x10
lsr r0, #0x10
str r0, [sp, #0x0]

Abort:


End:
ldr r0, [sp, #0x0]
add sp, #0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1

.align 2
.PositionPointer: .word 0x02024028
.MoveStorage: .word 0x02024022
.MovepoolTable: .word 0x0825d7b4
This rewrite of FR's level-up moves (Jambo's first routine) is shorter than the vanilla implementation, and as such fits right on top of it. Change .MovepoolTable to point to your movepool table ofc. Be aware that if you use G3S to expand your dex, you will need to reinsert this routine, as it blindly overwrites part of the routine that clips into an offset in the old stuff. Note that you might be better off with my old routine + Chaos Rush's byte tweak in the preceding post, but if that doesn't work for whatever reason I'm dumping this here.

Artemis64
October 14th, 2014, 06:14 PM
I know that your fix is for Doesnt's routines, I was saying that when I both attempted Phenom's and your methods on Emerald with byte to byte corresponding offsets, the learnset either entirely failed (Phenom's method) or Pokemon learnt the first move in their learnset according to the old learnset style every time they leveled up (Chaos Rush's method).
Edit: My Emerald ROM is also manually patched for extra Pokemon & Pokedex Entries (i.e. 649 patch)

Chaos Rush
October 14th, 2014, 09:11 PM
I know that your fix is for Doesnt's routines, I was saying that when I both attempted Phenom's and your methods on Emerald with byte to byte corresponding offsets, the learnset either entirely failed (Phenom's method) or Pokemon learnt the first move in their learnset according to the old learnset style every time they leveled up (Chaos Rush's method).
Edit: My Emerald ROM is also manually patched for extra Pokemon & Pokedex Entries (i.e. 649 patch)
Did you make sure you redid the movesets after checking "Use Jambo51 move hack" in PGE or opening up G3HS's ini and setting "Jambo51movehack" (or whatever it says) to "true"? I haven't tested your offset for Emerald but on FireRed they learn all moves just fine, not just the first one.

I came up with the fix by using VBA's disassembler to look at the original code that is modified to branch to the 2nd(Doesnt's) routine and a 'be' (branch if equal) command that somehow wasn't performing right most likely due to the other byte changes required for the 512+ move expansion, my byte fix simply changes it to a 'bne' (branch if not equal) command. I might have gotten those two commands mixed up in my explanation because I honestly don't remember which one was in the original code and which one was the one I changed it to, and I can't check right now because I'm typing this on my phone.

Anyhow I'll look into it soon if it's still not working for Emerald.

Artemis64
October 15th, 2014, 03:24 PM
I just wrote a learnset from scratch in the new style then pointed a Pokemon (Swampert) learnset to it.
Here's the learnset:
2D 00 01 BD 00 01 21 00 01 37 00 01 BD 00 06 37 00 0A 75 00 0F 55 01 10 C1 00 14 AA 01 19 24 00 1F 4A 01 27 B6 00 2E 59 00 34 1B 01 3D 67 01 45 00 00 FF
The problem is that both G3HS and PGE crash if I enable the new learnset style in the ini file and open an Emerald ROM. I think it's because they aren't adapted to use the Emerald offsets or something?

MrDollSteak
October 27th, 2014, 04:37 PM
Did you make sure you redid the movesets after checking "Use Jambo51 move hack" in PGE or opening up G3HS's ini and setting "Jambo51movehack" (or whatever it says) to "true"? I haven't tested your offset for Emerald but on FireRed they learn all moves just fine, not just the first one.

I came up with the fix by using VBA's disassembler to look at the original code that is modified to branch to the 2nd(Doesnt's) routine and a 'be' (branch if equal) command that somehow wasn't performing right most likely due to the other byte changes required for the 512+ move expansion, my byte fix simply changes it to a 'bne' (branch if not equal) command. I might have gotten those two commands mixed up in my explanation because I honestly don't remember which one was in the original code and which one was the one I changed it to, and I can't check right now because I'm typing this on my phone.

Anyhow I'll look into it soon if it's still not working for Emerald.

What I've found is that no matter what level the Pokemon appears at, it has the first four moves of its moveset. Which means that Doesn'ts routine doesn't really port to Emerald all that well, even with the byte fix. In fact the byte fix doesn't do anything if its D0 or D1.

The port seems to be correct though as everything else works fine otherwise, including level-up moves.

EDIT: Doesn't has updated his post now, so it works fine.

Artemis64
November 4th, 2014, 03:02 AM
Are you sure you used the right offset? And what you say seems to be correct, except that I'm talking about the move(s) that Pokemon learn when they level up. I don't know about wild Pokemon or received Pokemon.

Lance32497
November 9th, 2014, 11:42 PM
Well guys I have made some progress on BSE!

It now compiles! I tested it a little while ago with this very simple script.

#org 0x800000
capture
end
It's still very basic in nature though and not every command is implemented. It is still a step in helping everyone be able to create their own move effects. These are the commands I have implemented to far. They're kind of blah so please give me some feedback on their names.
(Credit to JPAN and Jambo51 for their research!)

"&H0" = "unknownCommand0x00NoArgs"
"&H1" = "SomeCompare"
"&H2" = "usedattackmsg"
"&H3" = "hitmisscalc"
"&H4" = "critcalc"
"&H5" = "basedmgcalc"
"&H6" = "typedmgcalc"
"&H7" = "effectcheck1"
"&H8" = "effectcheck2"
"&H9" = "baexe"
"&HA" = "turncheck"
"&HB" = "healthbardec"
"&HC" = "healthvaldec"
"&HD" = "critcheck"
"&HE" = "unkloopcheck"
"&H10" = "msgdisplay"
"&H12" = "seffectmsgdisplay"
"&H1A" = "faintdisplay"
"&H23" = "battleendfunc"
"&H24" = "ifwildend"
"&H26" = "storebyteforjump"
"&H27" = "jumpifbyte"
"&H28" = "goto"
"&H2E" = "storebyte"
"&H2F" = "addbyte"
"&H30" = "subtractbyte"
"&H31" = "copyarray"
"&H32" = "addarray"
"&H39" = "pause"
"&H3A" = "wait"
"&H3C" = "return1"
"&H3D" = "return2"
"H3F" = "end"
"&H41" = "call"
"&H45" = "animationprint"
"&H4C" = "pokemondataswitch"
"&H4D" = "pokemonbattledataswitch"
"&H4E" = "pokemonandhealthbardisplay"
"&H53" = "trainerdisplay"
"&H55" = "lvlupsnd"
"&H56" = "pkmfntsnd"
"&H57" = "flee"
"&H5C" = "hitflash"
"&H61" = "pkmswianimation"
"&H91" = "givemoney"
"&HEF" = "capture"

WOW! Looks amazing.... but......
Sorry for being noobish in my question, the codes are for reqular scripts?can i use XSE with these? if it is, what would be the meaning of the codes you listed above like "baexe" what is that? and if I use these code, what would be the entire script? Can you give a script of existing move in FR so that I can compare and create my own move effects

Sky High
February 3rd, 2015, 02:55 AM
What I've found is that no matter what level the Pokemon appears at, it has the first four moves of its moveset. Which means that Doesn'ts routine doesn't really port to Emerald all that well, even with the byte fix. In fact the byte fix doesn't do anything if its D0 or D1.

The port seems to be correct though as everything else works fine otherwise, including level-up moves.

Little help... I have inserted this to Emerald and really works (I swear)... I have tried what Chaos did... but then when I level up any Pokemon, it learns the level 1 move even if the pokemon levels up (level 3 or up). Noted that I have ported Jambo's 1st and 3rd routine, Doesnt's modified 2nd routine, and Chaos' byte change (and I personally found the correct offsets for Emerald). I reverted the byte back to D0 and still having Doesnt's routine... the Pokemon don't learn anything only while leveling up. And I haven't tried the original second routine to see if it works. What went wrong anyway? :/

Here's my personal offsets:
return: .word 0x0803EB65 693F5
return2: .word 0x0803EB73 69403
table: .word 0x08FFFFFF 1808600
there: .word 0x02024022 244E2

0x3EB20 693B0
0x3EB84 69414

gothere: .word 0x0803E8B5 69145
gothere2: .word 0x0803EC43 69427
movesettable: .word 0x0825D7B4 1808600

0x3EA10 692A0
0x3EAE8 69378

table: .word 0x08FFFFFF 1808600

0x43CE8 6E118

GoGoJJTech
February 3rd, 2015, 07:38 AM
WOW! Looks amazing.... but......
Sorry for being noobish in my question, the codes are for reqular scripts?can i use XSE with these? if it is, what would be the meaning of the codes you listed above like "baexe" what is that? and if I use these code, what would be the entire script? Can you give a script of existing move in FR so that I can compare and create my own move effects

This is for creating moves. You use Battle Script Pro by Jambo51. Not XSE.

Do not ask Jambo for anything; he's quit hacking and he'll only get aggravated with you. Go to his thread instead if you really want to learn about making battle scripts.

CloverCamerupt
February 9th, 2015, 06:33 PM
This looks a bit daunting but i think i can pull it off since my hack is planned to have a few new attacks, is there any way to implement more move graphics into free space somehow?

GoGoJJTech
February 10th, 2015, 02:39 PM
This looks a bit daunting but i think i can pull it off since my hack is planned to have a few new attacks, is there any way to implement more move graphics into free space somehow?

If you're referring to attack sprites and graphics like the shadow ball spike thingydoodler etc, MrDollSteak has a tutorial on adding new ones.

Edan
May 7th, 2015, 08:42 PM
I cannot for the life of me understand any of the hex manipulation involved in this. Is there really no tool out there that can do this? I have a .DS_Store file and a bunch of .BS files for Gen IV moves and I want to use those to add said moves to Emerald, but this is just too confusing for me. Could anybody with expertise about this perhaps make a tool, or at the very least, a video guide for the layman?

Artemis64
May 15th, 2015, 03:50 PM
You can't simply import the moves from Gen IV games using their files because all the move data is stored in certain tables which are limited in size. In order to add more moves we have to change the locations of aforementioned tables into areas in the ROMs where there is more space so we can add more data. After which, we need to change the pointers in the ROM to where the new expanded table is (think of moving your browser, then changing the shortcut on the Desktop, assuming you use Windows, to where the browser's program files now are) in a process called repointing. Then, we have to change the number of moves the programs in the ROM can read from the tables by removing the limiters- think of having a 600 GB hard disk, but your programs can only read from the first 200 GB. We have to alter the routines so they read the rest of the tables. This can be quite a lengthy and complicated process, and thus is not for people who want to simply add the Gen IV moves in so they can use their Dark Pulse in the Gen III games. Not to mention the differences in the four move tables (move names, move data, move animations, move descriptions).