Golden Sun Hacking Community
December 12, 2018, 05:23:56 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
  Home   Forum   DC Wiki Help Search Calendar Downloads Login Register  
Pages: [1] 2 3   Go Down
  Print  
Author Topic: GS2 Utility Script  (Read 6239 times)
0 Members and 1 Guest are viewing this topic.

Regular Member
**

Coins: 2
Offline Offline

Posts: 135

« on: October 07, 2016, 12:50:05 PM »

Hello everyone! I'm back to work out some things for writing a utility script for GS2 akin to the one made for GS1 http://forum.goldensunhacking.net/index.php?topic=2656.0

The big difference between GS1 and GS2 is that the kinds of things I need out of the script are somewhat different. I've ported over everything from the GS1 script but there's one thing in particular that would be much more useful in GS2 than GS1 is the value of the agility roll in a fight.

So let's be precise. We know that a member of your party can have its agility boosted between 0-6% depending on RNG (specifically, the general random number "GRN" i.e. the random number in the 0x03xxxxxx series). What Zetonegi found a couple months ago is that the reason the GRN advances when finalising your party members action is that the game calculates the 0-6% boost at that step.

Just so there's no confusion; Say the party member is Felix, you command Felix to attack an enemy. You then get to issue a command for Jenna. Once the attack is issued and before you choose Jenna's action the random number is rolled to determine what Felix's agility will be for that action. If you cancel Felixs command (by pressing B) and issue a new one, a new agility boost is calculated by rolling the random number again.

I'm curious as to where this value is stored, so that I can get my script to read this value and know what agility my party members will have on that turn. 
Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 29
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2432

« Reply #1 on: October 07, 2016, 01:11:51 PM »

Where it is stored? Already have that "magic trick" up my sleeve..

The turn table is at 0x02030338. (Shows only a single round of all character turns.)
0x10 bytes per character.
First byte = Starts with who's turn it is.
I think the Agility one would be at [+0x4] in a turn entry.

(You could read 0x02030338 directly (Since I don't expect the position to actually change), or follow the pointer @03000024 the way the game does. - Everything in 03000000-030000FF is pretty much pointers to RAM data tables... with the first two being free space pointers.)
« Last Edit: October 07, 2016, 01:25:57 PM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile
Salanewt
His Sexiness
Mercury Clan

Oh yeah, baby!

Prodigy
*

Coins: 32
Offline Offline

I am: A part of the organization of Cool Cats, but more of a dog person in reality.
Emblems: Have a nice day.
Posts: 4569

« Reply #2 on: October 07, 2016, 01:24:49 PM »

And that's total Agility post-RNG.

Need any other questions answered?
Logged

Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?
View Profile WWW

Regular Member
**

Coins: 2
Offline Offline

Posts: 135

« Reply #3 on: October 08, 2016, 02:01:33 PM »

Where it is stored? Already have that "magic trick" up my sleeve..

The turn table is at 0x02030338. (Shows only a single round of all character turns.)
0x10 bytes per character.
First byte = Starts with who's turn it is.
I think the Agility one would be at [+0x4] in a turn entry.

(You could read 0x02030338 directly (Since I don't expect the position to actually change), or follow the pointer @03000024 the way the game does. - Everything in 03000000-030000FF is pretty much pointers to RAM data tables... with the first two being free space pointers.)
Perfect! I'll poke around and extract what I need from there :)

@Lord Squirtle, I think that's the only missing thing that I can't brute force conveniently. I did want to look into the other random number (BRN) and predict when you get attacks first and whatnot but I don't know how to use that information in a useful way in the context of GS2 (i know that encounters add 1 BRN per enemy provided you don't have attacks first, but if I can't predict the size of the mob without a script then I can utilise manip'ing for attacks first).

I eventually want to learn how collision works in this game (because its really really weird), but that extends beyond the scope of this question :)
« Last Edit: October 08, 2016, 02:05:25 PM by Plexa » Logged
View Profile

Regular Member
**

Coins: 2
Offline Offline

Posts: 135

« Reply #4 on: October 08, 2016, 05:17:57 PM »

Actually, now I do have another question!

So I know the agility of, say, Felix is stored at 0x02000A90 but this is the agility after modifiers have been added (class, equipment, etc). Where might I find the raw agility stat of each character? This is important because its useful to know how many "imperfect" level ups we get for each character since we don't control the stat boost for each level up. (the HP stat would also be useful!)

EDIT: Nevermind! Found it :)
« Last Edit: October 08, 2016, 05:50:53 PM by Plexa » Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 29
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2432

« Reply #5 on: October 08, 2016, 05:47:05 PM »

You mean the part in the base stats? (Should be in the same order as the current stats.) - Base stats might include Stat Bonuses from Use items. (Apple, Hard Nut, etc.)
« Last Edit: October 08, 2016, 05:50:38 PM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile

Regular Member
**

Coins: 2
Offline Offline

Posts: 135

« Reply #6 on: October 08, 2016, 05:51:36 PM »

I literally just found it myself, with that said, your image is very useful. Thank you :)
Logged
View Profile

