Add a new scene script - nickjwilde/pokecrystal GitHub Wiki
This tutorial is for adding a scene event to a map. We'll be Using Azalea Gym as an example.
Contents
1. Define SceneID in WRAM
Azalea Town Doesn't have a SceneID yet, so we need to define it. Edit 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
2. Define scene_var
Edit data/maps/scenes.asm:
scene_var: MACRO
; map, variable
...
scene_var MOBILE_BATTLE_ROOM, wMobileBattleRoomSceneID
+ scene_var AZALEA_GYM, wAzaleaGymSceneID
db -1 ; end
3. Define the scene
Edit constants/scene_constants.asm:
; See data/maps/scenes.asm for which maps have scene variables.
; Each scene_script and coord_event is associated with a current scene ID.
...
; wFastShip1FSceneID
const_def 1
const SCENE_FASTSHIP1F_ENTER_SHIP ; 1
const SCENE_FASTSHIP1F_MEET_GRANDPA ; 2
+; wAzaleaGymSceneID
+ const_def
+ const SCENE_AZALEAGYM_NOTHING
+ const SCENE_AZALEAGYM_SCENE
4. Add the Scene to Azalea Gym
Edit maps/AzaleaGym.asm:
object_const_def ; object_event constants
const AZALEAGYM_BUGSY
...
AzaleaGym_MapScripts:
def_scene_scripts
+ scene_script .DummyScene0 ; SCENE_AZALEAGYM_NOTHING
+ scene_script .DummyScene1 ; SCENE_AZALEAGYM_SCENE
def_callbacks
+.DummyScene0
+.DummyScene1
+ end
(Before August 2020, maps did not have def_*
macros, so they had to manually declare their quantities of scene_script
s, callback
s, etc. So instead of def_scene_scripts
they used to have db 0 ; scene scripts
, which you would change here to db 2
.)
That's it! Now you can use these scenes for a Coord event.