Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → Badge Dependent Level Caps & Badge Boost Removal? [Pokemon Crystal]

#1 2021-12-20 19:39:33

ILuvChinPokomon
Member
Registered: 2020-06-18
Post 21/25

Badge Dependent Level Caps & Badge Boost Removal? [Pokemon Crystal]

Hello, are there any tutorials on how to make level caps for a player's Pokemon dependent on how many badges they have? For example, 0-10 before 1 badge, 10-16 after obtaining the first badge, 16-24 after obtaining the second badge etc...? I'm specifically looking to do this for Gen 2 Pokemon games.

Also, I was wondering if someone could please tell me how to remove the badge boosts given to the player upon being awarded a badge.

This would greatly help in making Romhacks more challenging for players.

Offline

#2 2021-12-29 12:31:32

nightbringer
Member
Registered: 2021-08-18
Post 11/21

Re: Badge Dependent Level Caps & Badge Boost Removal? [Pokemon Crystal]

Regarding Badge-dependent level caps, it took me a lot of attempts but by taking cues from the pre-existing code for badge-dependent obedience checks, and cues from the tutorial for ceasing to gain exp at lv100, I came up with the following script, which has worked for me.

You will need to edit engine/battle/core.asm

Find the

.stat_exp_awarded

section and edit it to read as follows:

.stat_exp_awarded
inc de
inc de
dec c
jr nz, .stat_exp_loop
ld hl, wJohtoBadges

; risingbadge
bit RISINGBADGE, [hl]
jr nz, .eight_badge

; glacierbadge
bit GLACIERBADGE, [hl]
jr nz, .seven_badge

; mineralbadge
bit MINERALBADGE, [hl]
jr nz, .six_badge

; stormbadge
bit STORMBADGE, [hl]
jr nz, .five_badge

; fogbadge
bit FOGBADGE, [hl]
jr nz, .four_badge

; plainbadge
bit PLAINBADGE, [hl]
jr nz, .three_badge

;hivebadge
bit HIVEBADGE, [hl]
jr nz, .two_badge

; zephyrbadge
bit ZEPHYRBADGE, [hl]
jr nz, .one_badge

; if no badges are held
pop bc
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp GYM0_CAP
jp nc, .next_mon
push bc

.one_badge
pop bc
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp GYM1_CAP
jp nc, .next_mon
push bc

.two_badge
pop bc
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp GYM2_CAP
jp nc, .next_mon
push bc

.three_badge
pop bc
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp GYM3_CAP
jp nc, .next_mon
push bc

.four_badge
pop bc
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp GYM4_CAP
jp nc, .next_mon
push bc

.five_badge
pop bc
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp GYM5_CAP
jp nc, .next_mon
push bc

.six_badge
pop bc
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp GYM6_CAP
jp nc, .next_mon
push bc

.seven_badge
pop bc
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp GYM7_CAP
jp nc, .next_mon
push bc

.eight_badge
pop bc
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp GYM8_CAP
jp nc, .next_mon
push bc

xor a
ldh [hMultiplicand + 0], a
ldh [hMultiplicand + 1], a
ld a, [wEnemyMonBaseExp]
ldh [hMultiplicand + 2], a
ld a, [wEnemyMonLevel]
ldh [hMultiplier], a
call Multiply
ld a, 7
ldh [hDivisor], a
ld b, 4
call Divide
        ...

The code carries on from there to instruct on giving exp boosts to traded mon. You can leave that as it is.

Offline

#3 2021-12-29 12:33:28

nightbringer
Member
Registered: 2021-08-18
Post 12/21

Re: Badge Dependent Level Caps & Badge Boost Removal? [Pokemon Crystal]

Next you will need to edit constants/battle_constants.asm

At the top of the file you can simply define values like

GYM0_CAP EQU 15

Do that for each level cap.

Because its been a while since I did all this, its possible that the above script only works if you've also done some of the things in this tutorial: https://github.com/pret/pokecrystal/wiki/Level-cap - I can't remember.

Use my script at your own risk. I'm not particularly experienced. So far I haven't noticed any bugs its caused but I'm hardly an experienced bug tester either.

Last edited by nightbringer (2021-12-29 12:36:04)

Offline

#4 2022-01-03 18:11:51

ILuvChinPokomon
Member
Registered: 2020-06-18
Post 22/25

Re: Badge Dependent Level Caps & Badge Boost Removal? [Pokemon Crystal]

Cool! Thanks, I'll try messing around with that a bit. I've noticed your script only goes up until badge 8 though? In the Gen 2 games there's 16 badges, so does it work the same for the Kanto badges?

Offline

#5 2022-01-04 08:45:17

nightbringer
Member
Registered: 2021-08-18
Post 13/21

Re: Badge Dependent Level Caps & Badge Boost Removal? [Pokemon Crystal]

Ah, right. I don't plan to have the Kanto badges in my hack so I've left them out. But yes, you could do something similar for the Kanto badges.

Offline

#6 2022-01-08 07:37:48

ILuvChinPokomon
Member
Registered: 2020-06-18
Post 23/25

Re: Badge Dependent Level Caps & Badge Boost Removal? [Pokemon Crystal]

Gotcha, do you know if the coding is the same for the Kanto badges? Or do they fall under some seperate kind of code? Like would I just continue the script with badge 9, badge 10 etc or is there a different format for kanto badges?

Offline

#7 2022-01-08 08:41:07

nightbringer
Member
Registered: 2021-08-18
Post 15/21

Re: Badge Dependent Level Caps & Badge Boost Removal? [Pokemon Crystal]

You couldn't just continue the script in the that way, no. There is a separate check for Kanto badges that will require you to load wKantoBadges. (Note that in the script above, wJohtoBadges is checked).

My recommendation would be to first check that the Johto badges script works for you and then trial and error ways to add checks for the Kanto badges. Be patient. It took me hours and hours, across multiple attempts to figure out what I sent you. But eventually you'll get there and you'll probably learn a lot along the way.

Offline

#8 2022-01-11 10:52:01

ILuvChinPokomon
Member
Registered: 2020-06-18
Post 24/25

Re: Badge Dependent Level Caps & Badge Boost Removal? [Pokemon Crystal]

I see, thanks! This is very helpful, I'll toy around with it a bit and see what I can do about applying something similar to the Kanto badges!

Offline

  • Index
  • → Help/Question
  • → Badge Dependent Level Caps & Badge Boost Removal? [Pokemon Crystal]

Board footer

Powered by FluxBB