Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → How can I change the following misc. aspects of battles? (Crystal)

#1 2013-11-28 03:54:24

Laugh
New member
From: Canada
Registered: 2013-11-24
Post 4/9

How can I change the following misc. aspects of battles? (Crystal)

I assume they can all be quickly changed with a hex editor, but correct me if I'm wrong.

-trainer AI (that is, setting the AI of all/some trainers to that of a gym leader, elite four member, etc.)
-IVs of opponents' Pokemon (setting them all to max)
-AI opponents' extra chance of missing with a status move (removing this)
-stat boosts from badges (removing these)

Offline

#2 2013-11-28 09:50:11

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 141/434
Website

Re: How can I change the following misc. aspects of battles? (Crystal)

-IVs of opponents' Pokemon (setting them all to max)

TrainerClassDVs ; 270d6
; AtkDef, SpdSpc
        db $9A, $77 ; falkner
        db $88, $88 ; bugsy
        db $98, $88 ; whitney
        db $98, $88 ; morty
        db $98, $88 ; pryce
        db $98, $88 ; jasmine
        db $98, $88 ; chuck
        db $7C, $DD ; clair
        db $DD, $DD ; rival1
        db $98, $88 ; pokemon prof
        db $DC, $DD ; will
        db $DC, $DD ; cal
        db $DC, $DD ; bruno
        db $7F, $DF ; karen
        db $DC, $DD ; koga
        db $DC, $DD ; champion
        db $98, $88 ; brock
        db $78, $88 ; misty
        db $98, $88 ; lt surge
        db $98, $88 ; scientist
        db $78, $88 ; erika
        db $98, $88 ; youngster
        db $98, $88 ; schoolboy
        db $98, $88 ; bird keeper
        db $58, $88 ; lass
        db $98, $88 ; janine
        db $D8, $C8 ; cooltrainerm
        db $7C, $C8 ; cooltrainerf
        db $69, $C8 ; beauty
        db $98, $88 ; pokemaniac
        db $D8, $A8 ; gruntm
        db $98, $88 ; gentleman
        db $98, $88 ; skier
        db $68, $88 ; teacher
        db $7D, $87 ; sabrina
        db $98, $88 ; bug catcher
        db $98, $88 ; fisher
        db $98, $88 ; swimmerm
        db $78, $88 ; swimmerf
        db $98, $88 ; sailor
        db $98, $88 ; super nerd
        db $98, $88 ; rival2
        db $98, $88 ; guitarist
        db $A8, $88 ; hiker
        db $98, $88 ; biker
        db $98, $88 ; blaine
        db $98, $88 ; burglar
        db $98, $88 ; firebreather
        db $98, $88 ; juggler
        db $98, $88 ; blackbelt
        db $D8, $A8 ; executivem
        db $98, $88 ; psychic
        db $6A, $A8 ; picnicker
        db $98, $88 ; camper
        db $7E, $A8 ; executivef
        db $98, $88 ; sage
        db $78, $88 ; medium
        db $98, $88 ; boarder
        db $98, $88 ; pokefanm
        db $68, $8A ; kimono girl
        db $68, $A8 ; twins
        db $6D, $88 ; pokefanf
        db $FD, $DE ; red
        db $9D, $DD ; blue
        db $98, $88 ; officer
        db $7E, $A8 ; gruntf
        db $98, $88 ; mysticalman
; 2715c

AI opponents' extra chance of missing with a status move (removing this)

https://github.com/kanzure/pokecrystal/ … mmands.asm

The way it's done in the game, there is a 25% extra chance of missing by the opponents because for every stat up/down or stat inflicting move a random number is generated and comapred to 0x40. If the number is lower than 0x40, the move misses.  The way I did it myself to remove those misses is turn all those cp $40 to cp $00; perhaps not the best looking way to do it, but heh, it works fine.
In the link above, you can search and find cp $40 four times. In order they stand for:
- Sleep moves.
- Posion moves
- Every stat up/down move
- Paralysis moves
If I'm not mistaken no other type of move has an added chance to miss.

stat boosts from badges (removing these)

BadgeStatBoosts: ; 3ed45
; Raise BattleMon stats depending on which badges have been obtained.

; Every other badge boosts a stat, starting from the first.

;     ZephyrBadge:  Attack
;     PlainBadge:   Speed
;     MineralBadge: Defense
;     GlacierBadge: Special Attack
;     RisingBadge:  Special Defense

; The boosted stats are in order, except PlainBadge and MineralBadge's boosts are swapped.

    ld a, [InLinkBattle]
    and a
    ret nz

    ld a, [$cfc0]
    and a
    ret nz

    ld a, [JohtoBadges]

; Swap badges 3 (PlainBadge) and 5 (MineralBadge).
    ld d, a
    and %00000100
    add a
    add a
    ld b, a
    ld a, d
    and %00010000
    rrca
    rrca
    ld c, a
    ld a, d
    and %11101011
    or b
    or c
    ld b, a

    ld hl, BattleMonAtk
    ld c, 4
.CheckBadge
    ld a, b
    srl b
    call c, BoostStat
    inc hl
    inc hl
; Check every other badge.
    srl b
    dec c
    jr nz, .CheckBadge
; And the last one (RisingBadge) too.
    srl a
    call c, BoostStat
    ret
; 3ed7c


