øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=printpage;topic=2046.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index79a1-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=2046.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index79a1-2.html.zxô.h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ@&BQmOKtext/htmlISO-8859-1gzip@øÕQmÿÿÿÿÿÿÿÿWed, 11 Mar 2020 00:37:33 GMT0ó°° ®0®P®€§²ð®ô.h^„Qm Print Page - New patch: Zombie/Rippler Bug fix

Board of Slick

Banon's Donkey Farm => Game Modification Station => Topic started by: 13375K31C43R on May 10, 2015, 11:02:44 PM

Title: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on May 10, 2015, 11:02:44 PM
Hi! So, even though I downloaded Terii Senshi's Rippler fix patch, assassin pointed out a bug concerning the Zombie status that wasn't fixed by the patch like I thought. Terii Senshi's patch prevents Rippler from exchanging statuses such as Morph and Dog Block, but I assumed it also prevented the Zombie status from being exchanged. It turns out that Zombie being exchanged is intended; the problem is that Rippler does nothing to handle the former Zombie, now alive, but still having 0 HP.

The included patches remedy this by adding a call to a new healing function that only heals an entity if the entity is either the caster or the target of Rippler AND the entity has 0 HP AND the other entity involved in Rippler does not have 0 HP. There are two different healing algorithms used, with a separate patch for each; the first algorithm transfers all HP from the former non-Zombie to the former Zombie, and the second restores 1/8 of the former Zombie's HP. The included reverse patch is applicable to either fix patch.

Personally, I'm not sure if either algorithm is the "correct" algorithm to apply for correcting the 0 HP problem in this case. On the one hand, algorithm A seems more realistic because, viewing the Zombie status as a state of "lifelessness", it makes sense that the same exchange of "lifelessness" would also exchange "life" by extension. On the other hand, algorithm B is more rational because it's the same algorithm as the Revivify item, the only other method of curing Zombie status.

Both patches also apply the same improved Rippler algorithm seen in Terii Senshi's patch (with appropriate modifications to accommodate the healing algorithm). In other words, I only recommend downloading Terii Senshi's patch if you're one of the rare few who care about Rippler mishandling Morph and Dog Block but not Zombie. All patches use free space bytes C2/65BE-C2/65CE, but patch B also uses bytes C2/65CF-C2/65D5.

UPDATE: I've now attached a third fix algorithm, which sets the former Zombie's HP to 1. It can be reversed using the same reverse patch.

UPDATE 2 (August 2, 2015): I've just found and fixed a potential logical issue with fix B, whereby if someone with the wrong number of max HP gets healed, it might possibly screw up the Rippler function. I don't know if it's really a problem, but this fixed version now ensures that it isn't. It also cuts down on the free space used.

UPDATE 3: I've now included a patch for a Japanese ROM.

