[FE8] Several questions on various things (some ASM, mostly mechanical)

I’ve been hacking FE8 lately trying to teach myself the basics, but there’s a few questions I had where I’m not too sure how to proceed.

My first question is related to the “Luna” effect; I had read at some point while browsing for information that it was possible to make certain enemies immune to this effect. I’m not sure where I would really begin with something like this however; would it require ASM or can it be done with a simpler method? Unfortunately my memory of the topic is hazy at best, and I couldn’t seem to find it again when I went back to reference it.

The second thing I wanted to ask relates to the “Magic Sword” type weapons in the game. Mostly, I’d just like to know a little bit more about they function, and if it would be possible to implement similar routines on new items to create weapons with unique effects. Specifically, I’m referring to the part that makes them deal STR/2 +MT Damage at a range. Because this effect seems to be tied to the item slot rather than strictly weapon ability, could you rewrite the routine to check for more items which would in turn lead to various different results, or is it hard-coded to only accept the default magic-swords? If not couldn’t you, for example, create a spell that always does X damage, or (since there is already a component that checks range) a bow with high range that loses accuracy the further you are from the target, similar to status staves?

This third one is a bit far-fetched and I’m thinking “no” but would like confirmation anyways. Would it be possible to deal a portion of damage dealt back to the attacker? Sort of like recoil attacks in Pokemon. For example, Mage A uses Elfire on Fighter B and deals 20 damage, but because Elfire is set to deal 50% back to the user, Mage A takes 10 damage (non-lethal) in return. It’s worth mentioning the damage would be applied after the battle, since I don’t think it would be possible to do something like that mid-battle on GBA. Alternatively, it could function like it does in Fates. In that game, when you attack with certain weapons (Ganglari comes to mind), the attacker suffers a fixed percentage of (non-lethal) damage after the battle scene. Bonus points if it can kill a unit whose HP=1.

This fourth one is more of a yes or no really; since we have weapons that cannot be countered, is it also possible to have weapons that cannot counter-attack?

Finally, I’ve been trying to modify Venno’s Passive Stat-Boost hack so that it can be a bit more flexible when determining boosts. Here is what I’m trying to do specifically, but the short version is that I want to create “item slots” that would strictly be used for passive boost items. These “slots” would only for one boosting item per “slot.” As the hack stands, it will load one boost for each stat, meaning that if I have Item A that boosts DEF by 4 and Item B that boosts RES by 2, my total boosts will be +4 DEF +2 RES.

I have modified the hack in such a way that in the above scenario, I only receive boosts from the first item in a units inventory. For example:

Iron Sword -> Item A -> Item B = +4 DEF only
Iron Sword -> Item B -> Item A = +2 RES only

This is exactly what I want, but I’d like to take it one step further and that’s where I’m having some trouble. Let’s say we have another item, Item C. Item C boosts SPD by 2 points. Ideally, I’d like a system where

Iron Sword -> Item A -> Item B -> Item C = +4 DEF +2 SPD
Iron Sword -> Item C -> Item A -> Item B = +4 DEF +2 SPD
Iron Sword -> Item C -> Item C = +2 SPD

but when I try to add another routine that would check for Item C, I get some pretty disappointing results. The most common outcome is that no boosts are loaded whatsoever. I did have a version that recognized both Item A and Item C (set to load from different ability bytes), though it operated like in my first example rather than my second. Unfortunately, I seem to have lost that version in my haste to get things working. I have a few different theories on why it’s not working, but it’s difficult to explain without the modified source to use as reference. I’m on a different computer atm but I will post the modified source later because I’m currently stumped on where to go.

Any and all answers to these questions are greatly appreciated! Even if it’s just “no” lol.

EDIT: Also, does anyone know why the passive boosts hack isn’t compatible with CON and MOV? I imagine it’s because of how the Nightmare modules are set up but I’d like to know if there’s something else going on before I try to add that in there.

1 Like

My first question is related to the “Luna” effect; I had read at some point while browsing for information that it was possible to make certain enemies immune to this effect. I’m not sure where I would really begin with something like this however; would it require ASM or can it be done with a simpler method?

It requires ASM–I have the ASM files for this, and if you wanted it to be expanded to cover multiple IDs (class or character) instead of a single Class ID that wouldn’t be hard at all.

Because this effect seems to be tied to the item slot rather than strictly weapon ability, could you rewrite the routine to check for more items which would in turn lead to various different results, or is it hard-coded to only accept the default magic-swords?

You can branch it out.

But actually funny story on this, it actually checks both the weapon ability and the specific item slot.

But yes you could very definitely branch out from that routine and check for any arbitrary number of items for any arbitrary effects-- despite, yes, being coded to only accept the default magic swords, it’s not impossible to just edit the code.

