Aslickproductions.org/forum/index.php?PHPSESSID=b2phq0ehqc7umand281jipqej2&topic=1939.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index216d-2.htmlslickproductions.org/forum/index.php?board=13.140e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index216d-2.html.zx2g^OKtext/htmlISO-8859-1gzip8:Tue, 10 Mar 2020 06:41:11 GMT0 0P2g^) Random Chocobo Encounters

Author Topic: Random Chocobo Encounters  (Read 1844 times)

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Random Chocobo Encounters
« on: May 27, 2014, 05:17:53 PM »
Yes - I am really planning on making this possible!

It's going to take a while, but I think I have all the necessary info.

The research I did on affecting which Encounter Set is picked based on event flags led me to wonder what else I can do just before a battle begins. It was surprisingly easy, but I found out that I can:
1) make an event call happen just before a battle, and
2) skip the battle entirely (which can be done based on various conditions in RAM, say, event flags...)

I don't have the whole thing worked out yet, but this should be enough knowledge to do it.

For a little proof of concept, try this code out (you may notice it starts out similarly to my "Encounter Set based on Flags" code):
Code: [Select]
$00/8994 4C 31 FD    JMP $FD31  [$00:FD31]  ;Jump to custom code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$00/FD31 5A          PHY    ;Save Register Y, in case it's important                 
$00/FD32 A9 FB       LDA #$FB                ;Load FB ("Sight" event call) into A
$00/FD34 20 63 DF    JSR $DF63  [$00:DF63]    ;Jump to event execution subroutine
$00/FD37 A9 00       LDA #$00                ;Leftover from an earlier experiment, in which encounter set 00 was selected - of no importance here
$00/FD39 FA          PLX                     
$00/FD3A 7A          PLY                     
$00/FD3B 5A          PHY                      ;Get registers X and Y exactly where they would be if a battle was about to begin
$00/FD3C 4C B2 80    JMP $80B2  [$00:80B2]    ;Jump to exactly where you would be in code immediately after the end of the battle

Plug this into your ROM and walk around in the Overworld (must be on the Overworld map, no other encounters will be affected). Pretty soon, you'll see the map zoom out like you just casted sight, then press your A-button to zoom back in, then feel free to walk around some more! You'll never encounter any enemies in the Overworld, instead the game will just cast Sight. But, walk around in the Underworld, or in a cave, or wherever else, and battles will proceed as normal.
 :laugh:

So... The plan:
The instructions I'll be coding will look like this (in plain English):
1) Check to see if we're walking in Forest
2) If so, 50% chance the following happens
3) (via event) Engage battle with chocobo
4) (This is where I'll have to figure things out a bit still) Somehow, work in battle conditions that allow for a nonviolent end to this chocobo battle, and assuming this is done, set some otherwise unused event flag (using a custom command that will be used exclusively by the chocobo)
5) (after the chocobo battle ends) check if aforementioned event flag is set, if so, do the following
6) (via event) Mount chocobo
7) (and whether the chocobo was mounted or defeated) Skip the battle

There's still quite a bit of coding to get done here, but I can't see any reason why this won't work.

This will be complicated enough that I'll be posting a patch when it's all said and done, and I'll try to keep you posted on the progress.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Random Chocobo Encounters
« Reply #1 on: May 29, 2014, 12:29:52 PM »
So I got a version of the plan up and running.
It doesn't work exactly as planned, but it does work...

