Golden Sun Hacking Community
November 23, 2019, 01:57:49 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]   Go Down
  Print  
Author Topic: [SOLVED] Rearraging Djinn encounters  (Read 3048 times)
0 Members and 1 Guest are viewing this topic.

I need saves to test encounters in GS Reloaded!

Excellent Member
****

Coins: 0
Offline Offline

Gender: Male
Posts: 850

« on: January 06, 2018, 08:02:10 PM »

Since I'm back working on the mod for a few tweaks, i think this is a good time to pick up again an old idea of mine: swap Chill (randomly encountered in the Southern Gondowan) and Mud (Gabomba Catacombs) to fix the elemental imbalance in the first half of the game, cause you get your fifth mercury djinn while you have still only 2 venus ones, leading to some awkward setups.

Point is, i'm afraid I have to ask once again for your help guys, there are many things I don't know and i got struck pretty badly the last time i tried.

I think there are 3 things i must do in order to swap them:

- Swap the encounters. This might be the easy part cause it's something i already did, both for overworld encounters and dungeon ones.

- Swap the models: after battle for both and the dungeon model for the gabomba djinn. This is the first thing i tried to do and where i got stuck. I managed to replace the models with atrius' editor but the game froze immediately upon interacting with it or after the battle (for the overworld one).

- Swap the flags. There are flags for each djinn, which are assigned the moment you get one. I obviously need to swap the call for those 2 djinn but i have absolutely no clue about this one.

Don't know if i missed anything, I hope i'll add something more later tonight or tomorrow if i discover something interesting.
« Last Edit: January 08, 2018, 06:47:04 PM by Caledor » Logged
View Profile

I need saves to test encounters in GS Reloaded!

Excellent Member
****

Coins: 0
Offline Offline

Gender: Male
Posts: 850

« Reply #1 on: January 07, 2018, 10:10:59 PM »

Testing for the gabomba djinn (map 127)
I can swap models and encounter with the editor pretty easily. The animation before battle plays flawlessly but after the battle the djinn remains stuck in midair, no animation plays, it doesn't get added to my djinn poll, and i can keep battling it by pressing A when facing it as usual.

From the editor i noticed that there are "events" binded to the djinn model so i think one or more of those handle the post battle animation and set the correct flag for the obtained djinn. There are 2 issues with them: I have no clue about what they actually do and they are stored in the ewram (02xxxxxxh), so even if i undestand what to do i can't make it permanent on the rom.

Does anybody have any familiarity with those "events"?
Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 0
Offline Offline

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

« Reply #2 on: January 08, 2018, 12:48:50 AM »

Hm... I got something similar with what I did. (No animation after battle.) I fixed it by correcting the flag in the npc entry.


So like...

EXAMPLE:

0200803C:0A = If changed to a number like 0x14 (First mercury djinni), then you'd also need to change 020093AA. In this example, that'd be to 0x44. (0x30 + 0x14)
... Of course, the djinni you want to change it to isn't the same one as my example...

0200803C = Djinni to battle

020093A8 = Sprite id
020093AA = Flag id

(Quick testing.  Should I do more?)


@02xxxxxx = If you mean this map code file. If you edit with Atrius's editor, it'll compress back into the ROM. (Or you could manually do it, if you make an asm hack where some files can skip the compression.)
« Last Edit: January 08, 2018, 01:11:47 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

I need saves to test encounters in GS Reloaded!

Excellent Member
****

Coins: 0
Offline Offline

Gender: Male
Posts: 850

« Reply #3 on: January 08, 2018, 12:49:16 PM »

Thanks a lot, it worked!

Apparently Chill is flag 0x1F. Strangely enough, setting 0x17 leads to the same enemy encounter but flag 0x17 doesn't make the djinn appear. Also, i didn't know i could edit the decompressed event from within the editor, sweet! I never noticed the code hex window cause this is the first time i need to do something map related.

Do you happen have any tips for the swapping chill with mud? I have no clue on where to start looking for flags on the world map.

