Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → PokeRed/PokeYellow Restoring Defeat Text for trainers at End of Battle

#1 2021-03-24 21:27:02

aCrobat95
New member
Registered: 2021-03-24
Post 1/7

PokeRed/PokeYellow Restoring Defeat Text for trainers at End of Battle

Hello everyone. First post here, I need some help with a problem I've come across while working on the Pokeyellow disassembly.

So, I recently discovered that Pokemon Red and Yellow have got a Disassembly, and I got to admit how delighted I was to see how much easier/more flexible everything is now compared to using old hack tools like I did back in 2010-12.
I got the PokeYellow disassembly from Github, worked on it with Cygwin and RGBDS, changing everything I wanted changed, like adding newer types and moves, more and stronger pokemon for Trainers and Leaders etc. It's a blast and everything works great so far.


Recently, I tried to follow the Pokered tutorial posted by MechanicalPen back in 2016, in order to restore in-game the unique dialogues that popped up when the player lost to an opponent.
Like when Blue says the famous quote "AM I GREAT OR WHAT?" at the beginning.

The tutorial worked sweet, even though it was about Pokered and not Pokeyellow. After all the code is pretty similar between the two games. .
Everything works now, got all of Blue's extra quotes from when you lose to him, made new text_fars wherever required and even got the gym leaders to say unique dialogues when you lose to them. It has made the game much cooler.

However, there's the problem with the random NPC trainers.
Lasses, Youngsters, Jugglers etc all say their losing quotes even when they win against the player.
Like the Bug Catcher in the Viridian Forest. If you lose to him, before you black out he'll still say "OH NO, CATERPIE CAN'T CUT IT!".
The same thing happened with the Gym Leaders at first, but with them the fix was easy as a single creation of an extra text_far was enough. Doesn't seem to work like that for the trainers though.
It's quite annoying I admit, and I'd like to fix it, but I don't know how, so any help is more than welcome.

Following the tutorial step by step, I did mess around with the core.asm and home/trainers.asm as instructed to make a sliding sprite of each trainer to the left upon losing to them, and having them speak too.
I did try to follow MechanicalPen's advice about editing the scripts and Trainer Headers, however I came upon this problem.
I tried to mess with the trainer Header of one trainer in the Cerulean Gym by adding one more text, right after his before battle, end battle and after battle texts.

Following is the change I made on the CeruleanGym.asm file:

jp CeruleanGymScript_5c6ed

CeruleanGym_TextPointers:
dw CeruleanGymText1
dw CeruleanGymText2
dw CeruleanGymText3
dw CeruleanGymText4
dw CeruleanGymText5
dw CeruleanGymText6
dw CeruleanGymText7

CeruleanGymTrainerHeader0:
trainer EVENT_BEAT_CERULEAN_GYM_TRAINER_0, 3, CeruleanGymBattleText1, CeruleanGymEndBattleText1, CeruleanGymAfterBattleText1, CeruleanGymLoseBattleText1    ;This is the line where I added the extra text
CeruleanGymTrainerHeader1:
trainer EVENT_BEAT_CERULEAN_GYM_TRAINER_1, 3, CeruleanGymBattleText2, CeruleanGymEndBattleText2, CeruleanGymAfterBattleText2
db -1 ; end

Did work on the CeruleanGym script and text asms as usual, but when I tried to compile it, the program gave me this error.

rgbasm -h -L -Weverything -o maps.o maps.asm
warning: maps.asm(890) -> scripts/CeruleanGym.asm(172): [-Wobsolete]
    Non-local labels without a colon are deprecated
rgbasm -h -L -Weverything -o text.o text.asm
rgblink -p 0x00 -m pokeyellow.map -n pokeyellow.sym -l layout.link -o pokeyellow.gbc audio.o home.o main.o maps.o text.o wram.o gfx/pics.o gfx/pikachu.o gfx/sprites.o gfx/tilesets.o
error: maps.asm(890) -> scripts/CeruleanGym.asm(83) -> macros/scripts/maps.asm::
trainer(103): Value 0x46c60 is not 8-bit
Linking failed with 1 error
make: *** [Makefile:102: pokeyellow.gbc] Error 1

From what I get, the problem is that by adding one more text to the header of the npc, the value stops being 8-bit? I'm not sure what to make out of it. I checked the macros/scripts/maps.asm but I didn't make any sense out of it.
MechanicalPen wasn't clear on how to properly edit the Trainer Headers to add one more text_far to their data, and given how he hasn't posted anything since 2017 I thought against asking him personally for help.

So now I'm stuck with npc trainers who win and speak as if they lost.
That problem didn't exist with the Gym Leaders because they, unlike the npc trainers, already had an extra slot for a defeat quote in their battle codec, which simply duplicated the Player Victory text. A simple replace with a new text_far fixed that. Can't say the same happens with the trainers.


I know I'm asking for a lot, first post and all, and I will probably not get any replies, but I've been working on messing around with the asms for so long, jumping from error to error within tons of failed attempts, trying to see if I discover anything, that I'm feeling completely stuck.

If anyone is up for helping me figure this out, I'll be more than grateful :D

Last edited by aCrobat95 (2021-03-24 21:38:39)


Golbat VS Golduck
The Fight of the Gods

Offline

#2 2021-03-27 01:40:58

aCrobat95
New member
Registered: 2021-03-24
Post 2/7

Re: PokeRed/PokeYellow Restoring Defeat Text for trainers at End of Battle

To sum this up, I managed to find the solution on my own in the end. I'll be writing how, just in case anyone ever happens to have the same problem as I did.

Turns out that Pokeyellow used to have different a Trainer Header info template than what it does now. Now it looks like this:

AgathaTrainerHeader0:
trainer EVENT_BEAT_AGATHAS_ROOM_TRAINER_0, 0, AgathaBeforeBattleText, AgathaEndBattleText, AgathaAfterBattleText
db -1 ; end

probably in order to reduce the number of lines they occupy and the commands they use? The older headers look like this:

LoreleiTrainerHeader0:
dbEventFlagBit EVENT_BEAT_LORELEIS_ROOM_TRAINER_0
db ($3 << 0) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_LORELEIS_ROOM_TRAINER_0
dw LoreleiBeforeBattleText ; TextBeforeBattle
dw LoreleiAfterBattleText ; TextAfterBattle
dw LoreleiEndBattleText ; TextEndBattle
dw LoreleiLoseBattleText ; TextEndBattle

db $ff

I found an older Pokered disassembly and copied a trainerheaderinfo template from there, so now I can replace all the modern headers with the old ones. That way, I'll be able to create victory dialogues for every non-gymleader npc, including the Elite Four.
Those do have a losetext spot which is occupied by the same EndBattleText but can easily be replaced by some new new text_far, without giving an 8bit error.
Tested it alredy on Lorelei and several random npcs and works perfect. I'll definitely be writing lose dialogues for every single npc in the game now


All I can say to conclude this is, thank you to the amazing guys who have been working on those disassemblies for years


Golbat VS Golduck
The Fight of the Gods

Offline

  • Index
  • → Help/Question
  • → PokeRed/PokeYellow Restoring Defeat Text for trainers at End of Battle

Board footer

Powered by FluxBB