• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Script] (ASM) Help with expanding the list of AI special attacks in GB TCG

Hello, I am currently working on a hack of the GB Pokemon TCG game. I am almost done with most of it, but then realized a potential source of frustrations near the end of pokemon programming: the fact that the AI may not know how to use the new attacks I made. The list (SRC -> Engine -> Duel -> AI --> Special attacks) is quite limited when compared to the number of new special attacks on Pokemon that I've made. I expanded the list by 1 entry, but then after that I get the following errors:

error: src/main.asm(84) -> src/engine/duel/ai/core.asm(1811) -> src/engine/duel/ai/special_attacks.asm(31): jr target out of re
ach (expected -129 < 129 < 128)
error: src/main.asm(84) -> src/engine/duel/ai/core.asm(1811) -> src/engine/duel/ai/special_attacks.asm(15): jr target out of re
ach (expected -129 < 131 < 128)

I'm not sure what this means but it appears to imply that I can't make my list any bigger. Can anyone help me with this?

I am just copying existing code to a new space whenever I do this. For example, I add:
cp SEAKING
jp z, .Teleport

- And then get those errors. If I can't expand the list, is there a way to fill the cp line with multiple pokemon?
 
Last edited:
Hello, I am currently working on a hack of the GB Pokemon TCG game. I am almost done with most of it, but then realized a potential source of frustrations near the end of pokemon programming: the fact that the AI may not know how to use the new attacks I made. The list (SRC -> Engine -> Duel -> AI --> Special attacks) is quite limited when compared to the number of new special attacks on Pokemon that I've made. I expanded the list by 1 entry, but then after that I get the following errors:

error: src/main.asm(84) -> src/engine/duel/ai/core.asm(1811) -> src/engine/duel/ai/special_attacks.asm(31): jr target out of re
ach (expected -129 < 129 < 128)
error: src/main.asm(84) -> src/engine/duel/ai/core.asm(1811) -> src/engine/duel/ai/special_attacks.asm(15): jr target out of re
ach (expected -129 < 131 < 128)

I'm not sure what this means but it appears to imply that I can't make my list any bigger. Can anyone help me with this?

I am just copying existing code to a new space whenever I do this. For example, I add:
cp SEAKING
jp z, .Teleport

- And then get those errors. If I can't expand the list, is there a way to fill the cp line with multiple pokemon?
The problem is that the jr instruction can only jump to code within 128 bytes of the instruction and your new code is causing the distance between the instruction and the jump destination to be greater than that.

I think you might be able to just fix this by just replacing the jr instructions with jp.
 
Back
Top