BoostStat: ; 3ed7c
; Raise stat at hl by 1/8.

    ld a, [hli]
    ld d, a
    ld e, [hl]
    srl d
    rr e
    srl d
    rr e
    srl d
    rr e
    ld a, [hl]
    add e
    ld [hld], a
    ld a, [hl]
    adc d
    ld [hli], a

; Cap at 999.
    ld a, [hld]
    sub 999 % $100
    ld a, [hl]
    sbc 999 / $100
    ret c
    ld a, 999 / $100
    ld [hli], a
    ld a, 999 % $100
    ld [hld], a
    ret
; 3ed9f
DoBadgeTypeBoosts: ; fbe24
        ld a, [InLinkBattle]
        and a
        ret nz

        ld a, [$cfc0]
        and a
        ret nz

        ld a, [hBattleTurn]
        and a
        ret nz

        push de
        push bc

        ld hl, .BadgeTypes

        ld a, [KantoBadges]
        ld b, a
        ld a, [JohtoBadges]
        ld c, a

.CheckBadge
        ld a, [hl]
        cp $ff
        jr z, .done

        srl b
        rr c
        jr nc, .NextBadge

        ld a, [$d265] ; move type
        cp [hl]
        jr z, .ApplyBoost

.NextBadge
        inc hl
        jr .CheckBadge

.ApplyBoost
        ld a, [CurDamage]
        ld h, a
        ld d, a
        ld a, [CurDamage + 1]
        ld l, a
        ld e, a

        srl d
        rr e
        srl d
        rr e
        srl d
        rr e

        ld a, e
        or d
        jr nz, .asm_fbe6f
        ld e, 1

.asm_fbe6f
        add hl, de
        jr nc, .Update

        ld hl, $ffff

.Update
        ld a, h
        ld [CurDamage], a
        ld a, l
        ld [$d257], a

.done
        pop bc
        pop de
        ret

.BadgeTypes
        db FLYING ; zephyrbadge
        db BUG ; hivebadge
        db NORMAL ; plainbadge
        db GHOST ; fogbadge
        db STEEL ; mineralbadge
        db FIGHTING ; stormbadge
        db ICE ; glacierbadge
        db DRAGON ; risingbadge

        db ROCK ; boulderbadge
        db WATER ; cascadebadge
        db ELECTRIC ; thunderbadge
        db GRASS ; rainbowbadge
        db POISON ; soulbadge
        db PSYCHIC ; marshbadge
        db FIRE ; volcanobadge
        db GROUND ; earthbadge
        db $ff
; fbe91

What I did myself was to make the first instruction of both BadgeStatBoost and DoBadgeTypeBoost be a Return (0xC9). Another option would be to search for the calls to those two functions and NOP them.

trainer AI (that is, setting the AI of all/some trainers to that of a gym leader, elite four member, etc.)

I can't help you with this one as I have never bothered much about AI myslef, but maybe you can find what you are looking for here:
https://github.com/cogitokat/pokecrysta … coring.asm

Offline

#3 2013-11-30 03:11:43

Laugh
New member
From: Canada
Registered: 2013-11-24
Post 5/9

Re: How can I change the following misc. aspects of battles? (Crystal)

Thanks a bunch.

Offline

#4 2014-11-07 19:52:34

frz hax
Member
Registered: 2014-08-06
Post 34/43

Re: How can I change the following misc. aspects of battles? (Crystal)

*I know this is bumping an old thread but it really is useful.

I'm not too familiar with with the ASM jargon because all I really do is scripting and stuff. What bytes do I have to change and what do I change them too?

This is one of the few last things I want to do before releasing my hack, any help would be greatly appreciated (especially removing the badge boosts).

Thank You very much you've been super helpful so far.

Offline

#5 2014-11-09 00:32:51

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 228/434
Website

Re: How can I change the following misc. aspects of battles? (Crystal)

Overwrite everything from 0x270d6 to 0x2715b with 0xFF to turn all trainer DVs into 15/15/15/15.

With your hex editor, search "FE 40" from address 0x35ece on, and replace the first four matches with FE 00. This will replace the four cp 40 instructions (25%) that give those non-damaging moves a chance to miss when used by the AI with cp 00 instructions (0 %), so they will no longer miss.

Change 0x3ed45 and 0xfbe24 to 0xC9 (ret). This makes those badge boosts routines return immediately whenever called, so that they do nothing.

If you also want to change the AI of the worse trainer classes to match the better AI of leaders/e4, do this: Write D3 03 at address 0x3959f, then move on 5 more addresses (0x3959f + 0x07 = 0x395a6) and write D3 03 again, then again at 0x395a6 + 0x07 = 0x395ad, and do this until you reach 0x3976d (included). This makes every single trainer class use only the best AI layers.

Offline

#6 2014-11-09 09:34:11

frz hax
Member
Registered: 2014-08-06
Post 35/43

Re: How can I change the following misc. aspects of battles? (Crystal)

Wow thank you very much. This should be stickied.

From the ai attributes routine I managed to find the AI bit myself but I would have never been able to do the rest.

Just one more thing, what is the vblank interrupt  you mentioned for making it always set. I still can't do that.

Offline

  • Index
  • → Help/Question
  • → How can I change the following misc. aspects of battles? (Crystal)

Board footer

Powered by FluxBB