Snake's Pit of ASM (and Other Stuff)

Well this is a coincidence, because I come bearing FE7 stairs.

Assume everything is for FE8 (though if you need something for FE7, I’d probably be happy to adapt it. :slightly_smiling_face:)

Anyway, FE7 stairs work very similarly to FE8 stairs...

I suppose I can safely assume we won’t need to worry about interference with any skill system.
Firstly, this assumes that you have the following defined.

## StairNameText
Stairs[X]
## StairDescText
Take the stairs[NL]
to the other side.[X]
## StairsBlockedText
The stairs are blocked[NL]
from the other side.[X]

Next, the action menu. Assuming you haven’t already screwed with it, this is handled with “FE7 Unit Menu.csv”. If PFinder doesn’t work (which it never does for me), here’s where you need to repoint.

//Repoint Unit Menu
PUSH
ORG $B95Ab4
POIN UnitMenuTable
POP

Then, just #include “Stairs.event”.

Using the stairs is exactly the same in FE8.

#define Stairs(StairID,X1,Y1,X2,Y2) "LOCA StairID [X1,Y1] 0x22 ; LOCA StairID [X2,Y2] 0x22"

Don’t reuse StairIDs. X1 and Y1 are the coordinates of one end of the stairs. X2 and Y2 are, big surprise, the coordinates of the stairs on the other end. This macro command goes under location events.

Let me know if you encounter any problems, something needs clarification, or if I forgot something.

1 Like

Portrait Selection

Remember when I had this in the OP?

Conditionally Loading Portraits

As in, load this portrait if event ID X is triggered. Load this one if not.

Okay. I can’t provide a download for this one. I wrote this for Legends of Avenir (shameless self-promotion lol), but the ASM would be so dependent on your needs (event IDs to check, number of event IDs to check, text control code, etc. ) that any source I post would be useless except as documentation. If you’re interested, find me on Discord and I’ll help you out.


:disappointed: That’s pretty dumb, so I made a version that is not hardcoded and is hopefully easy to use.

How to: Teach your characters to consider event IDs before showing their ugly faces.

Simply include “PortraitSelectionASM.event” found in the Dropbox folder.
If you’re using the Skill System, uncomment then installer in _MasterHackInstaller.event.
You’ll see the following when you enter the installer file in the container ASM folder:

PortraitSelectionTable:
SHORT 0x0 0x0 0x0 0x0 0x0 0x0

Now you need to fill out the Portrait Selection Table. All this does is it relates a control code, mugs to potentially show, and a list of event IDs to check. Use the macro, PortraitSelectionEntry, to fill this out. For example…

PortraitSelectionTable:
PortraitSelectionEntry(GoodFaceID,BadFaceID,Face1List,0xE0E0)
SHORT 0x0 0x0 0x0 0x0 0x0 0x0
Face1List:
BYTE 0x6E True  0x11 True  0x00 0x00

How will this be interpreted by my function? Any time that 0xE0E0 as the control code is detected, it will load GoodFaceID if both event IDs 0x6E and 0x11 return true. Otherwise, BadFaceID will be loaded.
Each unique event ID list that you make can be as long as you like. Each one to check should have the event ID followed by whether you want it to be true or false. This list must also terminate with 0x00 0x00.

PortraitSelectionTable:
PortraitSelectionEntry(GoodFaceID,0x00,Face1List,0xE0E0)
PortraitSelectionEntry(NeutralFaceID,BadFaceID,Face2List,0xE0E0)
PortraitSelectionEntry(SomeOtherPortrait,SomeOtherOtherPortrait,Face3List,0xF0F0)
... // Other control codes and stuff idk
SHORT 0x0 0x0 0x0 0x0 0x0 0x0
Face1List:
BYTE 0x6E True  0x11 True  0x00 0x00
Face2List:
BYTE 0x6E False 0x11 True  0x00 0x00
Face3List:
BYTE 0x72 True  0x21 True  0x14 False 0x00 0x00

You can have as many entries and different control codes in the Portrait Selection Table as you like, and control codes CAN repeat. If you put 0x00 in the FalsePortraitID slot, then upon returning false, my function will continue checking the list for valid portraits to load instead of trying to load a false one.
This previous example will check Face1List upon hitting 0xE0E0. If Both 0x6E and 0x11 are true, then it will load GoodFaceID. Otherwise, it will proceed down the list because the false (or else, if you prefer) entry was 0x00. It tries the next entry, and if it finds 0x6E to be false and 0x11 to be true, then it loads NeutralFaceID. Otherwise, it loads BadFaceID.

