• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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] pokecrystal evolution move table efficiency

7
Posts
1
Years
  • I followed the tutorial for adding evolution moves - that is, moves that Pokemon learn upon evolution, regardless of level. The tutorial creates a table that gives one evolution move to every Pokemon, with the option to use the NO_MOVE constant to not have an evolution move. So in my case, the table comes out looking like this (at data/pokemon/evolution_moves.asm):

    Spoiler:

    And the code to get them to learn these moves looks like this (at enginge/pokemon/evolve.asm):

    Code:
    LearnEvolutionMove:
    	ld a, [wTempSpecies]
    	ld [wCurPartySpecies], a
    	dec a
    	ld c, a
    	ld b, 0
    	ld hl, EvolutionMoves
    	add hl, bc
    	ld a, [hl]
    	and a
    	ret z
    
    	push hl
    	ld d, a
    	ld hl, wPartyMon1Moves
    	ld a, [wCurPartyMon]
    	ld bc, PARTYMON_STRUCT_LENGTH
    	call AddNTimes
    
    	ld b, NUM_MOVES
    .check_move
    	ld a, [hli]
    	cp d
    	jr z, .has_move
    	dec b
    	jr nz, .check_move
    
    	ld a, d
    	ld [wPutativeTMHMMove], a
    	ld [wNamedObjectIndex], a
    	call GetMoveName
    	call CopyName1
    	predef LearnMove
    	ld a, [wCurPartySpecies]
    	ld [wTempSpecies], a
    
    .has_move
    	pop hl
    	ret

    The problem, of course, being this:

    Code:
    error: layout.link(69): Sections would extend past the end of ROMX ($8117 > $7fff)

    So... since there are so many NO_MOVE entries in the table, I'm wondering if there's a more efficient way to do the whole thing where those entries are essentially skipped, not taking up memory space. A lot of things in pokecrystal use "pointer tables," which might be what I'm looking for, but I'm not sure. My understanding of assembly code and memory bank rules is very limited; I can probably just put something in a different bank, but it seems worth pursuing the efficiency angle. Has anybody dealt with this particular issue before?
     
    137
    Posts
    10
    Years
    • Age 35
    • Seen May 1, 2024
    The way to make the list shorter would be to make it a list of Pokemon-move pairs…
    Code:
    EvolutionMoves::
        db CHARIZARD, WING_ATTACK
        db METAPOD, HARDEN
        ; etc
    …but you're on your own for how to edit the code to correctly read such a table.
     
    Back
    Top