EDIT: Obviously i wanted to say that i set the encounter to 0x1F and the flag to 0x4F. The strange point is that encounter 0x1F and 0x17 are the same djinn but flag 0x47 doesn't make the djinn appear. Sorry for the misunderstanding.
« Last Edit: January 08, 2018, 05:17:26 PM by Caledor » Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 0
Offline Offline

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

« Reply #4 on: January 08, 2018, 05:05:50 PM »

Kind of an FYI/trivial thing.... But...... Flag 0x1F and flag 0x17 = = Not really where the Djinn flags are. (Djinn flags start from 0x30+...) But I'm guessing it is a slight mis-understanding of what I meant. :P That's alright though. "Flags" refers to the 1-bit table at 02000040/Same flags seen in Flag Menu. ; When a flag is on, it means the Djinni was retrieved, so it disappears from the map. - If it doesn't reference the bit table, (Being, not in the (0x30+ Djinn flags), I'd just call it Djinni id or something similar.

--
Now that the trivial part is out of the way....

I expect it is done the same way.

02030004 = Pointer to NPC table. (0200E338)
02030010 = Pointer to Events table (0200E7C0)

I scroll through those tables to find what may match.

In the NPC table, we can identify them by their sprite number and flag number. Very easy.

0200E398 = Sprite number. (Set this to 0xF3.)
0200E39A = Flag number (Set this to 0x3A.)

