• Welcome to Final Fantasy Hacktics. Please login or sign up.
 

Where's the routine for experience gain?

Started by nitwit, June 01, 2014, 02:41:16 am

nitwit

I don't like how self-targeting actions always grant 10 experience.  How could I reduce the experience granted by these actions to something smaller?  I'm not sure if I want to reduce the experience gain for all actions as well.

Any non-deathblow action that targets one person of the same level as yourself will always gain 10 experience.  I want the game to treat attacking someone of your own level as attacking someone any certain number of levels above or below you, where I can choose this number when I apply the hack.

Choto

wow good timing on this question... i was just looking for this for a Jot5 hack.

This should have what you're looking for: http://ffhacktics.com/wiki/Attacker%27s_Earned_Experience

nitwit

I decided to rephrase the question today while in the shower.

When I first played this game back in 1998, I abused Accumulate to master one job per battle, until I had a party of level 60 Samurai to fight the chapter 1 Dorter battle.

That's cheesing.

Have you considered making something that reduces experience and JP if the attack is self-targeting only?  Both naturally self-targeting attacks like accumulate and any other attack that just happens to target only yourself?  Are there any other ways to make cheesing like this not work?

Angel

Yeah. You'd just have to add a branch that asks if target included self.
  • Modding version: PSX
* Angel should quit being a lazy bitch
<@Elric> I agree to that as well

nyanyame nyanyajuu nyanyado no nyarabide nyakunyaku inyanyaku nyanyahan nyanyadai nyannyaku nyarabete nyaganyagame
At the end of the day, are we not all trapped inside lemons?

nitwit

June 02, 2014, 05:40:07 pm #4 Last Edit: June 02, 2014, 05:59:35 pm by nitwit

0018d648: 3404000a ori r4,r0,0x000a Default to 10 experience

That's straightforward.


0018d6b0: 90a20090 lbu r2,0x0090(r5) Load Attacker's Second Set of  Support
0018d6b4: 00000000 nop
0018d6b8: 30420020 andi r2,r2,0x0020
0018d6bc: 10400002 beq r2,r0,0x0018d6c8 Branch if unit doesn't have Gained EXP UP

Since I don't like Gained EXP UP, could I place a branch and a jump to free space here?  I think I'd have to put it before this.  It looks like you're not sure what everything is, so maybe I'm better off waiting for you to rewrite it more efficiently.  Or I could delete this, move everything down, and insert the branch in the newly freed space?

I think I would need to branch somewhere here.
0018d64c: 3c028019 lui r2,0x8019
0018d650: 8c422d98 lw r2,0x2d98(r2) Load Defender's Data
0018d654: 00000000 nop
0018d658: 9043015c lbu r3,0x015c(r2) load dead byte
0018d65c: 00000000 nop
0018d660: 10600008 beq r3,r0,0x0018d684 branch if defender was not killed
0018d664: 34040014 ori r4,r0,0x0014
0018d668: 34020014 ori r2,r0,0x0014
0018d66c: 0043001a div r2,r3 0x14 / 1? wtf?
0018d670: 00001012 mflo r2
0018d674: 00000000 nop
0018d678: 00402021 addu r4,r2,r0 r4 = 0x14?
0018d67c: 3c028019 lui r2,0x8019
0018d680: 8c422d98 lw r2,0x2d98(r2) Load Defender's Data
0018d684: 3c058019 lui r5,0x8019
0018d688: 8ca52d94 lw r5,0x2d94(r5) Load Attacker's Data
0018d68c: 90420022 lbu r2,0x0022(r2) Load Defender's Level
0018d690: 90a30022 lbu r3,0x0022(r5) Load Attacker's Level
0018d694: 00821021 addu r2,r4,r2 exp + defenders level
0018d698: 00431023 subu r2,r2,r3 exp + defenders level - attackers level
0018d69c: 00402021 addu r4,r2,r0 r4 = result
0018d6a0: 00021400 sll r2,r2,0x10



What routines should I look at to get an idea of what branching on target = self or target =/= self looks like?

Unrelated, but I could make 255 the cap for experience and make reaching that trigger a level gain by editing this.  Is that right?

0018d6d0: 28420064 slti r2,r2,0x0064 set if < 100
0018d6d4: 14400003 bne r2,r0,0x0018d6e4 branch if so
0018d6d8: 00041c00 sll r3,r4,0x10
0018d6dc: 34040063 ori r4,r0,0x0063 cap at 99

Nevermind, I just looked at a few other routines and it looks like the experience cap or branches if total experience is greater than the cap (100) is present in several places.  I'm tempted to start cross referencing a bunch of routines to make this easier to understand.

Maybe it would save space to reference a value and let people edit that value on their own.

Choto

ok lets see... you could certainly jump to free space from that Gained JP Up routine. Just be aware that the end value that you return will be subject to whatever other modifications happen in the rest of the routine that I don't quite get.

I know that the 0x15C byte is set to 1 when a unit is killed. It may stay as 1 even if they get revived. This would create the condition where experience is increased when a unit is killed the first time, but not subsequent times. That's probably what's going on.

In terms of finding if the target is yourself... take a look at this:

0018d67c: 3c028019 lui r2,0x8019      
0018d680: 8c422d98 lw r2,0x2d98(r2)      Load Defender's Data
0018d684: 3c058019 lui r5,0x8019      
0018d688: 8ca52d94 lw r5,0x2d94(r5)      Load Attacker's Data

If immediately after this code, we do:

bne r2, r5, 0xwherever

it will branch to some location based on wether or not the attacker is the defender (self target). So that's one way you could do it. The trouble may occur if this routine is run repeatedly for each target. If it runs a target that ISN'T the attacker last, it will overwrite the experience gain as normal. That should get you started though. Was that all understandable? If you have further questions don't hesitate to ask

nitwit

September 22, 2016, 10:36:21 am #6 Last Edit: September 22, 2016, 01:04:17 pm by nitwit
Necrobumping my own topic.

I'd have to iterate through a multiple targets and then branch if one of them is equal to my own data.  I would need some sort of loop. Though if there are multiple targets I can exit the routine as soon as one of them isn't me if I want to limit experience and JP to self-targets only.

Let's go on a tangent.

http://ffhacktics.com/wiki/39_%2BSP_%28Y%29


00186d2c: 3c028019 lui r2,0x8019
00186d30: 904238fa lbu r2,0x38fa(r2) Load ability y value (as per Current Ability Data Section) into r2
00186d34: 3c038019 lui r3,0x8019
00186d38: 8c632d90 lw r3,0x2d90(r3) Load value of Target Current Action Data Pointer (as per Data/Table Locations) into r3
00186d3c: 34420080 ori r2,r2,0x0080 r2(y value) = r2(y value) + 0x80
00186d40: a0620012 sb r2,0x0012(r3)      Store Y as 0x80 + SP decrement (boost)//Don't really understand what's going on here.
00186d44: 3c038019 lui r3,0x8019
00186d48: 8c632d90 lw r3,0x2d90(r3)
00186d4c: 34020001 ori r2,r0,0x0001
00186d50: 03e00008 jr r31
00186d54: a0620025 sb r2,0x0025(r3)      Store attack type as Pseudo-Status


http://ffhacktics.com/wiki/Current_Ability_Data_section
http://ffhacktics.com/wiki/Data/Table_Locations