So this is what will happen:
When the conditions are met for a Chocobo battle (that is, if you're in the forest and the randomization returns true), the screen will go black for a brief moment, then you'll enter a battle with three Imps and a Chocobo (chocobo forest music will play in the background).



The Imps are regular Imps and the Chocobo is, well, he's basically invincible. He has the max possible HP, and his defense and magic defense are 255. If you attack the chocobo, it will counter attack, which will likely kill the offending party member.



If you kill the three Imps, then the Chocobo will say "Kweeh!!!" and the battle will end.



The screen will go black for a moment again, except it will say "A Chocobo!" at the top of the screen.


This screen only lasts about half a second, but is absolutely necessary. I'll explain later.

Then the world map will reload and you'll have a chocobo!



So why does it happen this way, and not exactly as I originally planned?
Well it turns out that if you cue a battle event the way I had planned, the game has no idea which map to load afterward. The implication of this fact was that the only possible outcomes of the chocobattle would be dying or catching a chocobo. So instead of a "scaredy" chocobo, like in FFVII, you get an "ass-kicking" chocobo who will kill you if you don't catch him.
But then the next problem arose...
Did you ever notice that, no matter which chocobo forest you enter, the game knows where to put you when you mount the chocobo? Well, that's because the game stores (somewhere) in RAM the x,y location on the world map of the last cave/town/chocobo forest, etc that you entered. When you mount a chocobo, that's how it knows where to put you.
So the problem I ran into was, after the chocobattle was over, I'd be riding my chocobo starting from Fabul - because that was the last location I entered - instead of wherever the battle took place.
The solution - the Chocobattle event begins with loading the "Black castle background" map, effectively entering a location, then the battle begins. I had to change the location name of black castle background to "A Chocobo!" so that the displayed message would have relevance.

Of course, now that I'm typing this out, I'm having a brainstorm... What if I can just find the place in RAM where the Overworld x,y is stored?
 :hmm:

... Another update coming soon!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Random Chocobo Encounters
« Reply #2 on: May 29, 2014, 04:36:46 PM »
OK, here it is.

I wasn't able to eliminate the black screen, but it's so brief that I don't find it offensive at all.

Apply this patch to a clean FFIIUS v1.1 ROM. Beware, I edited events (and monsters) using FF4kster, so it will screw up your hack if you apply it to an already edited ROM.

Essentially, if you're walking around in forest (has to be center forest tile - no edges or corners), you'll have a 25% chance of getting the chocobo encounter.

The only other difference you'll find is that I eliminated one of the Bahamut cave Behemoth battles in order to include the chocobo encounter event.

Have fun with this - let me know what you think!

For my own hack, I plan on using this and eliminating most of the Chocobo forests altogether (probably will be something about the power of the crystals having sustained the chocobo sanctuaries). This will give me the flexibility to add more location triggers to the Overworld map!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Random Chocobo Encounters
« Reply #3 on: May 30, 2014, 01:29:56 AM »
Wow! This goes beyond anything I ever even considered! What a neat and interesting ideas. If there are special little caves or what have you that can only be reached with Chocobo's then this can have quite a unique effect on that aspect. Well done!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Random Chocobo Encounters
« Reply #4 on: May 30, 2014, 11:50:13 AM »
Exactly! I can't wait to cook up sidequests.

So have you tried it? What do you think of the black screen?
Should I work to eliminate it or is that wasted effort?

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Random Chocobo Encounters
« Reply #5 on: May 31, 2014, 08:59:19 AM »
I think the black screen is a minor issue at best, I wouldn't worry about it at all. It's not like a "loading" screen or anything like that, hehe.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Random Chocobo Encounters
« Reply #6 on: May 31, 2014, 09:17:24 AM »
I changed the map name index to 80, so now you get a plain black screen, which I think I prefer. I'll stick with that and move on with my life.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Random Chocobo Encounters
« Reply #7 on: May 31, 2014, 09:57:03 AM »
Well, OK, if you know how I work, then you know I can't just leave well enough alone, so I revised the mod ever so slightly. Now, when the chocobattle is over, you are given the option to ride the chocobo or not. Say Yes, and you'll be riding the chocobo. Say No and you won't (duh).

Serves a dual purpose: 1) gives gameplay purpose to the black screen, 2) maybe you weren't looking to ride a chocobo.

Also, as this is something I was planning anyway, there is a White Chocobo "enemy" now. I haven't added it to any of the monster formations, but you can try it out if you want. In most cases, it will do nothing but run away if you attack it. If DK Cecil (this was just for testing purposes, in my hack it will be Kella, the Blue Mage) attacks it (using Fight), though, it will heal the MP of a random party member.

Anyway, the original patch is still above, but here's the revision.
« Last Edit: February 17, 2015, 10:17:04 AM by chillyfeez »

koala_knight

  • Tunnel Armor
  • *
  • Posts: 166
  • Gender: Male
    • View Profile
Re: Random Chocobo Encounters
« Reply #8 on: May 31, 2014, 01:27:55 PM »
This is a pretty cool hack. I'm curious about one thing though. Could you change the trigger for the White Chocobo?
What I was thinking the White Chocobo could instead restored the entire party's MP after using, say, a Gysahl Green on it.
That would both make it more convenient for the player and give the Gysahl Green more utility.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Random Chocobo Encounters
« Reply #9 on: May 31, 2014, 03:53:22 PM »
Unfortunately, no.

I mean, you can change the trigger, but not to be when the [carrot], specifically, is used. Reactions can trigger by an action by a specific character, or an action of a specific element, but not a specific spell or item. Also, I don't think the carrot can be used in battle...

koala_knight

  • Tunnel Armor
  • *
  • Posts: 166
  • Gender: Male
    • View Profile
Re: Random Chocobo Encounters
« Reply #10 on: June 01, 2014, 04:22:38 PM »
Yeah, I was assuming my idea would require that the carrot  be given a battle effect.
Hmmm... This is one of those times that having an unused element type would be convenient.
Or at least one that isn't used much. Then I would give that element to a specific spell or item effect.
Then assuming that giving that element doesn't mess with anything else it would make a viable work around.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Random Chocobo Encounters
« Reply #11 on: June 01, 2014, 09:32:07 PM »
I think Grimoire LD discovered that you can treat "absorb" as an element as long as it's not paired with another (real) element... But I'm not positive that can be used for a reaction... I seem to recall reaction element bytes working differently than attack/defense element bytes (but I could be wrong - it's been a while).