[Tutorial] [Fire Red]: Extending The Number Of Safe Flags And Variables

Notices

Welcome to the PokéCommunity!

Hi there! Thanks for visiting PokéCommunity. We’re a group of Pokémon fans dedicated to providing the best place on the Internet for discussing ideas and sharing fan-made content. Welcome! We’re glad you’re here.

In order to join our community we need you to create an account with us. Doing so will allow you to make posts, submit and view fan art and fan fiction, download fan-made games, and much more. It’s quick and easy; just click here and follow the instructions.

PGM is all set for February. This month, we're playing through a game known as Eevee's Tile Trial. If you wish to earn rewards, please head over to our event thread by clicking on the provided link and give yourself a shot at the game!

Hey Unregistered! How fast can you game? The Marathon II is up and running in Video Game's - compete against your friends to see how quickly you can complete sixty intense in-game challenges. See you there!

Then you have messed something up. Both PJBottomz and I have tested the var routine that is here, and it works exactly as intended. There is also the simple fact that it is virtually identical to the system in Liquid Crystal where it works perfectly too.

__________________

Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!

Actually Jambo, I hate to be the devil's advocate, but I tested the hack again and it screwed up movement commands and the hidesprite/showsprite commands. I'll compare the hex code in LC and the one that gets created when assembling the version itt and see if they match. Maybe that'll shed some light on the issue. I can't find the var hack code anywhere in the current LC beta. Are you positive they actually inserted it?

__________________

at some point I must have liked that you look like a taco addict who's had one too many back alley liposuctions

Huh. Well then... something happened during the transition from LC to this topic that causes the code to screw up. Maybe changing the length of the memory used or the number of vars did something wrong, or maybe it's overwriting the code at a wrong offset. When I looked at LC's hex, there were no changes to the code at the offset 0x6E45C. Maybe it's supposed to go somewhere else?

__________________

at some point I must have liked that you look like a taco addict who's had one too many back alley liposuctions

I just checked it, and there's no differences that could cause problems, except perhaps an oddity where vars lower than 0x4000 would get processed as normal vars. I added extra code to deal with such variables, but those shouldn't cause issues ANYWAY.

Otherwise, all vars are being dealt with exactly as the should, on a logical level, and I checked. LC does have those changes at exactly 0x6E45C, so whichever version you were checking on is, evidently, very outdated.

__________________

Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!

Ah, okay, this one has changes. Here's my findings and the comparisons between the hack in a regular FR and in LC. Differences, Pointers.

At 0x6E45C:

Code:

Liquid Crystal
02 48 00 47 04 D8 00 20 58 E0 00 00 79 AD 7B 08

Code:

FireRed
00 48 00 47 01 00 80 08

Clearly, there are noticeable differences. I'm guessing the length of the code in LC has to do with the number of variables? Either way, it still works. When I replace the data at 0x6E45C, I usually notice that the code never hits the 08 in the original game's hex. Meaning, the original code is the exact length of LC's code and the one in the post never gets to the ending 08 byte - it's only halfway there.

Here, the differences are less noticeable. One thing I did see was that the code after the DB bytes tended to get out of line after ~the third DB. I'll contribute the length of the entire code and possibly the misalignment to less variables again, but it seems like there's stuff in LC's code that wasn't in the one we're getting.

__________________

at some point I must have liked that you look like a taco addict who's had one too many back alley liposuctions

This version has MORE code, as opposed to less. I simply dealt with the upper limit in a different manner in this version by comparison to LC's. It's functionally identical.

Furthermore, the 2 branches are functionally identical, the only difference being where the pointer gets loaded from.

I know you're trying to help me find the errors, and I appreciate that, however, comparing hex code won't help you find errors. Most of the differences are down to minor changes with regards to registers and how I dealt with the upper limit.

I DID however, give you the wrong memory address for it to read from, which probably didn't help (Latest version of the var code only). I've updated the error in the var code.

__________________

Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!

The "newline" thing usually isn't a problem, it'll just insert a newline (which doesn't affect anything). I don't know why it says "text" is a bad command though. It was my understanding that that starts off every ASM code.

__________________

at some point I must have liked that you look like a taco addict who's had one too many back alley liposuctions

True, but when it works for myself, Linkandzelda and him/her, it does imply that the code is sound, and you are simply messing something up. That said, I have no idea how you could mess it up, especially given that you posted precisely HOW to actually insert the ASM.

Are you sure you're using BPRE 1.0? That's the only thing I can think of which could cause the errors you're getting.

__________________

Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!

There are 2 dead giveaways that you're using FR 1.0. The first is indeed the lack of a presents thing on the Game Freak screen. The second is that Pokédex entries with a space in the species descriptor ("Tiny Bird Pokémon" for Pidgey for example) stop with the space, instead of ending when they should (So it would read "Tiny Pokémon" for Pidgey).

I honestly have no idea why this won't work for you, but I can assure you, I tested the code and it works exactly as intended.

You have used the patch for (or otherwise installed) JPAN's save block extension, right?

__________________

Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!

True, but when it works for myself, Linkandzelda and him/her, it does imply that the code is sound, and you are simply messing something up. That said, I have no idea how you could mess it up, especially given that you posted precisely HOW to actually insert the ASM.

Are you sure you're using BPRE 1.0? That's the only thing I can think of which could cause the errors you're getting.

Count me in aswell. I initially had problems with the very original Var hack, but the most recent one works 100%. I added it to both a blank rom first, and then my actual hack, which has quite a few routines and things in and it still worked fine.

That being said I haven't tried setting any of the vars yet. But the game runs and I can move fine. I'll update this message once I start setting the vars.

EDIT: I've used vars 5000, 5001 and 5002 setting them to different values up to 0x8 and have experienced NO problems.

EDIT2: One thing I have noticed though. Is that with the Flag Hack, a few of the flags aren't working. In the sense that I give them to NPCs, and after the flags are set the NPCs are still visible. So far I've been using flags from 900-915 and the flags that don't correctly turn off NPCs are
901, 903, 904, 906, 907, 90F, 910. These are the ones I know of. Has anyone else been experiencing problems with setting these newer flags?

EDIT3: With further inspection it seems that the range actually seems to be 900-907

EDIT2: One thing I have noticed though. Is that with the Flag Hack, a few of the flags aren't working. In the sense that I give them to NPCs, and after the flags are set the NPCs are still visible. So far I've been using flags from 900-915 and the flags that don't correctly turn off NPCs are
901, 903, 904, 906, 907, 90F, 910. These are the ones I know of. Has anyone else been experiencing problems with setting these newer flags?

Interessant. I can't think of any good reason for this to be the case. Perhaps the flag decrypter isn't used when checking NPC flags? Seems exceedingly unlikely, but possible nonetheless. I shall investigate and see what I can discover.

__________________

Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!

Interessant. I can't think of any good reason for this to be the case. Perhaps the flag decrypter isn't used when checking NPC flags? Seems exceedingly unlikely, but possible nonetheless. I shall investigate and see what I can discover.

Thanks! To be honest I would blame my scripting first, but I redid scripts which used both hidesprite and setting the relevant flag in the person ID. It would then re-appear after walking away. I'v eeven tried setting it several times in seperate scripts. I also checked the memory viewer at 203C000 and everything was still 00's. If a flag is set should it look any different in the memory viewer? I don't think it's an issue with the patch or the code itself because most of the vars and flags work, and from what I can tell haven't damaged things that were in that range.

The PokéCommunity

Meta

Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, or The Pokémon Company International. We just love Pokémon.