# Skeetendo

’Cause all games were better on the GBC

You are not logged in.

## #1 2013-07-19 15:59:02

pkmgoldfan
Member
Registered: 2011-02-27
Post 37/51

### levelup stat boost

Hello all,

Im hacking pokemon gold and I want to increase the stat difference between levels.
For example I want lvl 5 to be much stronger than lvl 3.

Does anyone of you know how I could do this? I've no idea

I've checked the formule of stats with levels at bulbapedia:

http://bulbapedia.bulbagarden.net/wiki/Stats
But I can find nothing in it that could do the thing I want.

Offline

## #2 2013-07-19 16:13:43

Fractal
Member
Registered: 2013-06-09
Post 136/169

Offline

## #3 2013-07-19 16:18:44

pkmgoldfan
Member
Registered: 2011-02-27
Post 38/51

### Re: levelup stat boost

Doenst work, because if I raise the base stat of a pokemon it will be stronger at lvl 5 but also on lvl 3 resulting in the same procentual difference.

I do have an Idea but i need some help there..

If you look at the damage formule:
http://bulbapedia.bulbagarden.net/wiki/ … ge_formula

I wanna add something in there.
For example:
Damage * ((level1 - level2)*0.10 +1) = Total damage    (when level1 - level2 = <0 its capped at 0 Or when the extra part of the formule is going negative its set to 1)

level 1 = level of your pokemon
level 2 = level of enemies pokemon

Can someone help me adding something like this?
Or do you guys have a better idea?

Last edited by pkmgoldfan (2013-07-19 18:02:16)

Offline

## #4 2013-07-19 16:51:38

Miksy91
Member
Registered: 2010-10-16
Post 1,826/2,346

### Re: levelup stat boost

You've got to hack the routine that determines the stat values based on level and DV/IV values.
Asm and debugging knowledge required.

Offline

## #5 2013-07-19 16:53:15

pkmgoldfan
Member
Registered: 2011-02-27
Post 40/51

### Re: levelup stat boost

and how about the damage formule idea?

Offline

## #6 2013-07-19 17:55:17

pkmgoldfan
Member
Registered: 2011-02-27
Post 41/51

### Re: levelup stat boost

That one doens't depend on stats at all
Maybe it's easier to do it that way?

Offline

## #7 2013-07-19 18:27:36

Miksy91
Member
Registered: 2010-10-16
Post 1,828/2,346

### Re: levelup stat boost

So what do you even want to do exactly?
Not increase the stats but increase the damage inflicted by each move (by that pattern you've shown there) ?

That'd be probably easily doable, but... who would want to do it?

Offline

## #8 2013-07-19 18:47:15

pkmgoldfan
Member
Registered: 2011-02-27
Post 42/51

### Re: levelup stat boost

I want to make levels more important. So that a level 5 is stronger than a level 3. And a level 30 is stronger than a level 26.
I dont really care how its done. Giving the higher pokemon alot more stats, or just alot more defence/attack power.

I came up with an Idea to do this and that is to give the higher leveled pokemon an attack boost for each level that it is higher:
Damage * ((level1 - level2)*0.10 +1) = Total damage

If you use this formule you get this for example:

level 5 vs level 3 pokemon:

level 5 pokemon attacks level 3:
(5 - 3) * 0.10 + 1 = 1.2

So this means that the pokemon on level 5 will do 20% more damage on a lvl 3 because its 2 levels higher.

Last edited by pkmgoldfan (2013-07-19 19:00:23)

Offline

## #9 2013-07-19 19:54:40

Miksy91
Member
Registered: 2010-10-16
Post 1,829/2,346

### Re: levelup stat boost

Well, it can be done but would require some coding to do.
You can code all kinds of mathematical routines with assembly. Or well, not really something like square or squareroot, but you can do adding, subtracting, multiplying (and dividing) pretty easily.

Offline

## #10 2013-07-19 20:19:36

pkmgoldfan
Member
Registered: 2011-02-27
Post 43/51

### Re: levelup stat boost

Could you help me out a little?
What kind of programs do I need and what kind of thing do I have to read to understand what I'm doing?

Offline

## #11 2013-07-19 20:48:09

Miksy91
Member
Registered: 2010-10-16
Post 1,831/2,346

### Re: levelup stat boost

The thing is that doing this is far from your level of understanding. :\

You've to be familiar with editing all kinds of data with a hex editor, knowing how to program in general, understanding z80 assembly, and knowing how to use a debugger efficiently. I can do all of these, at least somewhat, and might be able to finish the stuff.

But if you really want to try and learn how to hack, I'd advise my video tutorials to you as well. Onwards from part 7, it starts to come "close" to doing this kind of stuff too.

Offline

## #12 2013-07-21 12:01:19

pkmgoldfan
Member
Registered: 2011-02-27
Post 44/51

### Re: levelup stat boost

Took a long time, but I've watched all your hacking tutorial videos, part 4A and 4b too.
I had some trouble with the last part, push and pop, but I understand that well too now.
Thank you for those videos, they are really well done and easy to follow :). Good job.

