Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2018-04-02 11:05:04

megamctaco
Member
Registered: 2015-08-23
Post 104/129

Changing Trainers (Red)

Hey everyone! I haven't touched this site or my hack for approx. 2 years, so I figured I should finally finish it since I'm not too far off.

Just need help with changing the trainers in the Fighting Dojo in Saffron City which I've turned into a Bug Gym, with Heracross and Scizor as the prizes.

I went to mapObjects\fightingdojo.asm and changed 'SPRITE_HIKER' and 'OPP_BLACKBELT' to 'SPRITE_BUG_CATCHER' and 'OPP_BUG_CATCHER' respectively, but now they've all got the same weak party as earlier in the game (e.g. Level 7 Weedle). How do I pinpoint exactly which trainers' parties to change in trainer_parties.asm?

Offline

#2 2018-04-02 13:54:59

megamctaco
Member
Registered: 2015-08-23
Post 105/129

Re: Changing Trainers (Red)

And it seems I've now messed something up with every trainer in the game...  They now all spin around (Nugget Bridge for example - I was able to get past the second last trainer because he turned the other way).

Offline

#3 2018-04-08 01:51:48

megamctaco
Member
Registered: 2015-08-23
Post 108/129

Re: Changing Trainers (Red)

bump... Really need some help here!

Offline

#4 2018-04-08 15:01:21

Miksy91
Member
Registered: 2010-10-16
Post 2,323/2,339

Re: Changing Trainers (Red)

Do you have a public github repository you could link here? Also have you done regular commits after you have changed something? If so, it shouldn't be too hard to track down, which commit causes that error off each trainer spinning around.

What comes to the problem with you having problems changing the pokemon parties of the trainers in Fighting Dojo, I at least wouldn't be able to help straight as I've never worked with pokered. Someone else could probably assist with this though.

Offline

#5 2018-04-08 22:51:04

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

Re: Changing Trainers (Red)

You'll notice there is a number after the "OPP_BLACKBELT" entries, this corresponds to which individual trainer in that list they use. So changing OPP_BLACKBELT to OPP_BUGCATCHER while keeping these numbers the same will cause them to reuse parties 1 through 5 in the Bug Catcher list. So you'd just add new parties to the end of the Bug Catcher list. So in this case, you could add a comment saying ;Fighting Dojo to mark where these are, then add your 5 new parties there. Then just count the entries to see which numbers to put in the map object data.


As for the trainers spinning that aren't supposed to be, I know I ran into this once with Red++ and I think it was caused when I mimicked Sanqui's changes to separate Pokemon and Trainer ID's. Anyway, I believe the fix I used is going to here and changing this part:

ld hl, wMapSpriteData
    add l
    ld l, a
    ld a, [hl]        ; read movement byte 2

to this:

ld hl, wMapSpriteData
    add l
    ld l, a
    jr nc, .nc
    inc h
.nc
    ld a, [hl]        ; read movement byte 2

Offline

#6 2018-04-09 02:00:18

megamctaco
Member
Registered: 2015-08-23
Post 109/129

Re: Changing Trainers (Red)

Mateo wrote:

You'll notice there is a number after the "OPP_BLACKBELT" entries, this corresponds to which individual trainer in that list they use. So changing OPP_BLACKBELT to OPP_BUGCATCHER while keeping these numbers the same will cause them to reuse parties 1 through 5 in the Bug Catcher list. So you'd just add new parties to the end of the Bug Catcher list. So in this case, you could add a comment saying ;Fighting Dojo to mark where these are, then add your 5 new parties there. Then just count the entries to see which numbers to put in the map object data.


As for the trainers spinning that aren't supposed to be, I know I ran into this once with Red++ and I think it was caused when I mimicked Sanqui's changes to separate Pokemon and Trainer ID's. Anyway, I believe the fix I used is going to here and changing this part:

ld hl, wMapSpriteData
    add l
    ld l, a
    ld a, [hl]        ; read movement byte 2

to this:

ld hl, wMapSpriteData
    add l
    ld l, a
    jr nc, .nc
    inc h
.nc
    ld a, [hl]        ; read movement byte 2

Cheers! That worked perfectly.

Now if I was to have rematches in my hack, how would I go about making it so you can re-battle any regular trainer (not gym leaders) by talking to them and having a "Do you want a rematch?" pop up box with YES/NO option? No idea where to look tbh.

Offline

#7 2018-04-09 06:56:53

megamctaco
Member
Registered: 2015-08-23
Post 110/129

Re: Changing Trainers (Red)

Okay I'm getting a huge glitch now. I just tried to add individual trainer names by following Mateo's commits, and when starting a new game, Red's room is all glitched out, and when I battle my rival for the first time, it says "*whatever I've named him* NINTEN sent out MISSINGNO!." then crashes.