It may be more intuitive to think of this as…

PortraitSelectionEntry(IfTruePortrait,ElsePortrait...)

In case you’re wondering about the control codes themselves, they’re arbitrary shorts. You don’t need to do anything extra to use them except use them in the Portrait Selection Table. To my knowledge, you should not use 0xFFFF (since that’s for loading the current character’s), and you should not use 0x01XX or 0x02XX (since that’s used to normally loading portraits). Just go ahead and [LoadFace][0xE0][0xE0] (in my case, at least) away.

As always, I’d be happy to clarify something, and let me know if you encounter any issues!

4 Likes

Okay then. Would you be able to convert the Anima Magic Triangle to FE7? I want to use it in a mod I’m doing.

This has some pretty great stuff.

I ought to learn how to ASM as well one of these days

1 Like

Sure. I’m not sure when I may get around to it, but I’ll definitely add it to my to-do list.

1 Like

Modular EXP
This replaces what was Double EXP, which was extremely limited.

What does this do for you? You can define a multiplier or a divisor for EXP based on many conditions, including character, class, enemy’s class, weapon wielded, chapter, and event ID.

How to: Make EXP bend to your will

Firstly, include “ModularEXP.event.”
If you’re using the Skill System, instead uncomment the installer in _MasterHackInstaller.event.

ALIGN 4
#define ModularEXPEntry(Character,Chapter,EventID,Multiplier,Divisor) "BYTE Character Chapter EventID Multiplier Divisor 0x00 0x00 0x00"
ModularEXPChapterTable:
ModularEXPEntry(0,0,0,0,0)

Within that file, you’ll see something that looks like this.

This table is how you will control EXP by chapter, character, and event ID. For each entry of this table, go ahead and fill those out like so, and specify how much you would like to mulyiply and divide by.
For example…

ModularEXPChapterTable:
ModularEXPEntry(Franz,Chapter2,0x00,2,1)
ModularEXPEntry(Ephraim,Chapter8,0x00,1,2)
ModularEXPEntry(Colm,Chapter4,0x12,3,1)
ModularEXPEntry(Seth,0xFF,0x00,2,3)
ModularEXPEntry(0xFF,Chapter5,2,1)
ModularEXPEntry(0,0,0,0,0)

Here we have an example usage.
The first entry will give Franz doubled EXP in chapter 2.
The second will give Ephraim halved EXP in chapter 8
The third will give Colm tripled EXP in chapter 4 only when event ID 0x12 is set,
The fourth will give seth two-thirds EXP in all chapters.
The fifth will give all units doubled EXP in chapter 5.
The last entry is simply a terminator.

Note that you CAN use fractions by multiplying and dividing together, and also remember that multiplying or dividing by 1 will have no effect.

That was part 1, the second part is a csv that’s indexed by class ID. Go ahead and incorporate Modular EXP Class Table.csv and it’s .nmm.

The first and second columns are the class multipliers and divisors these will always apply. Have a class that’s gaining too much EXP? Add a correctional multiplier and/or divisor.

The next 2 columns are the granting multipliers and divisors. These are the same thing as before except they apply when they grant EXP. If you want enemy soldiers to grant more EXP from combat, for example, add a multiplier here.

The rest of the columns are for weapon types. These will apply when this class is using this weapon type, and they do stack with all other multipliers and divisors. Want great knights to have 4/5 EXP when using axes for some reason? Just apply those to this part.

That’s it. Let me know of course if you find any bugs or problems of if you have any suggestions.

Some other notes

EXP per combat cannot exceed 100 EXP because of level up shenanigans. This routine will cap all EXP gains to 100.

Do not divide by 0. This should go without saying, but I accidentally did it during testing. Bad things happen. :stuck_out_tongue_closed_eyes:

9 Likes

Poison Rework
Tired of how inconsequential poison is? This should allow you to both define it how you wish and make it more meaningful.

This ASM does three things.

  1. Poison applied is additive. This means that any poison applied stacks with any poison that the unit previously had. For example, if a unit has 2 poison and is hit with a weapon that applies 4, the unit will then have 6 poison.
  2. The damage that poison deals each turn equals how much poison the unit has before ticking down. If a unit has 7 poison, it will take 7 damage, then the next turn it will take 6, and so on.
  3. You can define how much poison each weapon should apply including how much poison gas traps apply in each chapter)
