Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-07-22 10:03:09

triumph
Member
Registered: 2013-11-14
Post 20/66

[RED] Changing events after the Elite 4.

Hi there! I want to know how to change location after beating Elite 4. I'm working with pokered.
I found in scripts\halloffameroom.asm this:

; Elite 4 events
ResetEventRange ELITE4_EVENTS_START, ELITE4_CHAMPION_EVENTS_END, 1
xor a
ld [wHallOfFameRoomCurScript], a
ld a, PALLET_TOWN
ld [wLastBlackoutMap], a
callba SaveSAVtoSRAM
ld b, 5

I've changed it to LAVENDER_TOWN, but I didn't had any results.

I would like to appear here instead, and if possible, using another sprite.
iwll6f.jpg

I'll be waiting for your answers. :)

Last edited by triumph (2016-07-23 19:57:32)

Offline

#2 2016-07-22 18:49:56

Mmmmmm
Member
From: West Virginia
Registered: 2015-05-17
Post 46/261

Re: [RED] Changing events after the Elite 4.

I'm not too familiar with pokered, but where does it take you? From the sound of it, a change like that should take you in front of Lavender Town's Pokémon Center, since it's changing your blackout location.

As to using another sprite, you could look at what Red++ does with gender selection, I would assume there's a flag that checks what gender your character is. If you removed the choice at the start of the game so you were male by default, and then had a script to change that after beating the E4 (except instead of a female sprite it'd change you to an old man), it should give you what you're looking for.

Take my advice with a grain of salt though, like I said I'm not too familiar with pokered.

Offline

#3 2016-07-22 22:43:56

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,342/3,578

Re: [RED] Changing events after the Elite 4.

I haven't really looked into changing the location after the E4 yet. As for changing the sprite, yeah, you could just do what I did to add gender selection, not add the option to choose in the intro, and then just have it check if you have beaten the E4 at least once instead of checking wPlayerGender like I do now. I wanna say the easiest way to do that would be:

ld a, [wNumHoFTeams]
and a

If that returns 0, you haven't beaten the Elite Four yet, since you have no Hall of Fame teams. If it is anything other than 0, then you HAVE beaten the Elite Four already, so you should use the other sprites. And doing it this way, you don't have to add any new flags or anything, since it would be checking something that already exists.

Unfortunately, I don't have a commit to link you to for adding gender selection. That was one of the first things I did in Red++ before I got around to putting it on Github, so it is lumped in with a bunch of other stuff in a commit called something like "Initial RedPlusPlus changes". I wrote a tutorial for adding gender selection, though. I probably need to update some of the routine names and whatnot to get it up to date with current pokered, but you could use it as a starting point.

Last edited by Mateo (2016-07-22 22:46:46)

Online

#4 2016-07-23 02:28:52

triumph
Member
Registered: 2013-11-14
Post 21/66

Re: [RED] Changing events after the Elite 4.

So, where I should add this?

ld a, [wNumHoFTeams]
and a

in scripts\halloffameroom.asm?

Last edited by triumph (2016-07-23 02:42:20)

Offline

#5 2016-07-23 02:39:30

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,343/3,578

Re: [RED] Changing events after the Elite 4.

You should use that in... all of the stuff I posted for gender selection, replacing all the:

    ld a, [wd798] ; check gender
    bit 2, a      ; check gender

lines. The tutorial assumes that returning 0 is Red and Not Zero is Leaf, so the code would still work with this check, where 0 is Red and Not Zero is the old person or whatever.

Although to be fair, I really need to update that tutorial. Some of the label names might not be the same, and the tutorial accidentally still has a manually declared address instead of using the label for no apparent reason. So I'll try to get that tutorial updated later tonight or tomorrow, but in the meantime you can still be looking over it to see what all it will involve. And remember, you can skip the stuff that was for adding the selection thing in the intro, since you don't need that.

Online

#6 2016-07-23 02:44:44

triumph
Member
Registered: 2013-11-14
Post 22/66

Re: [RED] Changing events after the Elite 4.

I see. I'm also watching GitHub and searching for wPlayerGender to see where I could modify it. (I'm a bit slow trying to understand this, but I'll check your tutorial to understand)
I'm trying to apply this one (Since this sprite exists but doesn't walk):

2mxeps4.jpg

And it would be great if also I can add the Old Man sprite back for battle and Struggle as an attack for the Old Man, being independent from a Pokémon. But maybe I should go step by step before that.

