Language…
14 users online:  bebn legg,  DonWafle, fleedle_deedle, Hayashi Neru, Heitor Porfirio, IkeSMB, JackBooWow248, NintendoKing3, Retr0_Dave, RZRider,  Teows, tjb0607, Tulip Time Scholarship Games, Zatara - Guests: 867 - Bots: 195
Users: 65,099 (2,284 active)
Latest user: Joaolucca

Enemy HP Meter


After the rejection of my Boss HP meter generator/uberasm code, the user who removed it recommends me to do a patch instead:

Originally posted by Von Fahrenheit
My suggestion is to turn it into a patch that automatically checks for certain boss sprites or something.


This gets me an idea on creating an HP meter for other enemies too, much like Kirby & the Amazing Mirror. During development and testing, I ran to a big fat error Nintendo programmed smw:

Any bosses and enemies that can take damage (not necessary kill) by fireball and stomping are "inconsistent". No, I'm not talking that "they count up starting at 0, and dies a specific value is weird". It is that they take the same amount of damage from both, and that they die when the damage counter reaches either of the two values that kills them depending on what type of damage. This applies to Chargin chuck (all types) and Morton, Ludwig and Roy. They all have a value 3 that kills them when stomped. Chargin chuck have a value of 5 for fireballs (within the fireball routine $02A0AC, labeled as "ProcessFireball" in smwdisc), and for Morton, Ludwig and Roy, it is 12 (code at $01D3FE).

This means that the quickest way to kill an enemy as fireball mario is to first shoot 2 fireballs, and then stomp on them. As enemies do not get "stunned" from fireball damage.

So This patch fixes it by having it set up so that there are only one value needed to kill the enemy:

Chargin Chuck: >= 15 to kill, Stomp deals 5, fireball deals 3.
3 Koopalings: >= 12 to kill, stomp deals 4, fireball deals 1.

After fixing Nintendo's mistakes, I notice various bosses such as Morton, Lemmy, Ludwig, Wendy, and the Big Boo boss have a "delay" damage, as in, when dealing damage, the damage counter does not change until they change sprite state, which a few seconds later. My patch hijacks that and moves the "update hit counter" to where in the code plays SFX when the boss is taking stomp hits (Big Boo Boss' SFX located at $038233, damage when changing state: $03819B, Wendy/Lemmy's SFX is at $03CECB, their damage is at $03CE13, and Morton/Ludwig/Roy's sfx is at $01D3AB, damage is at $01CFC6).

Do note that the patch does not reverse the damage counter to count down each hit, it subtracts the "hits killing value" by "damage taken" to get "remaining hits left", which is HP before writing it to FreeRAM.

About the patch/uberasm code:

This is useful if you are going to use Enemies that most of the time takes more hits than 1 to kill. It is also useful if you are using a "dual boss" in a 1 vs 2 arena like the two hands boss from again, Kirby & the Amazing Mirror, as the HP meter can switch between the two.

Download BETA

Do note that only these enemies show their HP meter:
Chargin chuck
All bosses except Iggy and Larry, Bowser.
Give thanks to RPG hacker for working on Asar.
You can also use this for custom sprites too, if you wish (requires ASM editing, ESPICALLY with fireballs)
Give thanks to RPG hacker for working on Asar.
Originally posted by GreenHammerBro

Chargin Chuck: >= 15 to kill, Stomp deals 5, fireball deals 3.


I think Stomp dealing 6 would work better in all honesty. It would still take 3 stomps to KO, abd 5 fire-balls to KO, but this way, things are more likely to result in round numbers.
could you please edit this such that one can easily edit defines at the top of the patch to change the damage and hp counts of all the included enemies, add an option to disable the visual hp bar, and make it easily combine-able with the projectile power ups in the LX5 power up patch.
"Easily" is impossible, to edit this patch in any way requires one to have some form of ASM knowledge. Plus knowing GHB's coding... I don't think such a request is going to happen. You're best asking around in #asm on Discord for help on how to edit the patch the way you want to.