The Events table isn't that difficult either, and it most certainly wasn't difficult in the dungeon.
In the dungeon, it was just two exit events and a Djinni event. (That's all.)
While the dungeon is based on an interaction with an NPC, the world map is not, and is based on tile events. So I guess we can take one extra step. (EDIT:  Although, you could skip this step and go by flag id. But for sake of most events that don't always use flags... this is the way.)
See  020101A4, for the address that points to where we are in the tilemap. (Go to it.) In my example, I have 02020D5C, there, I see 0x035E12E6... Now, what we're interested in is the event number there.... (I bolded it. It is 0x5E) So, we go back to the Event table, and we look for one that matches it.

Found it!
0200E808 = 00000002 004F005E 02008101

I have bolded the event number here, that I connected it to. Now, this is when we look at that last 32-bit. It is a pointer to code that gets executed. Go to it in a disassembler. (Thumb)

There is a bit of code here, I scan for 0x1F for some reason, and see one at 0x02008144, maybe it is the right one? (If not, I can look further.)
« Last Edit: January 08, 2018, 05:21:41 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

I need saves to test encounters in GS Reloaded!

Excellent Member
****

Coins: 0
Offline Offline

Gender: Male
Posts: 850

« Reply #5 on: January 08, 2018, 06:54:13 PM »

Many, many thanks, Fox!

Chill becomes Mud with those changes:
0200E398 = 0xF3
0200E39A = 0x3A
02008144 = 0x0A

There's still a few things I don't understand about those events but for now this will do. I'll come back here whenever i need to make similar tweaks in the future.

EDIT: Also at 0200E808 = 00000002 004F005E 02008101, the 4F becomes 3A
« Last Edit: September 04, 2018, 12:07:14 AM by Caledor » Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 0
Offline Offline

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

« Reply #6 on: January 09, 2018, 02:08:22 PM »

You are welcome.

And yes, that's it!

Not to worry, there are some things I have yet to understand as well. (But it probably wouldn't be that difficult to figure out.)

In both cases (the dungeon and the world map), the same function gets called. (Interesting.)

The arguments are:
r0 = NPC id
r1 = Djinni id

So:
The dungeon is:
r0 = 00000008
r1 = 0000000A

And what I saw that was interesting, was:

The world map had it as:
r0 = 0000080C
r1 = 0000001F

This suggests that the "8" may mean something. (Another thing I haven't learned about/documented! Exciting!) Probably the difference between whether the Djinni was already displayed on the map or not, but I'll need to investigate.

EDIT: The "8" flag means to skip the animation/go straight to battle!



EDIT: Okay. Figured one big thing out!
-The number you put in the event, when a map code function is called....  (BEFORE BATTLE) ... A function puts a number at like 02000494.
-Later, (AFTER BATTLE) This number is taken, and all the NPC init entries are scanned to find a matching flag.
--Value at 02000494 must be from 012C-017B (As an 11-bit... 0800 flag is okay.) Basically matching ability id.
--ONLY FLAGS OF 0x30-0x07F WILL WORK! :) As long as the flag is match with the number put in for the event.
So pretty much, this is how the right entry is found, so you could make it any entry you wanted, as long as the flag id is found, you're good to go.
From there, based on the entry used, it'll look up the respective data in the 02030014 NPC list....
« Last Edit: January 10, 2018, 07:31:36 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

New User


Coins: 1
Offline Offline

Posts: 9

« Reply #7 on: June 28, 2019, 07:57:56 PM »

I'm new to this, so I tried this out for myself. I got the swaps working, but I noticed that after collecting Mud (in Chill's default location), Mud keeps appearing in random battles. Furthermore, if I collect Chill first (in Mud's default location) and go for Mud (in Chill's default location), Mud cannot be found. Am I missing something? I'm not sure the flag's are enough for the overworld.

I've been trying to swap djinn in Golden Sun, and I have the same problem with overworld encounters there too (Vine, Corona and Hail).
Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 0
Offline Offline

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

« Reply #8 on: June 30, 2019, 08:26:43 AM »

Most likely.
I know you do need to edit in more than one place per Djinni.

I think it was something like this. (Several places Flag IDs are located that may be relevant.)
-Event table data (See 0200E7C0 list) - Responsible for reading/checking the flag before allowing Event to be executed.
-The code calling the Djinni function with the NPC ID and Djinni ID arguments. (Event table has function pointers, so reading those helps.) - I think mostly responsible for setting the flag.
-The NPC data itself. (See 0200E338 list.)

You can always post a patch, or say the exact edits you made, and I could check it out. = Patch is best way so we can spot things like typos/etc. (Everyone makes them from time to time, including me.)
« Last Edit: June 30, 2019, 08:48: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

New User


Coins: 1
Offline Offline

Posts: 9

« Reply #9 on: June 30, 2019, 09:24:50 AM »

Thanks. I'll look into those. I'm still learning to make patches, plus I'm still cleaning up some other stuff. Best I hold off on the patch. Regardless, changing the address just using the editor resulted in the same problems. Here are the GS1 addresses I change:

Vine:
0x0200db84 Sprite
0x0200db86 Flag
0x02008064 Battle

Corona:
0x0200db9c Sprite
0x0200db9e Flag
0x020080b2 Battle

Hail:
0x0200dbb4 Sprite
0x0200dbb6 Flag
0x020080fa Battle

If you have any advice for Fizz, that would also help. I have no clue where to start. The Flint sprite is 0x200e3f8, with the flag right after. His event continues even after another djinn joins, but presumably other overworld fixes can help with that.

The other 23 djinn work well.
Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 0
Offline Offline

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

« Reply #10 on: July 01, 2019, 03:38:57 AM »

You missed the Event Table.


Vine:

Sprite/object table:
0x0200db84 Sprite
0x0200db86 Flag

Event Code:
0x02008064 Battle

Event Table (Flag checked before calling the Event's Code.)
Event table at 0200E3F4 for World Map.
@0200E430 entry > Change 0200E436 to whatever you put in 0200DB86. (And do the same for the others.)


Fizz'll probably be easy - just need to look at Mia joining event. (If that is where it is added.) - I may need to check.

Edit: Found it. Go to the map where Mia joins your party. (54)

See 0200CBD8 in VBA's Disassemble....

0200CBD8 = Element of Djinni (0=Venus, 1=Mercury, 2=Mars, 3=Jupiter)
0200CBDA = Djinni #
0200CBDC = PC added to. (In this case, 3 means Mia.)

0200CBE2/0200CBE4/0200CBE6 = Same thing as above, but used to set the Djinni.
« Last Edit: July 01, 2019, 04:12:56 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

New User


Coins: 1
Offline Offline

Posts: 9

« Reply #11 on: July 01, 2019, 04:13:22 AM »

Thanks! I'm still wrapping my head around all this stuff, but these examples will help a lot.

Interesting thing about Flint I found today. His sprite is determined by the djinn in Vine's location.
Logged
View Profile

New User


Coins: 1
Offline Offline

Posts: 9

« Reply #12 on: July 01, 2019, 09:42:38 AM »

Seems like everything is working now: Fizz, Vine, Corona and Hail. Plus all your help helped me figure out Flint:

Sprite:
0x0200db84 (same as Vine's)

Battle demo:
02009d1e (element)
02009e20 (djinn)
0x2009d28 (element)
0x2009d2a (djinn)

Join party:
0200a214 (element)
0200a216 (djinn)

Flags:
0x200e3fa
0x2008254

Thanks so much Fox!
« Last Edit: July 01, 2019, 10:05:58 AM by marvin » Logged
View Profile
Pages: [1]   Go Up
  Print  
 
Jump to:  

Cbox
November 14, 2019, 01:50:02 PM
Fox: So like... a layers offset might normally be located at +0xC, but in Tennis, it is at +0x10)
November 14, 2019, 01:48:51 PM
Fox: (Talking about the data in map header thingy.)
November 14, 2019, 01:48:10 PM
Fox: So took a look at Tennis.... Seems Atrius's editor displays all maps incorrectly because he forgot that some stuff was offsetted by 4 (You know with everything from layer offsets and files/etc.)  Fix that, and it seems to display properly. Hm.
November 14, 2019, 06:18:29 AM
Fox: That is a quote I found somewhere. How amusing. xD
November 14, 2019, 06:18:06 AM
Fox: only canadians give up dont be a canadian
November 11, 2019, 03:27:02 AM
Salanewt: Especially since there might be a v0.5.1.1 in the near future, if any bugs are found by people playing the demo.
November 11, 2019, 03:26:38 AM
Salanewt: Oh yeah, so for people who aren't aware; v0.5.1 of the AI Overhaul is available on the Discord, but I'm delaying the creation of a downloads page + topic until I finish the demo.
November 02, 2019, 12:05:31 PM
Fox: And yeah, there's a topic for the Discord. in News & Announcements (http://forum.goldensunhacking.net/index.php?topic=2831.0)
November 02, 2019, 11:55:00 AM
Fox: Went to go study some German a little earlier. (Using duolingo to give it a try.) ... And. Huh. German capitalizes all nouns? (Not necessarily pronouns, though.)
November 01, 2019, 07:49:25 AM
thenightsshadow: Didn't realize there was a Discord at all.
October 31, 2019, 07:22:02 AM
Fox: (Which I guess not having Special badges in inventory was by purpose.... So I'll ifnore that bit. Just whats with the dup Halloween badge in inv?)
October 31, 2019, 07:18:26 AM
Fox: Question about badges = Why do I have two of the same Halloween badge in my inventory... but not on my profile? And by two, I mean the Honk badge is not there.
October 31, 2019, 06:56:26 AM
Fox: Does tns want to join the most active part of GSHC? - Its Discord? :D  And welcome back!
October 31, 2019, 06:52:17 AM
Fox: (Ofcourse it would be capitalized if it were the name of a system, and anytime that system would be referenced... but I'm more going with why we *never* see Psynergy and Djinni not capitalized.)
October 31, 2019, 06:49:58 AM
thenightsshadow: Yeah, just kinda got an email out of nowhere and it reminded me.
October 31, 2019, 06:42:40 AM
Fox: and main reason I said "not intended to become part of English" ... was because I thought of words like "animals"... and they can technically still be lowercase at times.
October 31, 2019, 06:41:17 AM
Fox: group/type/thing/whatever
October 31, 2019, 06:38:54 AM
Fox: Not saying it is exacly that... but it is a thought, at least.
October 31, 2019, 06:36:41 AM
Fox: I mean like... when you're naming a person... the object of the game is to make up a name... (Although, I think capitalization is more for formality.) ... so... when you're coming up with a name like Psynergy or Djinni, I figure it is a similar approach. Just more for a group rather than a single being.
October 31, 2019, 06:30:01 AM
Fox: "part"..... but that too, I guess. Also, there may be scenarios where item and status are lowercase.

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.151 seconds with 23 queries.