Last edited by triumph (2016-07-23 02:45:32)

Offline

#7 2016-07-23 03:06:10

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,344/3,578

Re: [RED] Changing events after the Elite 4.

Also, if you're just searching Red++ for wPlayerGender, keep in mind that some of those have nothing to do with loading sprites and are just there to make some people have different dialogue if you were the girl. "All boys leave home some day" vs "All girls leave home some day" or the TV in your house showing a different movie like it did in FireRed, etc.

Online

#8 2016-07-23 04:14:15

triumph
Member
Registered: 2013-11-14
Post 23/66

Re: [RED] Changing events after the Elite 4.

Done. I made all changes and it worked perfectly. Thanks a lot!
Now that I discovered how things can change with [wNumHoFTeams], it's possible to do the following stuff with that one?:

●Remove all NPCs from Overworld.
●Remove all Pokémons from Party.
●Remove Wild Encounters.
●Replace Lavender Town Music in all maps.

Offline

#9 2016-07-23 04:25:18

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,345/3,578

Re: [RED] Changing events after the Elite 4.

To remove all NPCs that way, I guess you'd need to:
- Find the routine that reads person events on maps
- Add a check for that value
- Have it skip loading them if you've beaten the Elite Four

To remove all Pokemon from the party, you'd probably want to:
- Edit the hall of fame room script, so it sets the party count to 0

To remove Wild Encounters:
- Find the routine that loads wild Pokemon data
- Have it check that value
- If you've beaten the elite four, load the "no mons" data, else have it load the data normally like it did before

To replace all music with lavender town music:
- Find the routine that reads the table for which town plays which song
- Have it check that value
- If you've beaten the Elite Four, manually load Lavender Town, else have it load the proper entry from the list like it did originally.



I don't have any more detail on these at the moment, but that gives a basic outline for one way you could accomplish these things.

Online

#10 2016-07-23 05:03:39

triumph
Member
Registered: 2013-11-14
Post 24/66

Re: [RED] Changing events after the Elite 4.

I think this one is the routine for NPCs, am I right? On engine\overworld\map_sprites.asm

; This is used for both inside and outside maps, since it is called by
; InitOutsideMapSprites.
; Loads tile pattern data for sprites into VRAM.
LoadMapSpriteTilePatterns:
ld a,[wNumSprites]
and a ; are there any sprites?
jr nz,.spritesExist
ret
.spritesExist
ld c,a ; c = [wNumSprites]
ld b,$10 ; number of sprite slots
ld hl,wSpriteStateData2 + $0d
xor a
ld [hFourTileSpriteCount],a

Last edited by triumph (2016-07-23 05:19:31)

Offline

#11 2016-07-23 15:39:47

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,346/3,578

Re: [RED] Changing events after the Elite 4.

That just loads their graphics to VRAM, it doesn't load the actual events. Disabling that would result in sprites just being glitchy as far as I know.

Online

#12 2016-07-23 16:30:25

triumph
Member
Registered: 2013-11-14
Post 25/66

Re: [RED] Changing events after the Elite 4.

Wild Encounters is done. Still remaining NPCs, Music and editing the script of Hall Of Fame.
I wrote this on home\audio.asm, and it doesn't work, I don't know what I'm doing wrong. (Instead of doing an infinite loop of Lavender Town music, it makes a loop of surfing music)

PlayDefaultMusicCommon::
    ld a, [wNumHoFTeams]
    and a
    jr nz, .lavenderloop
    ld a, [wWalkBikeSurfState]
    and a
    jr z, .walking
    cp $2
    jr z, .surfing
    ld a, MUSIC_BIKE_RIDING
    jr .next

.lavenderloop
    ld a, MUSIC_LAVENDER

.surfing
    ld a, MUSIC_SURFING

Last edited by triumph (2016-07-23 16:34:42)

Offline

#13 2016-07-23 16:52:08

Rangi
Member
Registered: 2016-05-09
Post 48/870

Re: [RED] Changing events after the Elite 4.

After the .lavenderloop code, there's nothing to skip over the .surfing code, so a gets overwritten. Try this:

.lavenderloop
    ld a, MUSIC_LAVENDER
    jr .music_set

.surfing
    ld a, MUSIC_SURFING

.music_set

Pokémon Polished Crystal (GitHub) — version 2.2.0 released
Pokémon Red★ and Blue★: Space World Edition (GitHub) — updated August 19!
Polished Map: pokered+pokecrystal map, tileset, and palette editor — version 3.5.1 released!

