Adding Animations to NPCs
This tutorial will show you how to view animations within object files, as well as add your own.
Contents
- 1 Getting Started
- 2 Tutorial: Replacing a Treasure Chest in Mido's House
- 3 Gameshark Codes
- 3.1 Debug ROM
- 3.1.1 Spin Attack Spawner
- 3.1.2 Replace Saria in Saria's House (Child)
- 3.1.3 Replace Warp Pad in Temple of Time (Child)
- 3.1.4 Replace Nabooru in Spirit Temple (Child)
- 3.1.5 Replace Beamos in Fire Temple Mini-Dungeon
- 3.1.6 Replace Fishing Pond Objects in Fishing Pond (Child)
- 3.1.7 Replace Warp Pad in Desert Colossus (Child)
- 3.1.8 Replace Warp Pad in Death Mountain Crater
- 3.1.9 Replace Boy in Kokiri Forest (Child)
- 3.1.10 Replace Freezard in Ice Cavern
- 3.1.11 Replace Bonooru in Sasa Test
- 3.1.12 Replace Dark Link in Sutaru
- 3.2 OoT (U/J) 1.0
- 3.2.1 Replace Boy in Kokiri Forest
- 3.2.2 Replace Heart in Saria's House
- 3.2.3 Replace Treasure Chest in Deku Tree
- 3.2.4 Replace Wolfos in Sacred Forest Meadow
- 3.2.5 Replace Guard in Kakariko Village
- 3.2.6 Replace Pot in Lon Lon Ranch
- 3.2.7 Replace Sign in Zora's Domain
- 3.2.8 Replace Sign in Gerudo Valley
- 3.2.9 Replace Wolfos in Forest Temple Entryway
- 3.1 Debug ROM
Getting Started
For this exercise, we're going to add an animation from the animation file object_oE_anime to the object object_oE3 (Early Saria).
Understanding Animation Headers
Animation headers are 32 hex digits long. Unlike map and scene headers, they appear after the data they define. An example of an animation header can be seen below.
More details about these commands can be found on the Scenes and Rooms page.
0027 0000 0600 47F0 0600 4F58 000C 0000
00ff | 0000 | 06rr | rrrr |
06ii | iiii | 000l | 0000 |
- Frames: 18000000 bboooooo
- Optional. If it doesn't exist, the scene only has one setup. If it does exist, it will have multiple scene setups
- Rotation Index List: 16000000 000000yy
- y sets the echo level of the sound effects
- Rotation Index Value List: 06ii iiii
- x and z affect various properties, such as Link's idling animation. This command hasn't been fully documented yet.
- Limiter: 12000000 xx000000
- If x ≠ 0, the skybox will be disabled.
- Time Settings: 10000000 xxxxyy00
- x sets the time of day when entering the room.
- If x = FFFF, the room defaults to the current game time.
- y sets the speed at which time flows. The value can be negative.
- x sets the time of day when entering the room.
- Mesh Header Location: 0A000000 bboooooo
- b is the bank index. 03 is used to reference the current room file.
- o is the location of the room's mesh header, relative to the start of the file. This renders the room's model.
- room header address + o = location of mesh header
- Object List: 0Bxx0000 bboooooo
- x indicates the number of objects.
- b is the bank index. 03 is used to reference the current room file.
- o is the location of the room's object list, relative to the start of the file.
- room header address + o = location of object list
- Actor List: 01xx0000 bboooooo
- x indicates the number of actors.
- b is the bank index. 03 is used to reference the current room file.
- o is the location of the room's actor list, relative to the start of the file.
- room header address + o = location of actor list
- End of Header Command: 14000000 00000000
- This command tells the game that the header ends here.
Finding Animation Headers
- Download the files object_oE_anime and object_oE3.
- Open these files in a hex editor.
- Open the Ocarina of Time Debug ROM or Ocarina of Time 1.0 in Nemu64.
- Go to the room you wish to find the header for.
- Go to Nemu's Plugins menu and choose Debugger:Memory.
- Type 80223CE8 (Debug ROM) or 80120C44 (1.0) into the address box.
- This will bring you to 80223CE8, where you'll find the current room address in the first column.
- Paste the address of the current room into the address box.
- This will bring you to the room header.
Understanding Actor Lists
Each line represents a different actor.
aaaaxxxx yyyyzzzz | ccddee0B 0000vvvv |
aaaaxxxx yyyyzzzz | ccddee00 0000vvvv |
aaaaxxxx yyyyzzzz | ccddee9F 0000vvvv |
aaaaxxxx yyyyzzzz | ccddee00 0000vvvv |
aaaaxxxx yyyyzzzz | ccddee00 0000vvvv |
aaaaxxxx yyyyzzzz | ccddee00 0000vvvv |
aaaaxxxx yyyyzzzz | ccddee00 0000vvvv |
- aaaa = Actor Number
- xxxx = X Coordinates (Hex)
- yyyy = Y Coordinates (Hex)
- zzzz = Z Coordinates (Hex)
- cc = X Rotation (Hex)
- dd = Y Rotation (Hex)
- ee = Z Rotation (Hex)
- vvvv = Variable Number
Understanding Object Lists
Each group of four digits/two bytes (ex. 01A5) comprises an object number. If a room has an odd number of objects (05 in this example), you only need to pay attention to the first five groups of four digits.
aaaabbbb ccccdddd | eeee0000 0163FFC8 |
- aaaa = Object #1
- bbbb = Object #2
- cccc = Object #3
- dddd = Object #4
- eeee = Object #5
- 0000 = Padding
Look up the object numbers here.
Tutorial: Replacing a Treasure Chest in Mido's House
What You'll Need
- Nemu64 Emulator
- Ocarina of Time Debug ROM
- Hex Calculator
Open Windows Calculator, change it to "Programmer" mode, and press the Hex button. Or, use an online calculator like this one.
Room Header
Finding the Room Header
- Go to Mido's House (Map 49 in Map Select) as Child Link.
- Go to Nemu's Plugins menu and choose Debugger:Memory.
- Type 80223CE8 into the address box.
- This will bring you to 80223CE8, where you'll find the current room address in the first column.
- The memory address for Mido's House is 80262880.
- Paste the address of the current room (80262880) into the address box.
- This will bring you to 80262880, where you'll find the room header.
Deciphering the Room Header
Below is the room header for Mido's House, located at 80262880. Use it to find the number of scene setups, the number of objects, the address of the object list, the number of actors, and the address of the actor list.
16000000 00000003 | 08020000 00000005 |
12000000 00010000 | 10000000 FFFF0000 |
0A000000 030000C0 | 0B050000 03000040 |
01070000 0300004C | 14000000 00000000 |
- Scene Settings: xx000000 000000yy
- If xx = 16, the room has one scene setup.
- If xx = 18, the room has multiple scene setups.
xx = 16 - Mido's house has one scene setup.
- Object List: 0Bxx0000 000000yy
- xx indicates the number of objects.
- yy is the location of the room's object list.
- room header address + yy = location of object list
xx = 05 - There are 05 objects in the room. yy = 40 - The location of the object list is 80262880 + 40, which is 802628C0.
- Actor List: 01xx0000 000000yy
- xx indicates the number of actors.
- yy is the location of the room's actor list.
- room header address + yy = location of actor list
xx = 07 - There are 07 actors in the room. yy = 4C - The location of the actor list is 80262880 + 4C, which is 802628CC.
Actors
Finding the Actor List
- Type 802628CC, the location of the actor list, into the address box.
- This will bring you to 802628CC, where you'll find a list of actors.
- Look up the actor numbers.
- Look up the variables.
- Replace them with whatever you want.
Deciphering the Actor List
Below is the actor list for Mido's House, located at 802628CC. Each line represents an actor. Mido's House has 07 actors, so there are 07 lines.
0163FFC8 00100080 | 0000960B 0000FF04 |
016D0003 00300086 | 00008000 0000FF00 |
0163FF83 000C0048 | 0000549F 0000FF00 |
000A003A 0000FFC9 | 00004000 000059A0 |
000A003A 00000023 | 00004000 000059A1 |
000AFFC4 0000FFC9 | 0000C000 00005982 |
000AFFC4 00000023 | 0000C000 00005903 |
The first four digits in each line comprise an actor number. Cross-reference them with this list.
Actor # | Filename | Actor ID | X | Y | Z | Variable # | Variable ID | Object # |
---|---|---|---|---|---|---|---|---|
0163 | ovl_En_Ko | Kokiri Child | FFC8 | 0010 | 0080 | FF04 | ??? | 0001 |
016D | ovl_En_Md | Mido | 0003 | 0030 | 0086 | FF00 | ??? | 00FB |
0163 | ovl_En_Ko | Kokiri Child | FF83 | 000C | 0048 | FF00 | ??? | 0001 |
000A | ovl_En_Box | Treasure Chest | 003A | 0000 | FFC9 | 59A0 | ??? | 000E |
000A | ovl_En_Box | Treasure Chest | 003A | 0000 | 0023 | 59A1 | ??? | 000E |
000A | ovl_En_Box | Treasure Chest | FFC4 | 0000 | FFC9 | 5982 | ??? | 000E |
000A | ovl_En_Box | Treasure Chest | FFC4 | 0000 | 0023 | 5903 | ??? | 000E |
Replacing Actors
- Find the actor number of the actor you wish to replace.
- Let's replace the treasure chest in line 4. (000A)
- Find the actor number of the actor you wish to replace it with.
- Let's replace the treasure chest (000A) with a sign (0141).
- Overwrite the old actor number with the new one.
- 000A003A 0000FFC9 00004000 000059A0 -> 000A003A 0000FFC9 00004000 000059A0
- Find the variable number of the actor you wish to replace.
- The variable of the treasure chest in line 4 is 59A0.
- Find the variable number you will use for the new actor.
- Let's make our sign say "XXXX". (XXXX)
- Overwrite the old variable number with the new one.
- 000A003A 0000FFC9 00004000 000059A0 -> 000A003A 0000FFC9 00004000 0000XXXX
Objects
Finding the Object List
- Type 802628C0, the location of the object list, into the address box.
- This will bring you to 802628C0, where you'll find a list of objects.
- Look up the object numbers.
- Replace them with whatever you want.
Deciphering the Object List
Below is the object list for Mido's House, located at 802628C0. Each group of four digits comprises an object number. Cross-reference them with this list. Mido's House has 05 objects, so we only need to pay attention to the first five groups of four digits.
00C500FC 00FD00FB | 000E0000 0163FFC8 |
These numbers correspond to the following:
Object # | Filename | Object ID |
---|---|---|
00C5 | object_os_anime | Required by human-like npcs |
00FC | object_km1 | Strawberry-Haired Kokiri Boy |
00FD | object_kw1 | Strawberry-Haired Kokiri Girl |
00FB | object_md | Mido |
000E | object_box | Treasure Chest/Boss Key Chest/Light When Opening Chest |
Replacing Objects
- Use the Actor List to find the object linked to the actor you wish to replace.
- We've chosen to replace a treasure chest, which is linked to object 000E (Treasure Chest/Boss Key Chest/Light When Opening Chest).
- Use the Actor List to find the object linked to the actor you wish to replace it with.
- We've chosen to replace the treasure chest (object 000E) with a sign (object 012F).
- Overwrite the old object number with the new one.
- 00C500FC 00FD00FB 000E0000 0163FFC8 -> 00C500FC 00FD00FB 012F0000 0163FFC8
Gameshark Codes
Debug ROM
Spin Attack Spawner
Spawns an actor that uses object 0000, 0001, 0002, or 0003 each time Link performs a spin attack.
813D7756 aaaa 813D7740 2409 813D7742 vvvv
- 0000 = Always Loaded
- 0001 = Loaded Indoors
- 0002 = Loaded Outdoors
- 0003 = Loaded in Dungeons
Replace Saria in Saria's House (Child)
Replaces Saria in Saria's House as Child Link.
8126A956 oooo 8126A96C aaaa 8126A97A vvvv
Replaces Saria in Saria's House as Child Link, for actors that use object 0000 or 0001.
8126A96C aaaa 8126A97A vvvv
Replace Warp Pad in Temple of Time (Child)
Replaces the Light Medallion warp pad in the Temple of Time as Child Link.
81288060 oooo 81288064 aaaa 81288072 vvvv
Replaces the Light Medallion warp pad in the Temple of Time as Child Link, for actors that use object 0000 or 0001.
81288064 aaaa 81288072 vvvv
Replace Nabooru in Spirit Temple (Child)
Replaces Nabooru kneeling beside the crawling hole in the first room of the Spirit Temple.
81273086 oooo 81273174 aaaa 81273182 vvvv
Replaces Nabooru kneeling beside the crawling hole in the first room of the Spirit Temple, for actors that use object 0000 or 0003.
81273174 aaaa 81273182 vvvv
Replace Beamos in Fire Temple Mini-Dungeon
Replaces the Beamos in the fire temple mini-dungeon in Ganon's Tower.
8128D0BC oooo 8128D1C0 aaaa 8128D1CE vvvv
For actors using object 0000 or 0003:
8128D1C0 aaaa 8128D1CE vvvv
Replace Fishing Pond Objects in Fishing Pond (Child)
Replaces the fishing pond objects actor (the fisherman, the sign, the fish, etc.), placing the new actor in the center of the pond.
81283780 oooo 81283784 aaaa 81283792 vvvv
For actors using object 0000 or 0002(?):
81283784 aaaa 81283792 vvvv
Replace Warp Pad in Desert Colossus (Child)
Replaces the warp pad in the Desert Colossus.
81284538 oooo 812846D0 aaaa 812846DE vvvv
For actors using object 0000 or 0002:
812846D0 aaaa 812846DE vvvv
Replace Warp Pad in Death Mountain Crater
Replaces the warp pad in the Death Mountain Crater.
81281710 oooo 81281878 aaaa 81281886 vvvv
For actors using object 0000 or 0002:
81281878 aaaa 81281886 vvvv
Replace Boy in Kokiri Forest (Child)
Replaces the rock-pulling boy in Kokiri Forest.
8128D7C0 oooo 8128D844 aaaa 8128D852 vvvv
For actors using object 0000 or 0002:
8128D844 aaaa 8128D852 vvvv
Replace Freezard in Ice Cavern
Replaces the first Freezard when going through the Ice Cavern.
8129AE7E oooo 8129AE94 aaaa 8129AEA2 vvvv
For actors using object 0000 or 0003:
8129AE94 aaaa 8129AEA2 vvvv
Replace Bonooru in Sasa Test
Replaces Bonooru the Scarecrow in the Child (Day) setup of Sasa Test.
812965DC oooo 812964E4 aaaa 812964F2 vvvv
For actors using object 0000 or 0002:
812964E4 aaaa 812964F2 vvvv
Replace Dark Link in Sutaru
Replaces Dark Link in Sutaru.
812B0BD0 oooo 812B0BE0 aaaa 812B0BEE vvvv
For actors using object 0000 or 0003:
812B0BE0 aaaa 812B0BEE vvvv
OoT (U/J) 1.0
Replace Boy in Kokiri Forest
Replaces the boy pulling rocks outside of Mido's House in Kokiri Forest.
81244096 oooo 81244124 aaaa 81244132 vvvv
Replaces the boy pulling rocks outside of Mido's House in Kokiri Forest, for actors that use object 0000 or 0002.
81244124 aaaa 81244132 vvvv
Replace Heart in Saria's House
Replaces the heart closest to the door and furthest from the camera in Saria's House.
81221108 oooo 8122112C aaaa 8122113A vvvv
Replaces the heart closest to the door and furthest from the camera in Saria's House, for actors that use object 0000 or 0001.
8122112C aaaa 8122113A vvvv
Replace Treasure Chest in Deku Tree
Replaces the treasure chest in the central room of the Deku Tree.
81234128 oooo 81234218 aaaa 81234226 vvvv
Replaces the treasure chest in the central room of the Deku Tree, for actors that use object 0000 or 0003.
81234218 aaaa 81234226 vvvv
Replace Wolfos in Sacred Forest Meadow
Replaces the Wolfos at the entrance to the Sacred Forest Meadow.
81259F3A oooo 81259F50 aaaa 81259F5E vvvv
Replace Guard in Kakariko Village
Replaces the guard beside the entrance in Kakariko Village.
8123A92C oooo 8123AC34 aaaa 8123AC42 vvvv
Replace Pot in Lon Lon Ranch
Replaces the pot nearest the entrance in Lon Lon Ranch.
8124851C oooo 81248564 aaaa 81248572 vvvv
Replace Sign in Zora's Domain
Replaces the sign beside the entrance in Zora's Domain.
8126097C oooo 81260A38 aaaa 81260A46 vvvv
Replace Sign in Gerudo Valley
Replaces the sign beside the entrance in Gerudo Valley.
81247260 oooo 8124732C aaaa 8124733A vvvv
Replace Wolfos in Forest Temple Entryway
Replaces the Wolfos in the first room of the Forest Temple.
81231CD4 oooo 81231CE4 aaaa 81231CF2 vvvv