• 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 Conquest 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✓] Poketcg: How to create new symbols in scripts?

I am trying to make Ronald, the final version of his deck, rebattleable at Ishihara's house. I have already made a quick and dirty code which does allow for this to happen, but there is a problem: the game doesn't know what to do if the PC wins or loses, so after the duel ends, nothing further happens and the game resumes like normal.

I'd like to improve this by copying and editing the dueling battle codes found in the various lobbies, which goes like this:

GrassClubLobbyAfterDuel:
ld hl, .after_duel_table
call FindEndOfDuelScript
ret

... and then in the .after_duel_table it lists a bunch of new scripts designed to figure out what happens if the PC loses or wins. However, Ishihara's house notably does not have this after duel script, so when I try to put one in, it gives me this:

error: src/main.asm(26) -> src/engine/overworld/scripting.asm(2049) -> src/scripts/ishiharas_house.asm(198): Unknown symbol "IshiharasHouseAfterDuel.after_duel_table"

Inserting the "ld hl..." script into various other premade scripts/symbols does nothing.

So basically, I need to create a new symbol, "Ishiharashouseafterduel .after_duel_table", and have the game recognize it, then the rest of the code should follow. How would I do this?

EDIT: Code no longer gives an error, but it doesn't do anything after battle.

=================================================================

EDIT: My code is this so far:

This is all at the very end of the script. Insewrting it all at the beginning also does nothing. The error code is no longer present, but the new script doesn't do anything after the result of the battle.

Preload_Ronald1InIshiharasHouse: (Official from the base game)
get_event_value EVENT_RECEIVED_LEGENDARY_CARDS
cp TRUE
ccf
ret

IshiharasHouseAfterDuel: (New)
ld hl, .after_duel_table
call FindEndOfDuelScript
ret

.after_duel_table (New)
db NPC_RONALD1
db NPC_RONALD1
dw Script_BeatRonald1
dw Script_LostToRonald1
db $00

Script_Ronald: (Old but text has been edited)
start_script
jump_if_event_true EVENT_RONALD_TALKED, .ows_dc55
max_out_event_value EVENT_RONALD_TALKED
print_text_quit_fully Text073f

.ows_dc55
print_npc_text Text0740
ask_question_jump Text0741, .ows_dc60 (Asks if player wants to duel)
print_text_quit_fully Text0742

.ows_dc60
set_dialog_npc NPC_RONALD1
start_duel PRIZES_6, LEGENDARY_RONALD_DECK_ID, MUSIC_DUEL_THEME_3 (This part is new)
print_text_quit_fully Text0743

Script_BeatRonald1: (new)
start_script
print_npc_text Text0658
give_booster_packs BOOSTER_EVOLUTION_PSYCHIC, BOOSTER_EVOLUTION_PSYCHIC, NO_BOOSTER
print_npc_text Text0659
quit_script_fully

Script_LostToRonald1: (new)
start_script
print_text_quit_fully Text065a
 
Last edited:
I am trying to make Ronald, the final version of his deck, rebattleable at Ishihara's house. I have already made a quick and dirty code which does allow for this to happen, but there is a problem: the game doesn't know what to do if the PC wins or loses, so after the duel ends, nothing further happens and the game resumes like normal.

I'd like to improve this by copying and editing the dueling battle codes found in the various lobbies, which goes like this:

GrassClubLobbyAfterDuel:
ld hl, .after_duel_table
call FindEndOfDuelScript
ret

... and then in the .after_duel_table it lists a bunch of new scripts designed to figure out what happens if the PC loses or wins. However, Ishihara's house notably does not have this after duel script, so when I try to put one in, it gives me this:

error: src/main.asm(26) -> src/engine/overworld/scripting.asm(2049) -> src/scripts/ishiharas_house.asm(198): Unknown symbol "IshiharasHouseAfterDuel.after_duel_table"

Inserting the "ld hl..." script into various other premade scripts/symbols does nothing.

So basically, I need to create a new symbol, "Ishiharashouseafterduel", and have the game recognize it, then the rest of the code should follow. How would I do this?

I'm guessing you put your new label in the wrong place. Labels starting with '.' are local and can be referred to by their name only until a non-local label is defined. Your .after_duel_table should be defined after IshiharasHouseAfterDuel, but before any following non-local labels.
 
Last edited:
I'm guessing you put your new label in the wrong place. Labels starting with '.' are local and can be referred to by their name only until a non-local label is defined. Your .after_duel_table should be defined after IshiharasHouseAfterDuel, but before any following non-local labels.

See, I thought I did that? I just posted the current code up top, the one that gives me this error message. Do you know what's up with it? (I also tried to put the " IshiharasHouseAfterDuel" stuff after the preload Ronald script and it's the same error.
 
See, I thought I did that? I just posted the current code up top, the one that gives me this error message. Do you know what's up with it? (I also tried to put the " IshiharasHouseAfterDuel" stuff after the preload Ronald script and it's the same error.

From the code you posted it certainly looks like you have non-local labels (Preload_Ronald1InIshiharasHouse & Script_Ronald) defined between the definitions of IshiharasHouseAfterDuel and .after_duel_table.
 
From the code you posted it certainly looks like you have non-local labels (Preload_Ronald1InIshiharasHouse & Script_Ronald) defined between the definitions of IshiharasHouseAfterDuel and .after_duel_table.

Alright I did as you said, and while the error message is no longer present, the code still doesn't do anything. Notably, exactly copy and pasting the Robert script from the psychic club with new symbols ALSO does nothing. Not sure what's going on, I put the new code up at the top.

The new code essentially: Asks if the player wants to battle RonaldLegendary, if yes, print dialouge and start duel (normal). If not, print dialogue and quit. But then after the duel, nothing happens still.
 
Last edited:
Alright I did as you said, and while the error message is no longer present, the code still doesn't do anything. Notably, exactly copy and pasting the Robert script from the psychic club with new symbols ALSO does nothing. Not sure what's going on, I put the new code up at the top.

The new code essentially: Asks if the player wants to battle RonaldLegendary, if yes, print dialouge and start duel (normal). If not, print dialogue and quit. But then after the duel, nothing happens still.

Did you tell the game to run your new code? Seems like src/data/map_scripts.asm is the place for that.
 
Back
Top