How to: Make poison actually do something. I know. Crazy, right?

Again, no installer is necessary. Just download the folder in the Dropbox and use:

ALIGN 4
#inctext lyn "PoisonRework/PoisonRework.elf" "PoisonRework/Hooks.elf"

Secondly, you’ll also need to incorporate both the Poison Rework Gas Trap Table and the Set Poison Item Table with your csvs. The former is indexed by chapter. It just tells the routine how much poison to apply from gas traps in each chapter. The latter table is indexed by item and tells the routine how much poison to apply per item. You still must use the poison weapon effect in the item table normally for an item to apply poison.

That’s it. The only other thing is that poison will max out at 15 due to RAM space restrictions.

Now go and spread your lethal poison to all corners of Magvel! (or whatever)

7 Likes

Make poison great again.

5 Likes

I feel like Poison should increment after DoT ticks instead of decrement. Or there should be at least a separate Poison that does do that if you feel like there’s a poison that is naturally able to be recovered from without an antidote.

Otherwise, I would think you’d get sicker and weaker if it’s left alone to ravage your body. Plus it makes it waaaay more dangerous. (Bonus points if you can make it so Poisoned units cannot have their HP healed.)

Outside of that, this is super neat.

2 Likes

2 updates:

Fixed a bug in Poison Rework where it would sometimes apply 0 poison and forever deal 0 damage each turn.

I’ve also almost completely overhauled Level Up ASM (no empy level ups) because that shit was BAD. I’ve fixed a bunch of minute bugs in it and heavily optimized it. It still conflicts with the skill system, but I’m planning on fixing that in all of my projects at the same time soon.

Also I haven’t forgotten about this. I’ve just been super busy lately. Are you still wanting this, @chronoquairium ?

2 Likes

Yeah, I’m still hoping for that.

FE7 Anima Triangle
FE7%20Anima
Let’s pretend Fimbulvetr is a wind spell.

Same installation as before. Just use the files in “FE7AnimaTriangle” instead.

#inctext lyn "FE7AnimaTriangle/AnimaTriangle.elf" "FE7AnimaTriangle/Definitions.elf"
FireList:
BYTE (List of fire tomes terminated with 0x00)
ThunderList:
BYTE (List of thunder tomes terminated with 0x00)
WindList:
BYTE (List of wind tomes terminated with 0x00)
4 Likes

Curious question but could this be done across the board for all tomes to have its own internal triangle on top of standard?

triangleseverywhere

4 Likes

Is the Anima Triangle ASM supposed to clash with the Skill System Patch?

I patched both of them into a clean FE8 rom, but then when I tried to test the new rom, VBA got softlocked because the initial Seth vs. Valter cutscene wouldn’t start (and even if I removed it, trying to start any combat would just softlock the game) and no$gba just crashed.

I tried to patch them both in different orders, but it doesn’t change anything.

Both patches seem to work properly on their own, but combining them seems to just fuck up the rom, which I’m not sure is supposed to happen, since FEBuilder doesn’t list them as conflicting patches and because I’ve seen hacks with both Skill System and Anima Triangle in place.

1 Like

I believe- actually I know that Anima Triangle conflicts with the somewhat recent skill addition, Tri-Adept. You should be able to get around this by not installing that skill. This is another conflict that I need to handle.

Could you elaborate on this?

My question would be like when you were able to create a triangle within the anima table of magic. Could it also be transplanted into the light magic and dark magic table as well?

Sure. All my ASM does is check if the current weapons used match what’s defined as fire, thunder, or wind based off of lists of item IDs and set WTA accordingly. There’s no reason why this concept couldn’t be applied to different tomes.

Prep Screen Menu Editor

Screenshots

Prep%20Screen%201 Prep%20Screen%202 Prep%20Screen%203 Prep%20Screen%204

This will allow you to easily edit the menu options in the prep screen. In vanilla, these are loaded in a somewhat hardcoded fashion, but this includes some ASM and a CSV that allows you to edit and conditionally change these items.

How to: Spookify your prep screens

Like I said, the first part of this is some ASM. It handles building the menu options that you define in a modular fashion.

ALIGN 4
#inctext lyn "PrepScreen/PrepScreen.elf" "PrepScreen/Hooks.elf"

I hope this looks familiar by now. Nothing else is required.

