-
Notifications
You must be signed in to change notification settings - Fork 817
Add a new scene script
This tutorial is for adding a scene event to a map. We'll be Using Azalea Gym as an example.
Azalea Town Doesn't have a SceneID yet, so we need to define it. Edit ram/wram.asm:
INCLUDE "constants.asm"
INCLUDE "macros/wram.asm"
...
wMobileTradeRoomSceneID:: db ; d9bf
wMobileBattleRoomSceneID:: db ; d9c0
+wAzaleaGymSceneID:: db ; d9c1
- ds 49
+ ds 48
If you add more Scene Ids in the future you'll have to decrement the number after ds
accordingly. This allows the game to keep track of which scene the map has.
The ds is the unused space in this section. Each scene id takes one.
Edit data/maps/scenes.asm:
scene_var: MACRO
; map, variable
...
scene_var MOBILE_BATTLE_ROOM, wMobileBattleRoomSceneID
+ scene_var AZALEA_GYM, wAzaleaGymSceneID
db -1 ; end
This associates the scene ID with the map. You first list the map constant then the scene ID.
Edit maps/AzaleaGym.asm:
object_const_def ; object_event constants
const AZALEAGYM_BUGSY
...
AzaleaGym_MapScripts:
def_scene_scripts
+ scene_script AzaleaGymSlowpokeScene, SCENE_AZALEAGYM_SLOWPOKE
+ scene_script AzaleaGymNoop1, SCENE_AZALEAGYM_NOOP
def_callbacks
+AzaleaGymSlowpokeScene:
+ end
+AzaleaGymNoop1:
+ end
You define the scenes at the top of a map by specifying the script and then the ID you want to assign to that scene. The first scene in the list is the default one. Anything in the script will activate by default on the map load. Most commonly you will use scenes for coord_events instead. Look at various maps within pokecrystal that have scenes already in order to see some examples of how they can be used.
That's it! Now you can use these scenes for a Coord event.