EDIT: Nevermind. That seemed to be fixed by getting rid of the $53,$50 from the rival's party in trainer_parties.asm

But the individual trainer names still aren't working.

Last edited by megamctaco (2018-04-09 07:09:44)

Offline

#8 2018-04-09 10:18:34

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

Re: Changing Trainers (Red)

$53, $50 is the hex equivalent of '<RIVAL>@' Because there wasn't a charmap shortcut for the Rival's name back then. I'm not sure what exactly is causing your problem though. I'm guessing you missed some part of it while trying to copy my changes, but without being able to see your code I don't know what that would be.

Offline

#9 2018-04-09 10:49:10

megamctaco
Member
Registered: 2015-08-23
Post 111/129

Re: Changing Trainers (Red)

Mateo wrote:

$53, $50 is the hex equivalent of '<RIVAL>@' Because there wasn't a charmap shortcut for the Rival's name back then. I'm not sure what exactly is causing your problem though. I'm guessing you missed some part of it while trying to copy my changes, but without being able to see your code I don't know what that would be.

https://github.com/MegaMcTaco/pokeredha … e9f0d4f9cc

Ignore the mistake in the commit name. I'm still trying to wrap my head around Cygwin and Github. The first time around I absolutely destroyed everything, so I deleted my local files and got the non-messed up files from my Github repository, then tried to cherry pick your changes for the Individual Trainer Names rather and copying the code myself. Now the game crashes after winning the first battle with my rival after getting our starters.

Offline

#10 2018-04-09 11:49:17

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

Re: Changing Trainers (Red)