This third one is a bit far-fetched and I’m thinking “no” but would like confirmation anyways. Would it be possible to deal a portion of damage dealt back to the attacker? Sort of like recoil attacks in Pokemon. For example, Mage A uses Elfire on Fighter B and deals 20 damage, but because Elfire is set to deal 50% back to the user, Mage A takes 10 damage (non-lethal) in return. It’s worth mentioning the damage would be applied after the battle, since I don’t think it would be possible to do something like that mid-battle on GBA.

This is totally possible regardless of when it happens. I don’t know exactly how easily, though, but there seems to be a slot for writing the HP of units in the battle data so from that knowledge it does not seem too hard? I’m not completely sure though (very novice).

is it also possible to have weapons that cannot counter-attack?

Weapons that cannot be countered can currently also not counter attack, I’m not sure how possible separating those two effects is unfortunately.

Also, does anyone know why the passive boosts hack isn’t compatible with CON and MOV? I imagine it’s because of how the Nightmare modules are set up

If weapons can in fact actually give con/mov bonuses, then yes, that would be the reason

I was under the impression weapons couldn’t give move bonuses, however. :p

  1. Needs ASM. I believe the topic you’re thinking of is this. Near the end of the battle stat computations (described here for fe7; fe8’s begins at 2A95C and follows pretty much the same pattern), there’s a “everything else” check that looks for magic swords, eclipse, and luna (and probably stone, too). You would stick a branch here to your code (since you almost certainly can’t fit this in-line, so you have to go into free space) and that code would do a check for…whatever. The SF request is based on class ID.

  2. It’s hard-coded to those three items (light brand, runesword, and wind sword), but you can change that. The “always do x damage” is doable, and I’d stick that in the same area, along with the accuracy debuff of the bow.

  3. Yes; I’m not quite sure how yet, but it’s certainly possible since @Brendor implemented Sol (heal same amount of damage dealt) and is a lovely person who always shares his notes. cough cough.

  4. Um, being unable to counter is a side-effect of the Uncounterable effect. If you meant “is it possible to have weapons that can only counter?”, then sure, it probably is. Not sure how I’d go about implementing it, though.

  5. It seems to me you figured it out; have items A and B use the same ability bit, and then use whichever one comes first in the inventory, and C on another bit.

I don’t actually know how the passive boosts hack works, but I’d assume it modifies the skill getters (the functions that, given the character id, return the character’s stat). If that’s the case, then the reason is because con and mov don’t have getters, and every function that requires one of them calculates it there. So you’d have to track down every place where that occurs and stick a bl (branch and link, basically a function call) in its place to your new getters. The hard part is, of course, finding all those places. Why don’t they exist? Your guess is as good as mine.

If you need more help, or just want to talk about assembly matters, drop by the discord. We’d love to have you!

or you could stick to discourse so that all discussions are documented and searchable

Yep, that was the thread. Thanks, that will really help out balancing late-game enemies.

As for #2 I guess in hindsight it makes sense that the game would check both the item and the ability, considering not all the MSwords work the same.

Lol, I’m surprised to hear that. Would be cool to see something like that released publicly.

For #4 I was indeed talking about a weapon that would only be available for use on the player phase, leaving you defenseless on the enemy phase. Weapons that can only counter sound pretty neat too. I…actually didn’t realize that those two traits were linked like that. I swear I’m not bad at FE guys

but I am bad at hacking LOL. That makes far more sense, for the reasons Tequila listed.

On #5 I was just failing hard. I pretty much started over and came up with something much cleaner than my first try, and it works exactly explained in the first post. I set the bits to 0x80 and 0x20, the only caveat is that the 0x20 bit has to appear before the 0x80 bit in the units inventory for it to work. It’s honestly not that consequential, since there’s little risk of accidently “unequipping” something mid-chapter, but it is a little frustrating from a quality standpoint. I had a possible fix in mind, but it would be tedious to do so and doesn’t really harm anything at the moment anyways.

So, what I’m getting is that for most of these changes I’m going to have to branch from the battle computations part of the battle routine to some new code that outlines the parameters to use for each new weapon? How feasible would it be for someone such as myself, who is new to ASM, to implement these changes? Assuming I stick to mostly the mechanical changes, that is and don’t try anything too drastic with the items.

One more thing that I’d like to ask; I took a glance through the battle computations topic and was still a little unsure. Are the healing routines tacked on to that “everything else” section, or do they have their own separate routines somewhere else in the ROM?

Thanks for the responses guys, very informative stuff.

It really shouldn’t be too bad. Just make sure you understand what’s in each register, what’s where in the battle struct (this is very very useful), and that you return whatever the game expects you to return.

I’m not entirely sure re: healing (and staves in general); I think most, if not all, are separate from the battle calculations. They use the same struct, but that’s about it.