Golden Sun Hacking Community
November 17, 2018, 05:43:11 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 5883 times)
0 Members and 1 Guest are viewing this topic.
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 29
Offline Offline

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

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

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

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

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

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

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

« 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
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!
October 10, 2018, 10:02:10 PM
Fox: A few people I'm sure... Most likely the regulars of the past. Such as Atrius, Charon, Role, Salanewt....
October 10, 2018, 03:11:17 AM
Crystal Sonata: I find myself wondering who still remembers me here. Obvs you do (Good to see ya Tea)
October 10, 2018, 12:46:11 AM
Fox: On second thought, it might be because you haven't posted much as Crystal Sonata.
October 10, 2018, 12:41:12 AM
Fox: And your intro isn't that bad. - I imagine most people would say the same about theirs?
October 10, 2018, 12:39:39 AM
Fox: :O - You've been gone so long, I think I forgot you were Momo.  Interesting.

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