one thing that jumps out at me is confusion caused by my changes being made on a much older copy of pokered. You keep adding 'db $08' after TX_ASM although db 08 is the same thing as TX_ASM (just like the rival name thing, there just wasn't a constant for it). So by doing TX_ASM twice in a row, you're going to have problems. I'll try to look at it better when I'm not at work, but that's one thing I noticed immediately.

Offline

#11 2018-04-10 02:50:06

megamctaco
Member
Registered: 2015-08-23
Post 112/129

Re: Changing Trainers (Red)

Mateo wrote:

one thing that jumps out at me is confusion caused by my changes being made on a much older copy of pokered. You keep adding 'db $08' after TX_ASM although db 08 is the same thing as TX_ASM (just like the rival name thing, there just wasn't a constant for it). So by doing TX_ASM twice in a row, you're going to have problems. I'll try to look at it better when I'm not at work, but that's one thing I noticed immediately.

I got rid of all instances of db $08 I could find and did my best to fix it up. https://github.com/MegaMcTaco/pokeredha … 79bdcdcb3d

The only issue now is "Green defeated Lass 40 error" rather than "Green defeated Lass Nicole" and "Player*weird symbol* received BOULDERBADGE"

I know I messed up somewhere on the butt end of individual trainer names, but not sure where.

Offline

#12 2018-04-11 13:45:11

megamctaco
Member
Registered: 2015-08-23
Post 113/129

Re: Changing Trainers (Red)

Worked it out. I had [RIVAL] and [PLAYER] while also having <RIVAL> and <PLAYER> in some places, so I just updated it all and updated charmap. Looking good now!

One thing I'd love to do is to make battling Prof. Oak an "official" part of the game. I'd like to make his sprite appear in the Unknown Dungeon (for example) only after you've caught Mewtwo. Would that just be a matter of adding OPP_OAK and SPRITE_OAK (or whatever the equivalent would be) to that map? Does his team pop up that way? How would I go about scripting the event for him to only appear after Mewtwo is caught?

Offline

#13 2018-04-11 15:56:40

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

Re: Changing Trainers (Red)

Looking at your commit there, it looks like you'd need to add Oak back, since you copied my changes and took his trainer data out to add a different class haha. But yeah so long as he has a trainer class and teams defined, you can do OPP_PROF_OAK or whatever his constant is and SPRITE_OAK, and you'd need to add his other trainer pointers (event flag, text pointers) there after Mewtwo's and stuff (since overworld Pokemon are still essentially Trainer objects)

Offline

#14 2018-04-12 03:06:05

megamctaco
Member
Registered: 2015-08-23
Post 114/129

Re: Changing Trainers (Red)

Mateo wrote:

Looking at your commit there, it looks like you'd need to add Oak back, since you copied my changes and took his trainer data out to add a different class haha. But yeah so long as he has a trainer class and teams defined, you can do OPP_PROF_OAK or whatever his constant is and SPRITE_OAK, and you'd need to add his other trainer pointers (event flag, text pointers) there after Mewtwo's and stuff (since overworld Pokemon are still essentially Trainer objects)

Yeah I've re-added him and his team. I'm getting a "Expression must be 8-bit" error whenever I try to add him to a map though.

EDIT: Okay, so a bit more trouble... The final Rocket trainer in Mt. Moon before the Fossil Trainer has a level 253 Magmar for some reason hahaha... Not sure why. Some other trainers have  "RED defeated Rocket ERROR 04" after I win a battle too.

Last edited by megamctaco (2018-04-12 11:37:37)

Offline

#15 2018-04-23 00:49:48

megamctaco
Member
Registered: 2015-08-23
Post 115/129

Re: Changing Trainers (Red)

bump

Offline

#16 2018-04-23 05:08:17

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

Re: Changing Trainers (Red)

I'm not sure what went wrong there. I'll look into it when I'm not at work and have some time.

Offline

#17 2018-04-23 12:12:27

megamctaco
Member
Registered: 2015-08-23
Post 116/129

Re: Changing Trainers (Red)

Mateo wrote:

I'm not sure what went wrong there. I'll look into it when I'm not at work and have some time.

I think I went wrong somewhere when copying your 'Trainers have individual names' commit (43d50b9). I've fixed the name glitch at the end of each trainer battle. Although sometimes Brock will have a level 12 Gengar, for no reason.

I think "db "EXECUTIVE@",$FD,EXECUTIVE_F,15,RATTATA,ZUBAT,0" in trainer_parties.asm is the issue. When I remove "$FD,EXECUTIVE_F" it all works fine, but obviously the Executive F sprite doesn't load and I just get a regular Rocket Grunt sprite.

And when I add 'SPRITE_JAMES' as a map object, he shows up as SPRITE_BALL instead (a few others also do this).

Flannery on the other hand doesn't do this when I add her as a map object, and her party loads when I add "OPP_PKMN_TRAINER" to the end of her map object line. However, her battle sprite is all glitched out.

Any other commits I should look at that are connected to your 'Trainers have individual names' commit but were added for a different commit? Special Trainers or Trainer AI, perhaps?

It's really bugging me.

Offline

#18 2018-04-23 13:26:26

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

Re: Changing Trainers (Red)

Well it does sound like you're trying to use aspects of some later trainer-related commits, yeah. Since you're wanting to use the "Custom Pic" trainer type and possibly some others. I had also switched to using named constants for those trainer types to make things easier. You could try comparing the copy of engine/battle/read_trainer_party.asm in red++'s `master` branch with your own and see what yours is possibly missing.

Offline

#19 2018-04-23 14:42:15

megamctaco
Member
Registered: 2015-08-23
Post 117/129

Re: Changing Trainers (Red)

Mateo wrote:

Well it does sound like you're trying to use aspects of some later trainer-related commits, yeah. Since you're wanting to use the "Custom Pic" trainer type and possibly some others. I had also switched to using named constants for those trainer types to make things easier. You could try comparing the copy of engine/battle/read_trainer_party.asm in red++'s `master` branch with your own and see what yours is possibly missing.

Cheers. After updating read_trainer_party.asm and adding the DVs and unique DVs, I can get the right party loaded for "db "EXECUTIVE@",CUSTOM_PIC,EXECUTIVE_F,15,RATTATA,ZUBAT,$FF" (I'm using this trainer to test on Route 8 at the moment). However, I can't seem to get the custom pic loaded at all. It comes up as a Youngster instead of Executive F.

EDIT: I've updated trainer_parties.asm to match your current version. Much neater than before.

"db "EXECUTIVE@",SPECIAL_LEVELS,EXECUTIVE_F,15,RATTATA,ZUBAT,$FF" now only has a level 51 Nidoran F.

Overworld sprites are still glitching out when I change them in map objects too. Do I need to change anything in Sprite Sets or Palettes?

Last edited by megamctaco (2018-04-23 15:39:08)

Offline

#20 2018-04-23 20:25:58

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

Re: Changing Trainers (Red)

"db "EXECUTIVE@",SPECIAL_LEVELS,EXECUTIVE_F,15,RATTATA,ZUBAT,$FF"

That's not how that works. SPECIAL_LEVELS means each Pokemon has a different level, but nothing else. You're trying to use SPECIAL_LEVELS like it was CUSTOM_PIC. Did you read the descriptions for each of the new trainer types? Seems you've gotten confused.

; first is the name, followed by the first byte of the data

; if not a Special Trainer,
    ; first byte is level (of all pokemon on this team)
    ; all the next bytes are pokemon species
    ; FF-terminated
; if first byte == SPECIAL_TRAINER, then
    ; each Pokemon entry is Level, Species, Moveset
    ; FF-terminated
; if first byte == SPECIAL_TRAINER2, then
    ; second byte is custom sprite number
    ; third byte is custom AI number
    ; each Pokemon entry is Level, Species, Moveset
    ; FF-terminated
; if first byte == CUSTOM_PIC, then
    ; second byte is custom sprite number
    ; third byte is level (of all pokemon on this team)
    ; all the next bytes are pokemon species
    ; FF-terminated
; if first byte == SPECIAL_LEVELS, then
    ; each Pokemon entry is Level, Species
    ; FF-terminated
; the first part of every entry is the trainer's name text, terminated by '@'
; next byte determines trainer type
; SPECIAL_TRAINER2 has custom sprite, custom ai choice, and team has custom levels and custom moves
; SPECIAL_TRAINER has a team with custom levels and custom moves
; CUSTOM_PIC has a custom sprite, all Pokemon are same level, standard moves
; SPECIAL_LEVELS has custom levels, default moves
; Otherwise, all Pokemon are the same level and use default moves

Last edited by Mateo (2018-04-23 22:03:47)

Offline

#21 2018-04-24 03:00:37

megamctaco
Member
Registered: 2015-08-23
Post 118/129

Re: Changing Trainers (Red)

Mateo wrote:

"db "EXECUTIVE@",SPECIAL_LEVELS,EXECUTIVE_F,15,RATTATA,ZUBAT,$FF"

That's not how that works. SPECIAL_LEVELS means each Pokemon has a different level, but nothing else. You're trying to use SPECIAL_LEVELS like it was CUSTOM_PIC. Did you read the descriptions for each of the new trainer types? Seems you've gotten confused.

My bad, it was like 2am when I posted and I was just a bit sleep-deprived! Haha. I actually have it set to "db "EXECUTIVE@",CUSTOM_PIC,EXECUTIVE_F,15,RATTATA,ZUBAT,$FF"

Trying to change the Super Nerd trainer on Route 8 (because that's where I am in the game at the moment, hence why I'm testing it there). "object SPRITE_ROCKET, $8, $5, STAY, RIGHT, $1, OPP_ROCKET, $1"

This is what I get:

PNWwOdB.jpg

They've got the right party, but the sprites are all messed up. And I've also just noticed that my Snorlax overworld sprite has turned into the "DEFG" sprite.

Last edited by megamctaco (2018-04-24 03:02:53)

Offline

#22 2018-04-24 03:39:01

megamctaco
Member
Registered: 2015-08-23
Post 119/129

Re: Changing Trainers (Red)

Seemed to have fixed the trainer battle pic when I compared our battle/core.asm files.

_LoadTrainerPic:
; wd033-wd034 contain pointer to pic
    ld a, [wTrainerPicPointer]
    ld e, a
    ld a, [wTrainerPicPointer + 1]
    ld d, a ; de contains pointer to trainer pic
    ld a, [wTrainerPicBank] ; new
;    ld a, [wLinkState]
;    and a
;    ld a, Bank(TrainerPics) ; this is where all the trainer pics are (not counting Red's)
;    jr z, .loadSprite
;    ld a, Bank(RedPicFront)
;.loadSprite
    call UncompressSpriteFromDE
    ld de, vFrontPic
    ld a, $77
    ld c, a
    jp LoadUncompressedSpriteData

That seemed to fix it, as mine was a little different to the above.

Still having a huge issue with the overworld sprites though.

Offline

#23 2018-04-24 06:16:34

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

Re: Changing Trainers (Red)

Outdoor maps can only use overworld sprites that are in their spriteset, while indoor areas can use any sprite (this is because sprites do not get loaded between map connections, only when warping, and they need to stay consistent when you're walking around). So yeah, you'd need to replace another walking sprite in that area's spriteset in order to use a Rocket outside in an area that didn't originally have them. https://github.com/pret/pokered/blob/ma … e_sets.asm

Offline

#24 2018-04-24 14:46:17

megamctaco
Member
Registered: 2015-08-23
Post 120/129

Re: Changing Trainers (Red)

Mateo wrote:

Outdoor maps can only use overworld sprites that are in their spriteset, while indoor areas can use any sprite (this is because sprites do not get loaded between map connections, only when warping, and they need to stay consistent when you're walking around). So yeah, you'd need to replace another walking sprite in that area's spriteset in order to use a Rocket outside in an area that didn't originally have them. https://github.com/pret/pokered/blob/ma … e_sets.asm

Does a cave count as indoor or outdoor? And which spriteset is Route 8?

Offline

#25 2018-04-24 18:18:12

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

Re: Changing Trainers (Red)

Caves are indoor areas. And the set definitions are at the top of that file I linked. It is a little confusing for some of the maps though, since Route 8 uses one of the weird split sets. The only side you have to worry about is the East side (the West side is actually just the left side of the gatehouse so that it loads properly when you go into saffron), which uses Set 3. I see that set has SPRITE_GUARD in it for no apparent reason, so you could easily swap that for SPRITE_ROCKET if you want Rockets on that route. (At least at first glance I don't know of any reason for SPRITE_GUARD to be used outside on the maps that use set 3).

Offline

Board footer

Powered by FluxBB