summaryrefslogtreecommitdiff
path: root/Add-a-new-move.md
blob: c015f2d8d9e79e0c853e28df7e315fbbf7c91763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
This tutorial is for how to add new moves to the game. This is a relatively simple copy/paste job that should give you a basic idea of how move data is used in the game, and as such, we won't be making any new animations here. Also, if you want to have more than 255 moves in your hack, you will need to extend the move index to 2 bytes, which will also not be covered here. For this example, we'll be adding Heart Stamp, a move introduced in Generation V, as it is, more or less, a clone of Bite.

**DISCLAIMER:** Always backup your disassembly before editing anything. Neither I (RetroKoH), or anyone in the community, are responsible for anything going awry. Always take care and be sure to report any issues or ask any questions if you are unsure.
**ALSO:** This guide assumes you are using the latest build of pokered. Older versions may have Labels and/or data in other files or folders. When in doubt, search through your disassembly or ask for help.

## Contents
- [Define a move constant](#1-define-a-move-constant)
- [Give the move a name](#2-give-the-move-a-name)
- [Add move data](#3-add-move-data)
- [Add animation](#4-add-animation)
- [Add sound effect](#5-add-sound-effect)
- [Add to movesets](#6-add-to-movesets)

## 1. Define a move constant

The first thing we will do is establish a constant value for our new move in [constants/move_constants.asm](../blob/master/constants/move_constants.asm).

```diff
    const SLASH        ; a3
    const SUBSTITUTE   ; a4
    const STRUGGLE     ; a5
    const HEART_STAMP  ; a6 ; New move
NUM_ATTACKS EQU const_value - 1 
```

If you are adding multiple moves, make sure to remember their order in this list, as the data we enter in the next few sections of this tutorial must also follow that order.

## 2. Give the move a name

Next, we will put the text name that will be displayed. Go to [data/moves/names.asm](../blob/master/data/moves/names.asm), which should have the **MoveNames::** label, and add this:

```diff
    li "SLASH"
    li "SUBSTITUTE"
    li "STRUGGLE"
    li "HEART STAMP" ; Add this
```

"HEART STAMP" is 11 characters long. As a rule of thumb, try not to exceed 12 characters (e.g. "SELFDESTRUCT"). 12 is the limit that will fit on screen w/o causing glitches.

## 3. Add move data

Now for the easy part. Go to [data/moves/moves.asm](../blob/master/data/moves/moves.asm), which should have the **Moves:** label. You will see a set of data dedicated to moves and their attributes. Now, as Heart Stamp is effectively a variation of Bite, let's find BITE's data and copy that. Search for BITE, or just copy this:

```
    move BITE,         FLINCH_SIDE_EFFECT1,         60, NORMAL,   100, 25
```
And paste it at the end of the move data, but change the NORMAL to PSYCHIC, and BITE to HEART_STAMP, like so:
```
    move HEART_STAMP,         FLINCH_SIDE_EFFECT1,         60, PSYCHIC,   100, 25
```

## 4. Add animation

Next, we need to give our move an animation for when it is used in battle. Go to [data/moves/animations.asm](../blob/master/data/moves/animations.asm), and first look at the table labeled **AttackAnimationPointers:**. Add an entry for your move like so:

```diff
	dw SlashAnim
	dw SubstituteAnim
	dw StruggleAnim
	dw HeartStampAnim
	assert_table_length NUM_ATTACKS
```

Now we need to define this animation. You could create a new animation specific to your move, but that will not be covered in this tutorial. Instead, we will be reusing the animation for another move, in this case Lovely Kiss. Find **LovelyKissAnim:** and add a label in front of it like so:

```diff
HeartStampAnim:
LovelyKissAnim:
	battle_anim LOVELY_KISS, SUBANIM_12, 0, 6
	db -1 ; end
```

Now both moves will use this animation.

## 5. Add sound effect

Almost done! Go to [data/moves/sfx.asm](../blob/master/data/moves/sfx.asm). Again we can use Lovely Kiss, just copy its data in the table and paste it at the end. 

```diff
	db SFX_NOT_VERY_EFFECTIVE, $01, $ff ; SLASH
	db SFX_BATTLE_2C,          $d8, $04 ; SUBSTITUTE
	db SFX_BATTLE_0B,          $00, $80 ; STRUGGLE
	db SFX_BATTLE_09,          $88, $10 ; HEART_STAMP
	assert_table_length NUM_ATTACKS
```

With that, our move is officially in the game. Now we just need to add it to a moveset and put it in action.

## 6. Add to movesets

There are multiple ways we can implement the move into the game. For now, I'm going to show you the most simple and easy methods, so that you can see your move in action right away. First, let's set our new move as a starter's first move so we can test it immediately. I am a sucker for Water-type starters, so I'll be using Squirtle. Go to [data/pokemon/base_stats/squirtle.asm](../blob/master/data/pokemon/base_stats/squirtle.asm) and add the move like so:

```diff
db TACKLE, TAIL_WHIP, HEART_STAMP, NO_MOVE ; level 1 learnset
```

When you start a new game, your Squirtle (or whichever inferior starter you chose) will have the new move right away, and it should work sufficiently. With that, let's go ahead and add it to Jynx, since it is actually Jynx's move. Go to [data/pokemon/evos_moves.asm](../blob/master/data/pokemon/evos_moves.asm), search for **JynxEvosMoves:**, and add the move like so:

```diff
JynxEvosMoves:
; Evolutions
	db 0
; Learnset
	db 18, LICK
	db 23, DOUBLESLAP
	db 31, ICE_PUNCH
	db 35, HEART_STAMP ; Why not? You can place it wherever you want
	db 39, BODY_SLAM
	db 47, THRASH
	db 58, BLIZZARD
	db 0
```

This allows Jynx to learn the move at Level 35. You can modify this as you see fit, but follow two rules:
1. Keep the levels in order. Meaning that if you change HEART_STAMP to be learnt at Level 9, place it at the top of the list, as 9 comes before the others.
2. Don't put two moves at the same level. It is possible to manipulate your engine to be able to allow for multiple moves at the same level. If you have implemented such a change, disregard this rule. Otherwise, adhere to it.

There you have it! That's the simplest method for adding new moves to your ROM hack. Find me on the pret Discord server if you have any issues or if I've made any mistakes. Everything should be good to go though, and you're free to now add more moves as you see fit.