Golden Sun Hacking Community
January 19, 2018, 05:41:03 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 4077 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: 2403

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

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

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

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

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

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

« 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
January 17, 2018, 04:07:51 PM
KyleRunner: :D
January 16, 2018, 08:44:56 PM
Fox: I must say... life can be complicated..... when you have question(s) (via email) ... and it seems like they sort of get ignored. :D ; Fun, (And sometimes, a person may respond, and completely not answer the question.... so like... 3-person conversation.) Hahahaha!!
January 15, 2018, 07:26:16 PM
Fox: (path) 1 text=(address) char=(address) free=(address) ; << Well, closer to this... but yeah... even if I do choose to have defaults in the code, I could still use this method for overrides.
January 15, 2018, 07:24:28 PM
Fox: So like (path) 0 text=(address) char=(address) len=(number) ; (path) 1 free=(address) ; Or something. But that's just a quick example.
January 15, 2018, 06:59:14 PM
Fox: Hopefully. I was wanting to make it so you could put in the addresses/etc. as one of the arguments in the path. Hm?
January 15, 2018, 03:37:07 PM
KyleRunner: Nice! I hope you'll add compatibility with others games (GS1, Mario Golf and Tennis) soon.
January 14, 2018, 11:40:09 PM
Fox: Okay. Posted (in Downloads section) an initial cutdown version for now, for my text compressor. Basically to separate the code from my Editor for anyone who wants to mess with it. It only supports GS2, because I still didn't add the addresses/etc. for the other games.
January 14, 2018, 05:01:00 PM
Fox: Okay! Going to need to think how I want it to work. Initial thoughts is maybe have a number of arguments in the filepath thing. And have a number of shortcuts (files) to be used as examples. Assuming there are no problems.
January 14, 2018, 10:38:24 AM
KyleRunner: Well... I'm used to editing text ina a text editor, so... yes! Thanks in advance!
January 13, 2018, 11:38:43 PM
Fox: (Text editor = Text Document like notepad.)
January 13, 2018, 11:38:21 PM
Fox: Would you prefer during the text editing in a text editor? (Like what gstoolkit lets you do?) I could probably make a separate tool or something to compress it.
January 13, 2018, 10:10:02 PM
KyleRunner: Ok. Once I finish my Lost Age translation, I'll try a Mario Golf one. Thanks. (But I'll need help).
January 13, 2018, 10:03:17 PM
Fox: If you want to make it "permanent" (part of a hack), then you'd edit code in the ROM that writes to this location of the IDs you'd want to change. (You can find these locations by using a breakpoint debugger like SDL-H or no$gba.)
January 13, 2018, 10:00:11 PM
Fox: Reload/switch = Recommended to be done through Debug mode/warp menu, ofcourse... since doors seem to appear as if they were disabled? ; 03001238:01 and B+Start to get to warp menu.
January 13, 2018, 09:55:39 PM
Fox: @Kyle Runner = It might be, but you'd have to use the correct addresses for Mario Golf, rather than for GS2 as I have it right now. ; @raijinken = Yes. 02000454 = ID of leader. (Change this and reload/switch room you are in, enjoy.)
January 13, 2018, 02:23:29 PM
raijinken: Hey guys, is it possible to somehow change the lead character on the map? Was wondering. I remember there was a cheat to use Jenna, but what if I wanted Isaac, or Piers?
January 13, 2018, 02:10:03 PM
KyleRunner: Hey, Fox *
January 13, 2018, 02:09:37 PM
KyleRunner: Hey, is your text editor compatible with Mario Golf (GBA)?
January 11, 2018, 08:33:13 PM
Fox: But if it isn't an oversight, I still can't imagine it being that useful.
January 11, 2018, 08:28:24 PM
Fox: part, ofcourse.

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.07 seconds with 22 queries.