The second half is the CSV that defines the conditions, name text, description text, and effects for your menu items. Heap the CSV with your other tables; as is, it is set up to function exactly how vanilla does. This data DOES NOT exist in this way in vanilla. This is a completely new table so the user can more easily define how the menu appears.


Each menu item appears as an entry in the table, and each item will be loaded in the order that they appear in the table. I’ll go through what each column does:

ID
I wouldn’t edit this for vanilla values, but each menu item has an ID associated with it. If you make new menu items, they will need an ID. I suggest using 5 or 6 since those are unused in vanilla. Within this ASM, the ID seems arbitrary as long as you don’t repeat them.

 0 = pick units
 1 = items
 2 = save
 3 = link arena cancel
 4 = support
 5 = ? (one of: fortune, ranking)
 6 = ? (one of: fortune, ranking)
 7 = check map
 8 = start battle?

Credit @StanH doc.

Name Text
Pretty straightforward. This is the text that will appear as the name of the item. (“Pick Units,” “Check Map,” etc.)

Usability (Whether to display)
This is reserved for a usability routine that returns false if you do not want the menu item to display at all (see images 1 and 2 how “Support” is not shown). Return true if you do want this option to appear. A 0x00 entry will always display the menu item.

Usability (Greyed out if false)
You know how in Valni and Lagdou, the “Save” option is greyed out an unusable? Do that to your menu items with this. Point to a routine that returns false to grey out and true to remain normal. Again, 0x00 will always display normally. PrepScreenSaveGreyUsability is included as an example and to emulate what vanilla does to grey out “Save” during the Valni and Lagdou chapters.

Warning for these usability options: Do not forget |IsPointer! It got cut off in my screenshot.

Desc Text
This is the text ID that will be shown when hovering over the menu item as the description text.

Greyed out desc text
Self-explanatory. This is the desc text that will be shown if the menu item has been greyed out.

Effect
This is the effect routine for each menu item. To be honest, I haven’t analyzed these a whole lot yet, but that’s what it is.

Finally, a terminator entry of all 0s is necessary as the last entry.

And that’s it really. I hope to have a little more analysis of the effect pointer.
One warning: you CANNOT display more than five menu options at a time. The graphics freaks the fuck out if you try. It’s fine to have more than five items in the CSV, but make sure via usability that more than five never show up simultaneously.

BONUS: Eliminating a Valni/Lagdou headache.

You know how in the top right of a prep screen, it shows “Chapter” followed by the chapter number? This is true except in Valni and Lagdou where it shows “Tower” and “Ruins” instead respectively.

ORG $96B1C
SHORT 0xE00A // Eliminate "Tower" in prep screens
ORG $96B3A
SHORT 0xE003 // Eliminate "Ruins" in prep screens
ORG $96B4C
SHORT 0xE003 // Eliminate "Ex.map" in prep screens

This’ll ensure that it always shows “Chapter” even in chapter IDs that were Valni/Lagdou.

No go and make a base convo system… or maybe prevent the player from viewing the map in a prep screen for a chapter. :thinking: Spread your evil!

8 Likes

Two things:

Firstly, I’ve updated ModularEXP to support EXP from staves. The way staff EXP is handled is completely different from combat, so another routine has been added to handle that. No need to change the installation method whatsoever, just redownload the .asm and .elf files.

Also, I’ve slightly modified how 0 EXP is handled. The routine will always output a number between 1 and 100 inclusive… UNLESS you multiply by 0 at some point. This means that if you want to conditionally eliminate EXP gain, you can multiply by 0.
Let me know if you find any bugs!

Secondly, I figured I may as well post something I’ve been sitting on for a while.
Do you use buildfiles? Do you detest PFinder?
Well I’ve uploaded “Repointers.event” which can be #incuded to repoint all of the major data tables… or use it as documentation or something.

Currently Supported Tables

Item Table
Item Target Table
Item Usability Table
Item Effect Table
Class Table
Character Table
Spell Association Table
Promotion Branch Table (This was a pain tbh)
Chapter Data Table
Standing Map Sprite Table
Moving Map Sprite Tables
Death Quote Table
Battle Quote Table
Spell Table
Summon Character Table (Also kind of a pain)
Text Table
Character Forcer Table
Sound Room
Portrait Table

Let me know if there are tables I’m missing.
This is very similar to the file I use to repoint everything for LoA, so it’s pretty well tested. If it does cause problems, however, don’t hesitate to let me know!