Golden Sun Hacking Community
January 19, 2018, 11:08:05 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 4082 times)
0 Members and 1 Guest are viewing this topic.
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 #30 on: November 16, 2016, 03:25:12 AM »

Quote
First, the items are out of order compared to english (0x44 is supposed to be the Staff of Anubis but in Jap it is 0x144).
Nah. It's 0x144 on both (U) and (J)... Unless I'm missing something. (I checked just now by giving the item to a PC.... from the PC RAM data.)

So yeah... that post still goes:
Quote
@Staff of Anubis: Should be 0x144, and not 0x44.
Red Demon - 72 Jupiter (1/64)

@Enemy data: Probably just a simple base address change for each ROM table. You probably should be doing this anyway, but create a variable for each base address of a table... And the Localization will determine what the address is for each.

080B9E7C = (U) version Enemy data

080B4E4C = (J) version Enemy data


So yeah... Everything is basically there, but  the (J) version is of a slightly earlier address... (You can find it by searching for matching data between (U) and (J) versions if you want.)
« Last Edit: November 16, 2016, 06:21:13 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 #31 on: November 21, 2016, 11:04:08 PM »

Thanks for that! I never anticipated doing any work with JP but making it a variable sounds like a good idea.
Logged
View Profile

Regular Member
**

Coins: 2
Offline Offline

Posts: 135

« Reply #32 on: January 10, 2017, 04:10:57 PM »

Hey just checking.... but when fleeing after the reunion does it consider the party level to be the average of all 8 members (assuming they're alive) or just the front four?
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 #33 on: January 10, 2017, 08:42:45 PM »

Should be just the living PCs in front.
« Last Edit: January 10, 2017, 08:45:44 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 #34 on: January 11, 2017, 01:19:07 PM »

My script is returning a lower rate of flee success than what the game is - afaik it's only happening after the reunion. Any idea what is wrong?

Code:
if memory.readword(0x02000420) == 0x1FE then                 -- if in battle then do the following

if el4 ~= 0 then                                 --Hacky way of getting the enemy level; doesn't work for 5+
ela = (el1+el2+el3+el4)/4
elseif el3 ~=0 then
ela = (el1+el2+el3)/3
elseif el2 ~=0 then
ela = (el1+el2)/2
else
ela = el1
end

pc1 = memory.readbyte(0x02000458)
pc2 = memory.readbyte(0x02000459)
pc3 = memory.readbyte(0x0200045A)
pc4 = memory.readbyte(0x0200045B)
if party == 0x70 then
ml = (memory.readbyte(0x02000520+0x14C*pc1+0xF)+memory.readbyte(0x02000520+0x14C*pc2+0xF)+memory.readbyte(0x02000520+0x14C*pc3+0xF))/3
else
ml = (memory.readbyte(0x02000520+0x14C*pc1+0xF)+memory.readbyte(0x02000520+0x14C*pc2+0xF)+memory.readbyte(0x02000520+0x14C*pc3+0xF)+memory.readbyte(0x02000520+0x14C*pc4+0xF))/4
end

LevelAve = ml-ela

fleeFail = memory.readbyte(0x02030092)

function flee(S) -- Flee Success Calculation
g = S
g = RNB(g)*10000
fl = 5000 + (2000*fleeFail) + (LevelAve * 500)
g = bit.rshift(g, 16)
if fl >= g then
return true
else
return false
end
end
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 #35 on: January 11, 2017, 10:20:42 PM »

Huh... That's strange.
Is it corrected when you remove the last four PCs (after reunion and before entering battle)?
(I assume you're only Fleeing at the beginning of a battle - so we skipped checking for whether they were living or not.)

I might have to run your script in a bit... and maybe compare with SDL-H.... so not sure what's going on yet.

Quote
   if fl >= g then
      return true
   else
      return false
   end
This can be reduced to "return fl >= g" ...


Or rather, since I like short code, more like:

function flee(S) -- Flee Success Calculation
   return ((5000 + (2000*fleeFail) + (LevelAve * 500)) >= (bit.rshift(RNB(S)*10000, 16)))
end

But if you like things split up... this works too: (Probably the easiest to read of all of these?)

function flee(S) -- Flee Success Calculation
   fl = 5000 + (2000*fleeFail) + (LevelAve * 500)
   g = bit.rshift(RNB(S)*10000, 16)
   return fl >= g
end



Spoiler for ------- Fun thought -------:
If LUA has any dictionary types... I bet this could be shortened way down: (Best case scenario is... possibly a one liner inside the function...?)
Quote
function bchance (E) -- base chance for status
    if E == 16 or E == 17 then
        c = 75
    elseif E == 23 then
    c = 40
    elseif E == 24 then
    c = 45
    elseif E == 27 then
    c = 20
    end
    return c
end
I'm thinking something like: (Not tested of course.... But you can do this type of thing in Python... however, here... I try to write in LUA..., so I should look into it.)
return {[16]=75, [17]=75, [23]=40, [24]=45, [27]=20}[E]

After testing, LUA seems to not allow for the [E] part... unless I missed something. (There might be a way, but??) ...so you may have to assign the dictionary to a variable first...

c = {[16]=75, [17]=75, [23]=40, [24]=45, [27]=20}
return c[E]

Should do it.

I wouldn't recommend a one liner unless it is a small dictionary, though... and I think this is small enough. (If it was long, you could put each element on a separate line - simple, I think.)

So are you planning to make a big edit to your GS2 Script? Or is it just bug fixes?
« Last Edit: January 12, 2017, 07:10:49 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 #36 on: January 13, 2017, 12:24:34 AM »

I just went through and checked everything by having my script print intermediate variables and whatnot; I can't see any issue with what's going on. Maybe I just misread errors earlier on... can't seem to replicate the behavior anymore =/
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 #37 on: January 13, 2017, 01:34:10 AM »

Interesting... So there are no errors?

Only possibilities I can think of at the moment are these:
-You misread something.
-Killed off an enemy ... maybe/maybe not used a savestate/forgot it won't the start of the battle.
-Started a battle with 5+ enemies/forgot that there wasn't support for that.

Etc.


---
So I googled golden sun hacking in my emails.... Found out you mailed me on youtube in 2013, but I can't access the whole message... I think b/c youtube doesn't do Inbox anymore?.... Do you remember what it was about?
It linked to this topic (http://forum.goldensunhacking.net/index.php?topic=1632.0 ) ... but the message cuts off (with "more" as a link to a Not Found page.)

« Last Edit: January 15, 2017, 01:25:01 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 #38 on: January 17, 2017, 12:20:02 AM »

Would have been about RNG stuff, we knew nothing back then! xD
Logged
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.051 seconds with 22 queries.