Atrius: I'm trying to fix the site, but it might take a while.

It seems the SQL database had grown larger than our hosting company allows.
I've cleaned out all of the unnecessary log data to get it down to an
acceptable size, but haven't received a response as to why normal
functionality hasn't been restored yet.


 GS2 Utility Script
Golden Sun Hacking Community
July 20, 2018, 10:16:05 AM *
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 5304 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: 28
Offline Offline

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

« 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: 4566

« 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: 28
Offline Offline

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

« 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: 28
Offline Offline

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

« 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: 28
Offline Offline

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

« 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: 28
Offline Offline

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

« 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: 28
Offline Offline

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

« 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
July 18, 2018, 10:49:52 PM
roger: I can post but it goes to an error page when I submit.
July 18, 2018, 05:24:12 PM
zman9000: Site is back WOO!
May 09, 2018, 12:35:37 AM
KyleRunner: The "Start In" field is not editable... I'll try making new shortcuts
May 08, 2018, 09:51:08 PM
Fox: If all else fails, you canmake new Shortcuts to do the same thing.
May 08, 2018, 09:49:53 PM
Fox: Export Properties > Shortcut (Tab) > Target / Start In ; Target (for Export) should be: (filename) 0 , and for Import: (filename) 1
May 08, 2018, 08:52:00 PM
KyleRunner: I can't change the path in properties menu...
May 08, 2018, 01:27:19 AM
Fox: You may need to edit something in properties, though... so it uses the exe file in the same directory.
May 08, 2018, 01:24:59 AM
Fox: It is suppose to be a shortcut, yes.
May 03, 2018, 11:48:05 PM
KyleRunner: Fox, the "export" function in your text editor is just a shortcut... Could you please fix it?
May 02, 2018, 09:53:45 PM
KyleRunner: I come here everyday. I'm working on a Portuguese translation, and the people here help me a lot.
May 02, 2018, 08:56:07 AM
Drake baku: My feel as well, I posted a little as well since my return, but silence was all that followed... At least the forum is a great source for data when hacking GS/ GS2, currently looking for something I have read a long time ago cause my PP recovery psy is not working
May 01, 2018, 09:58:04 AM
Fox: I am thinking a lot of this might be because of Discord?
May 01, 2018, 09:56:08 AM
Fox: Yeah, this forum is more dead than ever before.  February and April have 0 new topics. (All other months prior have more.) And March has lowest number of new posts. (It'd be dumb to count the very first month this site was created.)
April 25, 2018, 09:02:13 PM
Fox: Yes. The best tool is a hex editor. Well.... VBA, VBA-SDL-H, no$gba Debugger, GBATEK, and my documentation.... to use these to learn how the code/data works. Best method because it maximizes your editing ability... and then there is my program gsmagic that I was working on. Still in its early stages, though. (Even after year(s).)
April 25, 2018, 04:21:58 PM
Xendrox D: *exept tla editor.
April 25, 2018, 04:21:29 PM
Xendrox D: is there any other tool for hacking gs?
April 23, 2018, 09:26:27 PM
Atrius: Rarely, but not never.
April 23, 2018, 08:01:48 AM
Drake baku: Can it be, the god who created the editor, atrius. I heard you never came back online here anymore
April 20, 2018, 02:46:36 PM
KyleRunner: Atrius!!
April 19, 2018, 11:29:46 PM
Atrius: @Fox, I tried, but for some reason Mario Golf won't boot, and Mario Tennis crashes when you patch out the text compression, and I'm not sure why...  The normal text loading functions in them are basically the same as the ones in the Golden Sun games.

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.064 seconds with 29 queries.