Offline

#14 2016-07-23 17:10:33

triumph
Member
Registered: 2013-11-14
Post 26/66

Re: [RED] Changing events after the Elite 4.

Sorry, I tried but music glitches.

Offline

#15 2016-07-23 17:25:18

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,347/3,578

Re: [RED] Changing events after the Elite 4.

That's because the lavender music is in a different bank from the Bike Riding and Surfing songs, but the existing code is making it look in that same bank while trying to play Lavender Town's music. Going to have to modify it a bit more so it can set the proper bank for the Lavender Town music.

Online

#16 2016-07-23 17:52:04

triumph
Member
Registered: 2013-11-14
Post 27/66

Re: [RED] Changing events after the Elite 4.

I replaced Credits music with Lavender music, since I will not use it on my hack and it shares the same bank that Bike Riding and Surfing Songs.
In the ending credits, Lavender Music plays properly, but when I try to change:

.lavenderloop
    ld a, MUSIC_LAVENDER

to:

.lavenderloop
    ld a, MUSIC_CREDITS

Still having the same issue with the infinite loop Surfing song. Maybe it's more the way I placed the code.

Offline

#17 2016-07-23 18:08:08

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,348/3,578

Re: [RED] Changing events after the Elite 4.

You still need to keep the jump in there from before. The jump wasn't the problem. The jump made it actually try to play Lavender Town. The music being in the wrong bank is what made it glitch.

Online

#18 2016-07-23 18:19:10

triumph
Member
Registered: 2013-11-14
Post 28/66

Re: [RED] Changing events after the Elite 4.

Finally! It worked, thanks!

Offline

#19 2016-07-23 19:56:53

triumph
Member
Registered: 2013-11-14
Post 29/66

Re: [RED] Changing events after the Elite 4.

Mateo wrote:

To remove all Pokemon from the party, you'd probably want to:
- Edit the hall of fame room script, so it sets the party count to 0

Just to know, should I edit: scripts\halloffameroom.asm? If so, where?

Offline

#20 2016-07-23 20:07:07

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,349/3,578

Re: [RED] Changing events after the Elite 4.

If you'll go here and add this:

ld [wPartyCount], a


right after the part that says:

xor a
ld [wHallOfFameRoomCurScript], a


Then it should remove the party for you the way you want. So when you're done, it would look like:

ResetEventRange ELITE4_EVENTS_START, ELITE4_CHAMPION_EVENTS_END, 1
xor a
ld [wHallOfFameRoomCurScript], a
ld [wPartyCount], a
ld a, PALLET_TOWN
ld [wLastBlackoutMap], a
callba SaveSAVtoSRAM
ld b, 5


If that doesn't work, let me know.

Online

#21 2016-07-23 20:17:24

triumph
Member
Registered: 2013-11-14
Post 30/66

Re: [RED] Changing events after the Elite 4.

Worked excellent! The only thing left is removing the NPC events and replacing the new location.

Offline

#22 2016-07-23 20:41:21

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,350/3,578

Re: [RED] Changing events after the Elite 4.

Not sure since I haven't tested it, but you can probably go here and add:

ld a, [wNumHoFTeams]
and a
jp nz, .finishUp

And that *should* load everything else on a map, but completely ignore person events if you've beaten the E4.

Online

#23 2016-07-23 20:50:24

triumph
Member
Registered: 2013-11-14
Post 31/66

Re: [RED] Changing events after the Elite 4.

Works great in the routes and towns, but when I get inside a house the whole map crashes.

Offline

#24 2016-07-23 20:54:33

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,351/3,578

Re: [RED] Changing events after the Elite 4.

Strange, might need to add something somewhere else. Could also be an issue coming from the fact that you're editing bank 0 and continuing an existing save, which can cause issues due to shifting other data. Could easily test on a new game by just like... temporarily editing the warp to Gary's house to warp to the Hall of Fame room. That way tou can "beat the elite four" right away on a new game to make sure it works, then just fix the warp back when you're done.

Online

#25 2016-07-23 21:12:13

triumph
Member
Registered: 2013-11-14
Post 32/66

Re: [RED] Changing events after the Elite 4.

Tried with a new game (I used gamesharks to have badges and infinite pp and money to buy full restores, and played with the speed at max, and I made sure before to have a Pokedex first) passed Elite 4 and still having issues inside houses.

Offline

Board footer

Powered by FluxBB