Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2019-06-25 01:07:17

Kamy41
Member
Registered: 2019-01-09
Post 11/14

(Pokered) Double request to learning new move in battle

Hello everybody ☺️
I have a little problem with learning new moves system, probably I accidentally made some coding error time ago, but I really can't figure out in which script. The problem is that, only in battle, if I refuse to teach a new move, the script asks me AGAIN if I want to teach that move, and after the second refuse finally it goes on... In which script it could be the issue (made by myself) ??
Thanks to everyone :)

Last edited by Kamy41 (2019-06-25 13:24:58)

Offline

#2 2019-06-25 11:41:05

Hans12
New member
Registered: 2017-09-18
Post 5/5

Re: (Pokered) Double request to learning new move in battle

Try using a clean save

Offline

#3 2019-06-25 13:28:32

Kamy41
Member
Registered: 2019-01-09
Post 12/14

Re: (Pokered) Double request to learning new move in battle

Hans12 wrote:

Try using a clean save

Nope, it's not working :( , I have to fix the exact script...

Offline

#4 2019-06-25 15:30:36

Mateo
Member
Registered: 2009-11-25
Post 3,617/3,629

Re: (Pokered) Double request to learning new move in battle

I would assume your problem is in engine/battle/experience.asm since it only seems to happen when you learn a new move during battle. Try comparing that to the one in vanilla pokered and see if you can spot your accidental edit and fix it.


EDIT: If you were attempting to make it so a Pokemon can learn more than one move at a time (such as assigning more than one move at the same level, or fixing the vanilla bug where gaining enough XP to skip over a level caused you to skip trying to learn the moves in between) when you broke it, you can take a look at this example of how to make it behave that way. So if that was your goal, you could start by reverting whatever you did that was broken and then following that commit.

Last edited by Mateo (2019-06-25 15:34:57)


I am no longer active on this forum. I only pop in from time to time.

Offline

#5 2019-06-25 16:31:44

Kamy41
Member
Registered: 2019-01-09
Post 13/14

Re: (Pokered) Double request to learning new move in battle

Mateo wrote:

I would assume your problem is in engine/battle/experience.asm since it only seems to happen when you learn a new move during battle. Try comparing that to the one in vanilla pokered and see if you can spot your accidental edit and fix it.


EDIT: If you were attempting to make it so a Pokemon can learn more than one move at a time (such as assigning more than one move at the same level, or fixing the vanilla bug where gaining enough XP to skip over a level caused you to skip trying to learn the moves in between) when you broke it, you can take a look at this example of how to make it behave that way. So if that was your goal, you could start by reverting whatever you did that was broken and then following that commit.

Yes, now I remember, I edited this script to fix the bug that prevents a Pokemon from learning a move if it gains MORE levels at once..
So this is the script (I added the line 161 and lines from 257-272)
How can I fix this whitout loosing all the script update??

ld a, [hl] ; current level
    ld [wTempLevel], a ; store current level      <--------161
    cp d
    jp z, .nextMon ; if level didn't change, go to next mon
    ld a, [wCurEnemyLVL]
    push af
    push hl
    ld a, d
    ld [wCurEnemyLVL], a
    ld [hl], a
    ld bc, wPartyMon1Species - wPartyMon1Level
    add hl, bc
    ld a, [hl] ; species
    ld [wd0b5], a
    ld [wd11e], a
    call GetMonHeader
    ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1Species
    add hl, bc
    push hl
    ld a, [hld]
    ld c, a
    ld b, [hl]
    push bc ; push max HP (from before levelling up)
    ld d, h
    ld e, l
    ld bc, (wPartyMon1HPExp - 1) - wPartyMon1MaxHP
    add hl, bc
    ld b, $1 ; consider stat exp when calculating stats
    call CalcStats
    pop bc ; pop max HP (from before levelling up)
    pop hl
    ld a, [hld]
    sub c
    ld c, a
    ld a, [hl]
    sbc b
    ld b, a ; bc = difference between old max HP and new max HP after levelling
    ld de, (wPartyMon1HP + 1) - wPartyMon1MaxHP
    add hl, de
