Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2020-06-27 16:03:58

shasocastris
Member
Registered: 2017-06-16
Post 22/24

Hiding gym doors until the badge is won

Hey all,

I just finished playing through Pokemon Pyrite, and probably the most interesting feature of that game is that the warps to leave the gym aren't there until you earn the badge. So you can't leave until you win or blackout.

Since that game was made before disassemblies were common, I've been trying to recreate the logic of that, basing myself on what you see in the Elite Four rooms, which have a similar mechanic.

Right now I have:

VioletGym_MapScripts:
    db 2 ; scene scripts
    scene_script .HideDoor ; SCENE_DEFAULT
    scene_script .DummyScene ; SCENE_END
    
    db 1 ; callbacks
    callback MAPCALLBACK_TILES, .VioletGymDoors

.HideDoor
    prioritysjump .VioletCityGymExitHides
    end

.DummyScene
    end


.VioletGymDoors:
    checkevent EVENT_BEAT_FALKNER
    iftrue .RevealGymExit
    end
.RevealGymExit
    changeblock 4, 14, $1c ; reveal exit
    end


.VioletCityGymExitHides:
    changeblock 4, 14, $2d ; hide exit
    end

First, a victory in that the game compiles. That took a moment to work through the errors, so huzzah!

Now, the bugs.

First, when you enter, there is the 'earthquake' moment when you enter (I think that is the priorityjumps bit), but the map block itself doesn't change. I can leave an enter at will.

Second, when I defeat Falkner, the game gives me a blank screen.

Overall, I think I'm on the right track. In my mind, the psuedo code is fairly simple:
Hide the exit
Check to see if Falkner is beaten
If so, reveal the exit

That said, those two bugs mean I'm close but not there. Any ideas would be awesome.

Cheers!

Offline

#2 2020-06-27 17:24:43

Rangi
Member
Registered: 2016-05-09
Post 944/959

Re: Hiding gym doors until the badge is won

Compare your script to any of the Elite 4 rooms to note the differences.

- Use return instead of end in the callback
- Use reloadmappart after changeblock in the prioritysjump script.

Also make sure a scene exists for this map.

Offline

#3 2020-06-28 04:52:38

shasocastris
Member
Registered: 2017-06-16
Post 23/24

Re: Hiding gym doors until the badge is won

Rangi wrote:

Compare your script to any of the Elite 4 rooms to note the differences.

- Use return instead of end in the callback
- Use reloadmappart after changeblock in the prioritysjump script.

Also make sure a scene exists for this map.

Hmmm, now, I'm getting the following error:
error: main.asm(210) -> data/maps/scenes.asm(87) -> data/maps/scenes.asm::scene_var(3) -> macros/scripts/maps.asm::map_id(3): Unknown symbol "MAP_VIOLET_GYM_EXIT"
make: *** [Makefile:104: pokecrystal.gbc] Error 1

From the error, something is wrong in the scenes.asm or maps.asm files, but everything looks good.

From wram.asm

wMobileBattleRoomSceneID::                        db ; d9c0
wVioletGymExitSceneID::                           db ; d9c1

    ds 48

From data/maps/scenes.asm

scene_var MOBILE_BATTLE_ROOM,                          wMobileBattleRoomSceneID
    scene_var VIOLET_GYM_EXIT,                             wVioletGymExitSceneID
    db -1 ; end

From constants/scene_constants.asm

; wFastShip1FSceneID
    const_def 1
    const SCENE_FASTSHIP1F_ENTER_SHIP   ; 1
    const SCENE_FASTSHIP1F_MEET_GRANDPA ; 2
    
; wVioletGymExitSceneID
    const_def
    const SCENE_HIDE_VIOLETGYM_EXIT
    const SCENE_VIOLETGYM_SCENE

From VioletGym.asm

VioletGym_MapScripts:
    db 2 ; scene scripts
    scene_script .HideDoor ; SCENE_HIDE_VIOLETGYM_EXIT
    scene_script .DummyScene ; SCENE_VIOLETGYM_SCENE
    
    db 1 ; callbacks
    callback MAPCALLBACK_TILES, .VioletGymDoors

.HideDoor
    prioritysjump .VioletCityGymExitHides
    end

.DummyScene
    end

.VioletGymDoors:
    checkevent EVENT_BEAT_FALKNER
    iftrue .RevealGymExit
.RevealGymExit
    changeblock 4, 14, $1c ; reveal exit
    return

.VioletCityGymExitHides:
    changeblock 4, 14, $2d ; hide exit
    reloadmappart
    end

As far as I can tell, I've followed everything in the scene tutorial correctly (thanks for pointing that out, btw). But clearly not, because of the error.

Also, for future reference, when an error throws something like "-> data/maps/scenes.asm::scene_var(3)," what do the two colons mean? The previous parts of that error made sense. Starting in main.asm, line 210, go to data/maps/scenes.asm line 87. Is that referring to the 'scene_var' macro at the top?

As always, thanks from this novice romhacker for all the help.

Cheers!

Offline

Board footer

Powered by FluxBB