Golden Sun Hacking Community
April 20, 2018, 10:00:45 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 4853 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: 2411

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

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

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

« 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
Today at 02:46:36 PM
KyleRunner: Atrius!!
Yesterday at 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.
April 16, 2018, 07:44:36 AM
Drake baku: So it took about halve a hour of letting my lap stay off for it to suddenly work again
April 16, 2018, 07:31:28 AM
Drake baku: All of a sudden fox his editor gets errors. When trying to start it, thing worked fine yesterday...
April 14, 2018, 01:04:37 PM
Fox: @Mario Golf/text editing = Nope... And it may be awhile yet. I think I looked into it before... (at least for GS1)... but usually is the case when I come across a particular problem, that it can delay a solution for an extremely long time.
April 12, 2018, 04:27:14 PM
KyleRunner: Gee... never used discord...
April 12, 2018, 06:03:23 AM
Drake baku: I take it back, found it
April 12, 2018, 06:02:01 AM
Drake baku: But there is no discord link to be found
April 12, 2018, 06:01:44 AM
Drake baku: Everyone is on discord
April 11, 2018, 09:44:06 PM
KyleRunner: Fox, what about that tool for editing text in Mario Golf? Didi you finish it? If not, can you make a version of gstoolkit compatible with it?
April 11, 2018, 07:41:25 AM
Drake baku: Mauw
March 30, 2018, 07:26:11 PM
Salanewt: Hi!
March 29, 2018, 07:37:45 PM
ThanatosTheDark: YYEEEOOOOOO
March 12, 2018, 02:21:06 AM
Fox: say*
March 12, 2018, 02:20:53 AM
Fox: I saw we need an event this April Fools/Easter... because two holidays are in one, why would we not want to miss having something special? (Unfortunately, there's no one here to make an event be successful.)
March 12, 2018, 02:18:17 AM
Fox: And since that's the case...  I have thought of another fun experiment idea. - What if we had an auction on who should run this site, and waited for 10 people to bid and also for a bare minimum of 24 hours. Who would bid the highest, and how much would that bid be? - The idea is more for lulz (Maybe for April Fools?), and a theory to get an idea of how much the site might be worth as well.
March 11, 2018, 03:02:31 AM
Fox: Creepy, isn't it?
March 10, 2018, 02:19:04 AM
Fox: It's frog legs now.. It's something that's dead, but somehow still manages to wiggle.
March 09, 2018, 04:12:17 AM
JamietheFlameUser: I think this place is still dead.
March 02, 2018, 09:43:18 AM
Pkmn-Master: Lol I haven't been here in like 6 years. How is everyone?

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.