; add to the current HP the amount of max HP gained when levelling
    ld a, [hl] ; wPartyMon1HP + 1
    add c
    ld [hld], a
    ld a, [hl] ; wPartyMon1HP + 1
    adc b
    ld [hl], a ; wPartyMon1HP
    ld a, [wPlayerMonNumber]
    ld b, a
    ld a, [wWhichPokemon]
    cp b ; is the current mon in battle?
    jr nz, .printGrewLevelText
; current mon is in battle
    ld de, wBattleMonHP
; copy party mon HP to battle mon HP
    ld a, [hli]
    ld [de], a
    inc de
    ld a, [hl]
    ld [de], a
; copy other stats from party mon to battle mon
    ld bc, wPartyMon1Level - (wPartyMon1HP + 1)
    add hl, bc
    push hl
    ld de, wBattleMonLevel
    ld bc, 1 + NUM_STATS * 2 ; size of stats
    call CopyData
    pop hl
    ld a, [wPlayerBattleStatus3]
    bit 3, a ; is the mon transformed?
    jr nz, .recalcStatChanges
; the mon is not transformed, so update the unmodified stats
    ld de, wPlayerMonUnmodifiedLevel
    ld bc, 1 + NUM_STATS * 2
    call CopyData
.recalcStatChanges
    xor a ; battle mon
    ld [wCalculateWhoseStats], a
    callab CalculateModifiedStats
    callab ApplyBurnAndParalysisPenaltiesToPlayer
    callab ApplyBadgeStatBoosts
    callab DrawPlayerHUDAndHPBar
    callab PrintEmptyString
    call SaveScreenTilesToBuffer1
.printGrewLevelText
    ld hl, GrewLevelText
    call PrintText
    xor a ; PLAYER_PARTY_DATA
    ld [wMonDataLocation], a
    call LoadMonData
    ld d, $1
    callab PrintStatsBox
    call WaitForTextScrollButtonPress
    call LoadScreenTilesFromBuffer1
    xor a ; PLAYER_PARTY_DATA
    ld [wMonDataLocation], a
    ld a, [wd0b5]
    ld [wd11e], a
                                                       <-------257
    ld a, [wCurEnemyLVL]
    ld c, a
    ld a, [wTempLevel]
    ld b, a
.level_loop
    inc b
    ld a, b
    ld [wCurEnemyLVL], a
    push bc
    predef LearnMoveFromLevelUp
    pop bc
    ld a, b
    cp c
    jr nz, .level_loop
                                                     <--------272
    predef LearnMoveFromLevelUp

Last edited by Kamy41 (2019-06-25 16:34:47)

Offline

#6 2019-06-25 20:54:30

Kamy41
Member
Registered: 2019-01-09
Post 14/14

Re: (Pokered) Double request to learning new move in battle

Mateo wrote:

I would assume your problem is in engine/battle/experience.asm since it only seems to happen when you learn a new move during battle. Try comparing that to the one in vanilla pokered and see if you can spot your accidental edit and fix it.


EDIT: If you were attempting to make it so a Pokemon can learn more than one move at a time (such as assigning more than one move at the same level, or fixing the vanilla bug where gaining enough XP to skip over a level caused you to skip trying to learn the moves in between) when you broke it, you can take a look at this example of how to make it behave that way. So if that was your goal, you could start by reverting whatever you did that was broken and then following that commit.

OK, I solved, the problem was in the line 273, removing it everything is ok :)
Thank you anywa :)

Offline

#7 2019-06-25 21:06:10

Mateo
Member
Registered: 2009-11-25
Post 3,618/3,629

Re: (Pokered) Double request to learning new move in battle

Glad I could at least point you in the right direction. Cheers.


I am no longer active on this forum. I only pop in from time to time.

Offline

Board footer

Powered by FluxBB