Regular Member
**

Coins: 2
Offline Offline

Posts: 135

« Reply #7 on: October 08, 2016, 07:13:34 PM »

Sorry to make yet another reply, but how do sleep bombs work? When using the pirate sword dream tide may make enemies sleep based off of your mercury power. However, sleep bombs don't have an elemental affinity? So I was wondering how this works?
Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 29
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2432

« Reply #8 on: October 09, 2016, 12:23:00 AM »

Quote
Sorry to make yet another reply, but how do sleep bombs work?
The Ailment Success function? (Which is listed on http://forum.goldensunhacking.net/index.php?topic=2460.0)

Quote
When using the pirate sword dream tide may make enemies sleep based off of your mercury power. However, sleep bombs don't have an elemental affinity? So I was wondering how this works?
It's Unleash is the Dreamtide ability (Water attribute), and not Sleep Bomb (As an ability, Wind attribute.).  Both can inflict Sleep.
« Last Edit: October 09, 2016, 12:32:42 AM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile

Regular Member
**

Coins: 2
Offline Offline

Posts: 135

« Reply #9 on: October 09, 2016, 12:43:47 AM »

Quote
Sorry to make yet another reply, but how do sleep bombs work?
The Ailment Success function? (Which is listed on http://forum.goldensunhacking.net/index.php?topic=2460.0)

Quote
When using the pirate sword dream tide may make enemies sleep based off of your mercury power. However, sleep bombs don't have an elemental affinity? So I was wondering how this works?
It's Unleash is the Dreamtide ability (Water attribute), and not Sleep Bomb (As an ability, Wind attribute.).  Both can inflict Sleep.
So I get that it successes the Ailment success function, just didn't know what element it was associated to (I guessed jupiter).

I'm currently debugging my script because I think a lot of the memory addresses I'm trying to read are the wrong ones lol

Does 0x080C6684 point to the enemy index?
Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 29
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2432

« Reply #10 on: October 09, 2016, 12:49:26 AM »

Quote
Does 0x080C6684 point to the enemy index?
Nope.... That's Elemental data... Enemies index to them. - The info can be seen at the bottom in Atrius's enemy editor... The first four top values are actually just one value. (32-bit), and should represent elemental type. (Forgot what for? Attack?)
« Last Edit: October 09, 2016, 01:05:41 AM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile

Regular Member
**

Coins: 2
Offline Offline

Posts: 135

« Reply #11 on: October 09, 2016, 01:46:35 AM »

EDIT: actually it's worse than that lol I have 0x080C6684 all over the place in places it shouldn't be.

Code:
S=memory.readbyte(0x02030A12)
function enemy (S,Elm) -- Enemy Elemental Data Table
        elemInd = memory.readbyte(0x080C6684  + ((S - 8) * 0x54) + 0x34)
        enemyelmlevel = memory.readbyte(0x080C6684  + (elemInd * 0x18) + 4+Elm)
        return enemyelmlevel
end
That first instance of 6684 looks okay, the second one doesn't look okay.  
Code:
if memory.readbyte(0x080C6684  + (PC * 0xB4) + 0x92 + Elm) == 54 then
elmaff = 5
else
elmaff = 0
end
Again, this one is probably wrong since that should be pointing to the PC elemental data. From the gs2 data google doc shouldn't this be 080C6644?  But then +0xB4 would take it back into the enemy elemntal index.

EDIT2:
Made these edits
Code:
function enemy (S,Elm) -- Enemy Elemental Data Table
        elemInd = memory.readbyte(0x080C6684  + ((S - 8) * 0x4C) + 0x2A)
        enemyelmlevel = memory.readbyte(0x080B9E7C  + (elemInd * 0x18) + 4+Elm)
        return enemyelmlevel
end
Code:
if memory.readbyte(0x080C0F4C  + (U * 0xB4) + 0x92 + Elm) == 54 then
elmaff = 5
else
elmaff = 0
end
But this still doesn't work... tried to follow your advice here: http://forum.goldensunhacking.net/index.php?topic=2656.msg44420#msg44420
« Last Edit: October 09, 2016, 02:55:32 AM by Plexa » Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 29
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2432

« Reply #12 on: October 09, 2016, 02:59:56 AM »

@1: Other way around? Haha...

080B9E7C = Enemy Stats (76 bytes per entry)
GS2 is 0x4C bytes/entry here... (GS1's could probably be 0x54/entry, but would have to check.)
+2A = Elem. Index?

Which means I'm getting this for GS2 version:

        elemInd = memory.readbyte(0x080B9E7C  + ((S - 8) * 0x4C) + 0x2A)
        enemyelmlevel = memory.readbyte(0x080C6684  + (elemInd * 0x18) + 4+Elm)

@2: Looks like it should be the Party data (Stuff you start with.)

080C0F4C


EDIT: I forgot to refresh the page.
« Last Edit: October 09, 2016, 03:06:04 AM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile

Regular Member
**

Coins: 2
Offline Offline

Posts: 135

« Reply #13 on: October 09, 2016, 03:04:41 AM »

Yeah I still had the first two addresses round the wrong way, fixed that now...

Still getting the wrong results =/ 0x02030A12 is enemy index correct? (for the first enemy)

EDIT: Here's the full script atm http://pastebin.com/qMpEmPnT it's just the unleash/effect proc stuff thats messing up atm.

EDIT2: Now I think there's a problem here
Code:
function vuln (S)
e1Ind = S
vuln1 = memory.readbyte(0x080B9E7C  + ((e1Ind - 8) * 0x4C) + 0x48)
vuln2 = memory.readbyte(0x080B9E7C  + ((e1Ind - 8) * 0x4C) + 0x49)
vuln3 = memory.readbyte(0x080B9E7C  + ((e1Ind - 8) * 0x4C) + 0x4A)
return vul1, vul2, vul3
end
« Last Edit: October 09, 2016, 03:11:28 AM by Plexa » Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 29
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2432

« Reply #14 on: October 09, 2016, 03:25:23 AM »

@    eind = memory.readbyte(0x02030A12) -- Enemy Index

It may be a byte in GS1, but it is a 16-bit in GS2.

@Edit 2: Yeah, Probably should be +0x3E, +0x3F, and +0x40.... (For enemy vulns....)
Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile
Pages: [1] 2 3   Go Up
  Print  
 
Jump to:  

Cbox
December 09, 2018, 07:43:31 PM
Fox: A banana for you, a banana for me, let's all open a banana and enjoy!
December 08, 2018, 09:48:52 PM
Drake baku: ba... ba.... bana.... bana.... banana.... nanananananananana..... and now back to doing normal, kinda
December 07, 2018, 05:43:02 PM
Luna_blade: Hey I forgot the christmas theme
November 29, 2018, 09:01:09 AM
zman9000: ded
November 19, 2018, 11:05:28 AM
Drake baku: Good day to ya all
October 30, 2018, 09:45:58 PM
Atrius: There used to be where I got the battle sprites for Kraden, but that site doesn't exist any more.
October 26, 2018, 01:31:40 PM
Infitek: Do you know if there any custom Alex battle sprites available on the internet ?
October 26, 2018, 01:31:01 PM
Infitek: Hey everyone
October 13, 2018, 03:23:06 AM
Salanewt: Updated it to provide more info that I forgot to mention.
October 13, 2018, 03:16:48 AM
Salanewt: I'm still trying to iron out IQ 2 but I'm pretty sure it's entirely random targeting.
October 13, 2018, 03:16:29 AM
Salanewt: Oh yeah, I posted some more info about enemy IQ.
October 12, 2018, 09:51:27 PM
FoxThe HTML5 project is too small to count
October 12, 2018, 06:19:48 AM
Luna_blade: there is jjppof's html5 project...
October 12, 2018, 06:19:17 AM
Luna_blade: Though Momo rings a bell it seems I came here after you left
October 11, 2018, 12:49:41 AM
Fox: (If that makes sense.)
October 11, 2018, 12:48:33 AM
Fox: Yeah, I guess so.  More just saying that's a good place to get answers to GS related questions at the moment.
October 11, 2018, 12:42:28 AM
Crystal Sonata: I did before, but I guess I could try it again
October 11, 2018, 12:41:32 AM
Fox: Not much at the moment. This forum seems pretty quiet. Perhaps you'd be interested in joining the Discord for GSHC that seems to have more activity?
October 10, 2018, 11:16:53 PM
Crystal Sonata: Any projects going on? I need a distraction from the daily grind and I'm interested in hacking GS again.
October 10, 2018, 10:02:53 PM
Fox: Thanks, and good to see you too!

Affiliates
Temple of Kraden Golden Sunrise
Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.158 seconds with 22 queries.