What do you advise me now in order to modify the damage formule?

Offline

## #13 2013-07-21 14:31:02

Miksy91
Member
Registered: 2010-10-16
Post 1,833/2,346

### Re: levelup stat boost

What do you think?

How would write a routine for the damage formula?
Here we've got some documentation about parts of the ram used during battles:
http://datacrystal.romhacking.net/wiki/ … #IN_BATTLE

Offline

## #14 2013-07-21 21:09:33

pkmgoldfan
Member
Registered: 2011-02-27
Post 45/51

### Re: levelup stat boost

I do not really know how to find the routine for this formule.
Also I might have missed part 9, but I can't find it anywhere. It should be about debugging (A thing that you said I would need to know about.)
Do you have the link to part 9 somewhere?

Edit:
I dont know how to do things as multiplying too. Can't find a code for it in the ASM Commands text document.

Last edited by pkmgoldfan (2013-07-21 21:13:18)

Offline

## #15 2013-07-21 23:16:23

Tauwasser
Member
Registered: 2010-10-16
Post 405/457

### Re: levelup stat boost

pkmgoldfan wrote:

I dont know how to do things as multiplying too. Can't find a code for it in the ASM Commands text document.

That's because the Z80GB doesn't have a multiplier/divider unit, nor a floating point unit for that matter. You will have to map a multiplication using basic arithmetic:

(see Wikipedia, where I stole this from)

Many implementations will actually use a trick to multiply quicker. They will perform a switch of operands so the multiplier is smaller than the multiplicand, so the summation loop runs faster. Also, many implementations will optimize the multiplication runtime by performing logic shifts on the operands using the dual number as a place value system for summands to arrive at their result in near-constant time instead of linear time.

cYa,

Tauwasser

Offline

## #16 2013-07-25 09:59:39

pkmgoldfan
Member
Registered: 2011-02-27
Post 46/51

### Re: levelup stat boost

Can anyone tell me where I can find the asm routine for the damage formule?
Or at least how to find it?

I know that it will search for certain values in ram: level, attack own pokemon and the defence of the enemy.
I cannot find the commands in GbAsmEdit so..

Offline

## #17 2013-07-25 11:55:16

Miksy91
Member
Registered: 2010-10-16
Post 1,842/2,346

### Re: levelup stat boost

Set a breakpoint to the ram address where damage is stored and the emulator should stop executing at that part of the "program".

Next, you can debug the routine further on if you need to.

Offline

## #18 2013-07-30 13:41:22

pkmgoldfan
Member
Registered: 2011-02-27
Post 47/51

### Re: levelup stat boost

How to set a breakpoint to a ram adress?
Also were is the damage stored? it's not documented in the ram map.

Offline

## #19 2013-07-31 14:45:51

pkmgoldfan
Member
Registered: 2011-02-27
Post 48/51

### Re: levelup stat boost

Ok I've found something.

Because I dont know were the damage is stored I used the ram adress for enemy defence stat as a breakpoint. (the defence is used in the damage formula).

I did an attack and the emulator halted.
It shows ROMD: 5448   4E        ld c, (hl)             ;2      17
and WRA1: DFCF 4090

What do I have to do next? Its halfway in the damage formula now, but i dont know where it starts and where it ends, also I dont know how to edit it in this bgb emulator.

Offline

## #20 2013-08-01 08:35:35

comet
Member
Registered: 2012-04-09
Post 276/679

### Re: levelup stat boost

youre not actually in the damage formula, thats just the part where it gets the stats it needs like the enemys defense

check out crystal's damage formula

a good entry point would be after stuff like stats and move power are factored in like at d:565b (gold: d:579c)

``````; / 50
ld [hl], 50
ld b, \$4
call Divide``````

so if youre trying to do (your level - enemy level)/10 + 1 you could cram in something right before like

``````; we need to use hl but we dont want to mess with the original flow
; if we wrap our stuff in push/pop we can preserve it

push hl

; get the opponent's level
ld hl, EnemyMonLevel
ld a, [hBattleTurn]
and a
jr z, .GotOpponentLevel
ld hl, BattleMonLevel
.GotOpponentLevel

; your level - opponent level
ld a, e
sub [hl]
jr nc, .ok
; if the opponent's level is higher, no bonus
xor a
.ok

pop hl

; instead of trying to multiply a float we can just multiply and divide by 10
ld [hMultiplier], a
call Multiply

ld a, 10
ld [hDivisor], a
ld b, 4
call Divide``````

Offline

## #21 2013-08-01 19:16:51

pkmgoldfan
Member
Registered: 2011-02-27
Post 49/51

### Re: levelup stat boost

Thanks alot for this information :D.
I will look deeper into it, cuz its hard for me to understand this all at this moment.
I might come back in a few days with some more questions :)

Offline