UPDATE 4: Found a bug! The status exchange algorithm only worked halfway in the previous versions! This is now fixed. Also, I've done some shrinking of the B and C patches. Now in order to apply your desired fix algorithm, you'll have to apply the A patch and then the appropriate patch. Finally, added patches for GBA!
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: assassin on May 11, 2015, 12:48:23 AM
Quote
C4/736B:   03 -> 02   (Not sure what this byte means, but the same change exists in Terii Senshi's patch.)

that's spell data, done to fix "Rippler missed... but it worked?" , as seen in Master ZED's Glitches & Bugs guide.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on May 11, 2015, 01:01:49 AM
Quote
that's spell data, done to fix "Rippler missed... but it worked?" , as seen in Master ZED's Glitches & Bugs guide.

Yeah, I knew it had to have something to do with Rippler. I figured it was different than the event code I was editing. I could probably have looked it up easily, but I was just too lazy. The bottom line was just, if it's required to fix what Terii Senshi fixed, I'm keeping it.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: assassin on May 11, 2015, 04:39:14 AM
algorithm A has a clever basis that i wouldn't have thought of.  a more involved variant might scale between entities by not transferring absolute HP, but percentage of total HP.  that would stop full-life, low max HP entities from necessarily being a lesser source than depleted-life, high max HP ones.  a departure from Drain, to be sure.  but possibly within the spirit of a spell that normally works on statuses, as opposed to numbers like HP or MP.

probably not worth the space/effort, but just putting it out there.

another approach altogether would be to do the absolute minimum to remove the buggy condition: heal a mere 1 HP.  this would show some deference to Revivify, leaving it as the top dog for healing Zombies.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on May 11, 2015, 11:24:29 AM
I had thought about healing 1 HP, but I decided not to because I figured there wouldn't be enough difference between 1 HP and 0 HP other than "legality". Also, I feel like it would look a little bit unnecessary to actually show the number 1 in the healing process, so I would have actually made the algorithm increment the HP value itself by 1 instead. I actually stopped when I realized I'd have to check for Near Fatal status, which I wasn't sure I could do without breaking the game; the easiest way would be to jump to the place in code that handles it, but in my ROM that's been moved from its usual spot, so I'd have to make an extra patch for that. Although maybe it would have been sufficient to just set Near Fatal status anyway, under the assumption that the entity's max HP is at least 8.

A proportional HP transfer is also a neat idea. For that I'd have to look into how the game handles multiplication and division. It's also plausible that this algorithm would use even more free space than algorithm B, so that's also something to be wary of. The free space used by algorithm B perfectly fits a gap between Imzogelmo's "MP Digits" patch and another patch at C2/65D8.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: assassin on May 11, 2015, 12:29:20 PM
don't think you'd have to check for Near Fatal nor manually change it, since C2/450D is run later than the function you're editing, and it'll use the entity's new HP to update the status.  there are attacks that manually refill HP, such as Tapir, and iirc, Near Fatal gets removed fine.

speaking of which, are you tackling Zombie/Tapir next? :P  if so, a couple things:
- might as well incorporate my (very simple) Deceptive Tapir fix into it, since i suspect the two patches won't co-exist.
- hopefully, it's possible for you to work around my Some MP changes don't update menus fix.
- one of these years, a "Galileo" character will notify you people that I do not revolve around the Earth, but vice versa.  believe him.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on May 11, 2015, 12:58:54 PM
The reason I worry about Near Fatal status is that, when a character is alive with 0 HP, they don't enter Near Fatal status immediately. Eventually, yes they do, but as far as I recall, not until someone else makes some other move. So, for instance, if the former Zombie is next to make a move, a Fight move, and they are no longer a Zombie but are not in Near Fatal status, it removes any chance they have of performing a DA. But I'll test to make sure.

I actually wasn't planning on Zombie/Tapir, I haven't tried fixing it in my own ROM yet. For that, I'd have to actually look into the Tapir function that gets called. For now, I want to address the bugs that I've already mentioned (this one notwithstanding), and then maybe later I'll try fixing Zombie/Tapir.

The next patch I plan to upload is Doom/Jump. And I am aware that it conflicts with Novalia Spirit's Petrified Rebel patch, which I am addressing.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: assassin on May 11, 2015, 01:09:13 PM
ah, that does sound familiar.  but how is that limited to the manually refill HP to 1 method?  wouldn't Algorithms A and B also be susceptible?
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on May 11, 2015, 01:28:35 PM
Like I say, I haven't actually tested adding 1 HP to see if Near Fatal status is set, so I don't know. The algorithms I've actually added don't have this problem because they set the healing variable, rather than the HP variable. When a character's HP is modified through healing or damage, the game updates the Near Fatal status; what I don't know is if the same is true for manually setting HP. I'm pretty sure that even "weakening" spells, such as Cyclonic and W Wind, update Near Fatal status because they damage entities to within an inch of their lives. Remember, I said I would want to implement the 1 HP solution without actually showing the number "1" for healing. I figure that, when Rippler is called, it would look a little strange to occasionally just see a "1" healing an entity, whereas with the other algorithms that heal more than 1 HP, it actually makes it look more like the entity is being healed for a reason.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on May 11, 2015, 01:41:04 PM
Aha! You were right, it did update Near Fatal status! I'll upload a patch as soon as possible.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on May 11, 2015, 02:33:01 PM
So, now I've uploaded Fix C, I'm looking at the Tapir function (or at least the only Tapir function I can find in bank C2), and it looks like all I need to do is change the Sleep check to a Sleep/Zombie check, if I'm not mistaken. The only other stipulation I see is the branch into that function from Pep Up and Elixir/Megalixir. What I don't understand is why they branch to only curing MP, as opposed to curing both HP and MP. If I could change them to branch to curing both HP and MP, I could easily fix Tapir without using any free space.

Also, is that the only Tapir function I need to worry about? I'm pretty sure there's another Tapir function, but its name is not actually seen. I think it's the function that automatically wakes up a sleeping character after a certain period of time. And in that case, I don't think I need to worry about it because, as I recall, its only purpose is to cure Sleep, not HP or MP or any other status.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: assassin on May 11, 2015, 02:47:20 PM
So, now I've uploaded Fix C, I'm looking at the Tapir function (or at least the only Tapir function I can find in bank C2), and it looks like all I need to do is change the Sleep check to a Sleep/Zombie check, if I'm not mistaken.

won't that max out HP and MP?

Quote
The only other stipulation I see is the branch into that function from Pep Up and Elixir/Megalixir. What I don't understand is why they branch to only curing MP, as opposed to curing both HP and MP.

they fill HP using normal attack data (i.e. do 16/16 of HP healing), rather than using a special effect.  they need the effect for MP because normal attacks affect HP or MP, not both.

one distinction versus Tapir's results is you'll see (green) numerals for Pep Up and Elixir/Megalixir.  another is hurting the undead, for Elixir/Megalixir.

Quote
Also, is that the only Tapir function I need to worry about? I'm pretty sure there's another Tapir function, but its name is not actually seen. I think it's the function that automatically wakes up a sleeping character after a certain period of time. And in that case, I don't think I need to worry about it because, as I recall, its only purpose is to cure Sleep, not HP or MP or any other status.

yep, you're correct.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on May 11, 2015, 02:57:13 PM
Quote
won't that max out HP and MP?

True, I was thinking it'd be the easiest way to avoid 0 HP, but I guess curing MP is a little ridiculous.

Quote
they fill HP using normal attack data (i.e. do 16/16 of HP healing), rather than using a special effect.  they need the effect for MP because normal attacks affect HP or MP, not both.

one distinction versus Tapir's results is you'll see (green) numerals for Pep Up and Elixir/Megalixir.  another is hurting the undead, for Elixir/Megalixir.

Ah, gotcha.

Well, then it looks like I can't avoid using up more free space...but hey, I guess that's what it's for.  :sad:
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: Xenovant on June 12, 2015, 10:59:12 AM
Thanks a lot for your patches, I have added most of them to my hack already :P

There are two problems left in rippler, though:

-Terii Senshi's algorithm ignores petrify (I have tested his patch, and yours, in a clean rom).

-When you exchange the zombie status with the enemy, the enemy dies (you'll see him disappear), but it will be still here, and will attack... but it's even worse: it may reappear again when another enemy dies. I think the best "fix" would be ignore the zombie status and leave it in the player, because this status, in the enemies, is a mess xD  EDIT: Or directly kill the enemy...
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on June 12, 2015, 11:12:42 AM
Quote
-Terii Senshi's algorithm ignores petrify (I have tested his patch, and yours, in a clean rom).

According to both Terii Senshi and the Final Fantasy Wikia, Rippler is supposed to ignore Petrify anyway, so I won't concern myself with that.

Quote
-When you exchange the zombie status with the enemy, the enemy dies (you'll see him disappear), but it will be still here, and will attack... but it's even worse: it may reappear again when another enemy dies. I think the best "fix" would be ignore the zombie status and leave it in the player, because this status, in the enemies, is a mess xD  EDIT: Or directly kill the enemy...

That, on the other hand, is interesting. Zombie status is supposed to be swapped, so I won't make the algorithm ignore it, but I'll look into making sure the enemy stays dead. :)
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: Xenovant on June 12, 2015, 11:23:35 AM

According to both Terii Senshi and the Final Fantasy Wikia, Rippler is supposed to ignore Petrify anyway, so I won't concern myself with that.

True (but I don't understand why it should be ignored :P). I guess that I think too much about these things xDD

That, on the other hand, is interesting. Zombie status is supposed to be swapped, so I won't make the algorithm ignore it, but I'll look into making sure the enemy stays dead. :)

Thanks :)
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: assassin on June 12, 2015, 05:10:38 PM
Zombie on monsters being nonsense isn't limited to Rippler.  Sketch and Control/etc can also achieve the status.  Honestly, keeping the enemy visible (ideally, with a changed palette -- not trivial to do) and targetable seems more appropriate, given how Zombie characters behave.  Either way, likely outside the scope of this patch.

Zombification providing invisibility has always struck me as horsecrap, and is well outside established lore on the condition. :P
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on June 12, 2015, 06:02:15 PM
I think the idea is that, since Wound, Petrify and Zombie statuses all count as being "dead" for the purpose of the battle ending, they make the enemy disappear when it attains one of those statuses because then, intuitively, you win the battle when all enemies are gone. I mean, by the same logic, why should enemies disappear when they're KO'd or Petrified? Shouldn't we just apply a palette change in those situations as well? Shouldn't you, or another enemy, be able to target them with Life or Soft? The theory is, no you shouldn't, because you wouldn't want to. By the same token, you shouldn't want to target a Zombified enemy with Revivify, or any attack, so they remove it from the screen. But the oddity there is that, even though you can't see the enemy, it can still attack you.

The idea here, in my opinion, is that all forms of death are treated the same with enemies, in contrast to your party members, where they all mean different things. Petrified and Zombified both mean your party members can still be targeted for attacks, but won't take any damage, while Wound means your party member can't be targeted for attacks at all. For an enemy, all three mean the enemy can't be targeted for attacks, but the ridiculousness, as Xenovant puts it, is that the enemy can still target you.

Right now I'm looking for the code that prevents monsters from taking any action while dead. Assassin, you wrote the documentation on bank C2...maybe you could help me out here.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on June 13, 2015, 02:54:28 AM
After hours of thinking, I came up with this code (attached) to try and solve this issue. However, after applying the changes to my ROM (don't worry, I have a backup), I've found that only one of my characters' ATB gauges is filling.

Basically, what I've done is optimized the code to grab all of the called functions from a list and call them in a loop.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: assassin on June 13, 2015, 04:06:49 AM
Put a LSR before "ROR $3204,X".

also, you fail to preserve Y in your loop.

that said, nice loop optimization.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on June 13, 2015, 11:25:47 AM
Quote
Put a LSR before "ROR $3204,X".

LSR on what? On the accumulator? On $3204,X? See, the idea with ROR $3204,X is that bit 0 will be evaluated first instead of bit 7. I'm not sure what purpose adding an LSR will have.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: assassin on June 13, 2015, 07:12:46 PM
- the "LSR" is a complete instruction.
- its purpose is to stop garbage from getting in Bit 7 of $3204,X.

you're confused on how ROR works.  a great reference:
http://wiki.nesdev.com/w/images/7/76/Programmanual.pdf
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on June 13, 2015, 10:53:49 PM
Oh, OK. Thanks for the info. That said, I'm still seeing too many problems with the current approach, so I'm abandoning it in favour of a simpler one.
Title: Re: New patch: Zombie/Rippler Bug fix
Post by: 13375K31C43R on March 03, 2018, 12:25:35 AM
:bump: Bug fix, plus GBA port! Also, note the change in the B and C patches.