You are not logged in.
Pages: 1
I feel like I'm missing something here:
PrintBeginningBattleText: ; 58d99 (16:4d99)
ld a, [wIsInBattle]
dec a
jr nz, .trainerBattle
ld a, [wCurMap]
cp POKEMONTOWER_3
jr c, .notPokemonTower
cp LAVENDER_HOUSE_1
jr c, .pokemonTower
.notPokemonTower
ld a, [wEnemyMonSpecies2]
call PlayCry
ld hl, WildMonAppearedText
ld a, [wMoveMissed]
and a
jr z, .notFishing
ld hl, HookedMonAttackedText
.notFishing
jr .wildBattle
.trainerBattle
call .playSFX
ld c, 20
call DelayFrames
ld hl, SpecialTrainerIDs
ld a, [wTrainerClass]
ld de, 1
call IsInArray
jr c, .specialTrainer
ld hl, TrainerWantsToFightText
.specialTrainer
ld hl, TrainerWantsToFightText2
.wildBattle
push hl
callab DrawAllPokeballs
pop hl
call PrintText
jr .done
.pokemonTower
ld b, SILPH_SCOPE
call IsItemInBag
ld a, [wEnemyMonSpecies2]
ld [wcf91], a
cp MAROWAK
jr z, .isMarowak
ld a, b
and a
jr z, .noSilphScope
callab LoadEnemyMonData
jr .notPokemonTower
.noSilphScope
ld hl, EnemyAppearedText
call PrintText
ld hl, GhostCantBeIDdText
call PrintText
jr .done
.isMarowak
ld a, b
and a
jr z, .noSilphScope
ld hl, EnemyAppearedText
call PrintText
ld hl, UnveiledGhostText
call PrintText
callab LoadEnemyMonData
callab MarowakAnim
ld hl, WildMonAppearedText
call PrintText
How do you get it to say "The BUG CATCHER RICK wants to fight!" as opposed to "The BUG CATCHER wants to fight!", looking at this code? (And I'm pretty sure the SpecialTrainerIDs list doesn't include the BUG CATCHER trainer class.)
Offline
I'm on my phone so it would be a pain to look up the link, but you might've just missed something when porting my code for individual trainer names.
I am not very active on this forum. I only pop in from time to time.
Offline
It's not the trainer names I'm having trouble with, it's the toggling between regular and special trainers. The code happens to be from "engine/battle/common_text.asm".
Offline
I'll take a look and see what I can find. I know I mentioned on PokeCommunity to you that you have two identical lists with the same label name which wasn't letting me compile. If you changed the label name for the list in common_text.asm but forgot to change where you load it, then it would technically be loading it with an invalid pointer (the pointer to the other list which would just be gibberish in this bank) so it might be reading unrelated data as a list, and that gibberish happened to include the ID for Bug Catchers. That's just speculation at this point since I haven't gone in and checked but it seems like a simple enough mistake to make and a simple enough mistake to fix. I'll let you know more later.
I am not very active on this forum. I only pop in from time to time.
Offline
OK, next we've got the pointers for TrainerWantsToFightText and TrainerWantsToFightText2:
TrainerWantsToFightText: ; 58e4a (16:4e4a)
TX_FAR _TrainerWantsToFightText
db "@"
TrainerWantsToFightText2:
TX_FAR _TrainerWantsToFightText2
db "@"
which correspond to these:
_TrainerWantsToFightText:: ; 89c5e (22:5c5e)
text "The @"
TX_RAM wTrainerName
db $0
line "@"
TX_RAM wCurTrainerName
text " wants"
cont "to fight!"
prompt
_TrainerWantsToFightText2:: ; 89c5e (22:5c5e)
text "The @"
TX_RAM wTrainerName
db $0
line "wants to fight!"
prompt
And, of course, I had to duplicate everything into separate SpecialTrainerIDs lists due to that idiot Cygwin yelling at me for three files pointing to the same list (and, of course, they have to for consistency's sake, since the files "common_text.asm", "core.asm", and "trainer_ai.asm" all have text pointers affected by this list):
SpecialTrainerIDs:
db SONY1
db GIOVANNI
db ROCKET
db BRUNO
db BROCK
db MISTY
db LT__SURGE
db ERIKA
db KOGA
db BLAINE
db SABRINA
db SONY2
db SONY3
db LORELEI
db AGATHA
db LANCE
db "@"
SpecialTrainerIDs2:
db SONY1
db GIOVANNI
db ROCKET
db BRUNO
db BROCK
db MISTY
db LT__SURGE
db ERIKA
db KOGA
db BLAINE
db SABRINA
db SONY2
db SONY3
db LORELEI
db AGATHA
db LANCE
db "@"
SpecialTrainerIDs3:
db SONY1
db GIOVANNI
db ROCKET
db BRUNO
db BROCK
db MISTY
db LT__SURGE
db ERIKA
db KOGA
db BLAINE
db SABRINA
db SONY2
db SONY3
db LORELEI
db AGATHA
db LANCE
db "@"
Offline
And, of course, I had to duplicate everything into separate SpecialTrainerIDs lists due to that idiot Cygwin yelling at me for three files pointing to the same list (and, of course, they have to for consistency's sake, since the files "common_text.asm", "core.asm", and "trainer_ai.asm" all have text pointers affected by this list):
:: exports a label so it can be used anywhere.
Last edited by comet (2016-03-01 00:25:55)
Offline
Just being able to reference it from anywhere won't necessarily mean your routine can find the data you actually want it to though. If the list is in bank 22 and you're trying to reference it in bank 16 you're still going to run into problems unless you specify which bank it is in (which you haven't been doing, and just writing code assuming the list is in the same bank as the code that is calling it).
Last edited by Luna (2016-03-01 00:35:49)
I am not very active on this forum. I only pop in from time to time.
Offline
Well, how do you suggest I rewrite the relevant parts of the code?
Offline
If you have room at the end of bank 0, it might be simpler to take all of the redundant instances you have and replace them with:
call IsTrainerSpecial
jr c, .whateverYouHaveNow
Then in bank 0, at the end, just add:
IsTrainerSpecial::
ld hl, SpecialTrainerIDs
ld a, [wTrainerClass]
ld de, 1
jp IsInArray
SpecialTrainerIDs:
db SONY1
db GIOVANNI
db ROCKET
db BRUNO
db BROCK
db MISTY
db LT__SURGE
db ERIKA
db KOGA
db BLAINE
db SABRINA
db SONY2
db SONY3
db LORELEI
db AGATHA
db LANCE
db $FF
Also, IsInArray expects an array to be terminated with db $FF, not db "@" like you have it currently. As such, you're making it read past the end of the array until it hits $FF somewhere unrelated to get to the end of the list, which is probably why it thinks BugCatcher is a special trainer. "@" corresponds to $50 not $FF, and IsInArray is written to treat $FF (sometimes written as -1 in here, which is confusing to you I'm sure) as the end-of-array marker. "@" is the end-of-text marker, which is different.
I am not very active on this forum. I only pop in from time to time.
Offline
Just three questions:
1. Which lines of code, specifically, should I change to call IsTrainerSpecial?
2. Where is bank 0?
3. If the game erroneously assumes BugCatcher to be a special trainer, then why does the line intended to be "The BUG CATCHER RICK sent WEEDLE out!" display correctly instead of omitting the trainer's name?
Last edited by Fotomac (2016-03-01 17:36:33)
Offline
1: Obviously, the lines of code that are identical to what I pasted into the new IsTrainerSpecial routine.
2: home.asm
3: You have duplicate checks on duplicate lists in multiple banks, none of which are terminated correctly. Therefore it is very likely that there are different values after the end of the list that are being read depending on which copy of the list you are checking.
I am not very active on this forum. I only pop in from time to time.
Offline
Regarding number three, the variables in "engine/battle/core.asm" are reading from SpecialTrainerIDs2.
ETA: I still don't understand exactly where to put call IsTrainerSpecial; I was hoping you'd be able to tell me going from the segment of code from "engine/battle/common_text.asm" I posted here.
Last edited by Fotomac (2016-03-01 18:22:49)
Offline
Considering I literally just copy/pasted part of your code to make that routine (except I changed a call to a jp) it should not be difficult for you to see what to replace with a call to that new function. So anywhere you originally put a duplicate of that code, put a call instead.
I am not very active on this forum. I only pop in from time to time.
Offline
I'm assuming this is the part of my code you copy/pasted?
.trainerBattle
call .playSFX
ld c, 20
call DelayFrames
ld hl, SpecialTrainerIDs
ld a, [wTrainerClass]
ld de, 1
call IsInArray
jr c, .specialTrainer
ld hl, TrainerWantsToFightText
.specialTrainer
ld hl, TrainerWantsToFightText2
So I would replace "ld hl, SpecialTrainerIDs" with the "call IsTrainerSpecial" lines. Or was it the SpecialTrainerIDs list itself?
Offline
Considering the routine you are calling is:
ld hl, SpecialTrainerIDs
ld a, [wTrainerClass]
ld de, 1
jp IsInArray
Clearly, you would replace:
ld hl, SpecialTrainerIDs
ld a, [wTrainerClass]
ld de, 1
call IsInArray
With a call to the new command, since the lines are identical. Then anywhere else you need to check if a trainer is special, you would do the same. That way you don't have a bunch of redundant checks and don't need 3 copies of that same table (just the one table, in home.asm, right after the routine.) And again, remember to end the list with either db -1 or db $FF but NOT db "@" because that is totally different.
I am not very active on this forum. I only pop in from time to time.
Offline
Ah, that clears things up for me now! Thanks!
Last edited by Fotomac (2016-03-01 21:39:03)
Offline
New stumper! How do you clear up space in bank 0? Because Cygwin yelled at me for following your instructions.
Offline
Carefully. Most of the stuff in Bank 0 is there because it has to be. Some stuff can be easily moved out, others with a little work, others are best staying there.
I noticed that you copied over "GoodCopyVideoData" in a previous commit, while seemingly never actually using it. So if that is the case, it could be removed to free up space.
You can also take Mart Inventories, split them into separate files, and include them with the other scripts for that Mart instead of having them all in bank 0 for no good reason like they are by default.
I am not very active on this forum. I only pop in from time to time.
Offline
What do you use GoodCopyVideoData for? And the whole Mart Inventories thing sounds like a fabulous idear. One question, though: does doing it allow you to customize a city's Poké Mart inventory depending on certain conditions in the game (e.g. adding Potions to Viridian Mart after certain conditions are met, and giving that Potion-loving guy the new dialogue to match)?
Offline
It's part of the stuff I copied from Danny's Gen 2 Graphics Patch, that's why it's in Red++.
As for marts based on things, I haven't actually tried that but there is probably a way. You'd just have to experiment and see.
I am not very active on this forum. I only pop in from time to time.
Offline
I think I've sussed out the problem. Apparently, the Trainer Battle section of "common_text.asm" doesn't include a PrintText call. What I am having a hard time figuring out is, would adding a PrintText call after each TrainerWantsToFightText pointer be of any help?
Offline
Case closed. Apparently, all I forgot was a pointer to the section after the Special Trainer section of that code.
Offline
Pages: 1