[FE8U] Stan's ASM Stuff

Ok new-ish stuff

DISCLAIMER: YOU NEED ALL THE FILES PROVIDED AND THE EXACT SAME FOLDER STRUCTURE TOO (you can delete the .s (asm sources) if you really want to but still)

Range Display Fix

I know Icecube already made one but there’s no source available as far as I can tell so to me it might as well not exist =p

Doesn’t need any setup or anything, either include the file in your buildfile project or assemble it directly with EA (you may want to change the offset of FreeSpace in the file if you do that tho)


Also since I did some stuff that I never properly released here it is I guess

Heroes Movement Skills

Shove, Smite, Pivot, Reposition & Swap all-in-one package. You may want to tinker with the HeroesMovement/HeroesMovement.event (which is, btw, the only file you should #include) file to make it install the way you want, but am too lazy to do any in depth explanation rn so if you have questions just ask me on the the Discord.

Also those have been included in the Skill System for a while now (read: a few weeks).

“LOL Stats”

Really quick modification (took ~20min iirc), it makes level ups even more random, as you can now get +2, +3 or even +12 stat levels if you’re really lucky without needing any 100+ growth (+2 stats will become common for higher growths like hp).

How it works? The base game does stat ups like this: rolls one RN, compares it to growth, if the RN is lower, then +1, else +0. Here we actually will continue checking after the initial “RN is below growth” thing, like so (C pseudocode):

int getStatIncrease(int growth) {
	int stat = 0;
	
	while ((growth -= nextRN100()) >= 0)
		stat++;
	
	return stat;
}

TL;DR: you can get +3 stats with a 40% growth if you’re lucky.

2019-09-18 update: this now actually written in C and also this doesn’t cause autolevelled stat variance to be turbo wack anymore (hopefully).


That’s it for now. You can find me on the FEU discord if you have any questions.

4 Likes

:wave:

Hey, it’s been a while I made a thing!

Dance AI

“Restores” the ability for the AI to dance while escaping (vanilla can actually already do the decision making, but not the actual dancing).

Also adds the ability for the AI to decide to dance without the need to be in “escape mode” (more specifically, it will try to dance after trying to use staves). The AI will choose which unit to dance for based on base stat total (pow + skl + spd + def + res + lck + curHP; Without taking any modifiers into account) (this is just to make the potential dance target reasonably predictable).

For example, if an AI-controlled dancer has AI1 0 (AttackInRange, or ActionInRange would maybe be a better alias), It will dance for units it can reach. If it also can use staves, staves will have priority. If it also can initiate combat, dance will have priority.

Other misc info: Dancers won’t dance for other dancers. Dancers have a significant priority penalty (so they will most likely move after all the other units) (this is vanilla behaviour). Danced units move last, and in the order they were danced for.

The hack is for FE8U, install using Event Assembler 10+ while in free space.


If you have found any bug or have any questions, feel free to ask me on Discord.

Have fun being evil! -Stan

14 Likes

I mean, it sounds perhaps weird, having dancers as enemies, but incredible at the same time. Well whatever, that isn’t the point, the point is how amazing that is, praise StanH!!

:wave:

Lazberian Turn Flow (LTF)

Do any of you guys know about Berwick Saga? If you don’t, you should check it out! It’s a very interesting game. But if you do know about it, you probably know that in the land of Lazberia; turns flow fairly differently there than in your average Fire Emblem setting. This hack tries to implement the Berwick Saga “dynamic” turn system in FE8(U).

(Source included, but can also be found in the CHAX GitHub Repository. Note that you won’t be able to build the source without the CHAX setup or something like it).

#include "LazberianTurnFlow/LazberianTurnFlow.event" in your buildfile and you should be good to go.

2019-09-22 Update: LTF is now toggleable! By default, it is done on a per-chapter basis (the hack maker would define a list of chapter ids LTF is enabled in), but if you don’t mind for a bit of asm you could change the check for which LTF would be enabled. This is notable as previous versions would just force LTF globally. See installer for details.

This version may still have some issues, In terms of features this is basically done, but due to the scale of the changes this hack introduces it would require a lot of testing (both with LTF enabled and disabled) to be 100% sure there isn’t any bugs with it.

Detailed Feature List

  • Lazberian Turn Flow
    • Each time a move is made, a phase switch occurs.
      • “End Turn” will gray out all your units, preventing you from getting a move before every other (AI) unit has moved.
    • When every unit has moved, a turn switch occurs.
      • This is where stuff that normally occur for vanilla phase switches will execute (status depletion, trap checks, terrain healing, etc…)
      • Most notably, TURN events are executed at turn switch, and now ignore the phase part of the code/definition.
    • Berserk phase has been accounted for
      • all berserked units are pooled into the same “faction”, and have a dedicated phase
    • Some factions are biased towards having their (first) move before others
      • Blue > Red > Green > Berserked
  • Phase Prediction Display (up to 5 moves ahead; configurable if building from source)
    • Can be toggled with the “Display Help Subtitles” option; which, if you use HP Bars, will probably be replaced by the “HP Bars” option. (This may change in the future).
  • Reworked AI to fit the flow better
    • It’s a bit complicated. See AiThePlan.txt and src/LTFAi.c for notes and details I guess
  • Hold R at any point (when not hovering a unit, because that will open the stat screen) to disable map sprites being “grayed out” (since now units of all factions can be grayed out simultaneously, I wanted to give quick access to a way of distinguishing them)
  • A replacement for the PLAYER PHASE screen where it displays the turn number on turn change.
    • Note that the default graphics for this are probably not suitable for use in serious projects. You should however be able to edit those easily.

Known shortcomings

  • AI decision making take a while when many units have to move. This is more of an unfortunate side effect of the AI changes than a bug.
  • The cursor is reset after each move, even if the next phase is the same as the previous one.
  • Phase prediction display is probably active more often than it should be (even during events/menus/stuff like that). Planning on maybe polishing that eventually.
    • Mostly fine now, I think.
  • There is no big “PLAYER PHASE”/“ENEMY PHASE” screen message anymore. This is actually probably a good thing considering phase switches now occur way more often than in vanilla. However, the plan was to “replace” that with a “TURN {X}” message that happens during turn switch; and that isn’t done yet.

Reporting bugs and feedback

This hack is quite big and changes a lot of things. Some things will maybe end up being weird or broken. So if you find anything, or just have suggestions on improving this, or even just questions, or just want to say hi, you can do so by posting here, by finding me on discord, or by adding an issue on the CHAX GitHub repository.

8 Likes

:wave:

Have a bunch of misc small hacks that don’t actually do anything.


Easy Custom Game Speed Config

This is a very simple hack that allows you to define the game’s behaviour when it comes to what speed option means what. This means setting a base speed, whether the “slow movement” byte in the class table should be accounted for, and whether pressing A speeds up movement.

The default setup mostly mimics vanilla; with fast speed also allowing you to press A to speed up movement (using this hack renders the part in essential fixes that does this obsolete).

Usage

Include the installer from somewhere within your buildfile. You can either edit the definitions in the installer itself or copy/paste the definitions block in an earlier definition file and edit there.


Per Chapter Battle/Death Quote Lists

This hack is purely organization-oriented (it doesn’t really add anything to the game).

What this allows you to do is to declare “per chapter” battle quote and death quote lists. The idea is that this allows you to not have to maintain a single huge Battle Quote/Death Quote table; and instead can move chapter-specific quote entries to your chapter events (those quote could be important to the chapter logic so it seems natural that they would be located with the rest of it).

This also makes sharing chapters as self contained modules (which is done relatively commonly for Blitz-inspired projects) easier.

Usage

#include "PerChapterBattleQuote/PerChapterBattleQuote.event"

And then, anywhere after you include the hack (but maybe preferably somewhere chapter-specific) you can do the following:

SetChapterBattleQuoteList(ChapterId, BattleQuoteList)
SetChapterDeathQuoteList(ChapterId, DeathQuoteList)

With BattleQuoteList and DeathQuoteList being labels to Battle Quote/Death Quote “tables” following the exact same format as the one you’d define without the hack.

For convenience, I have also included a series of macros you can use to define your tables within events (as opposed to by using a csv), like so:

ALIGN 4
DeathQuoteList:
	DeathQuoteEid(Bazba, TextBazbaDeath, 2) // sets defeat boss eid
	DeathQuoteEnd

You can also use those to define the main table if you, like me, prefer to do it this way.

See PerChapterBattleQuote.event for the complete macro list (there’s quite a few).


Expanded and Modular Save (Game and Suspend) System

(Note: Kirb was also working on something like this, and may have had it done already (I don’t think so but I could be wrong); but here’s my take on it anyway).

This may need further testing, but as far as I can see it seems to work fine.

This is mainly targeted towards my fellow Wizards. This allows you to reallocate game save and suspend save blocks; And add/remove/replace data “chunks” within them in a modular way (see the files, especially the main installer, for details).

The default block allocation setup is based off @Crazycolorz5’s old plan for a similar hack (big thanks to him for his work). The default game save and suspend save chunk layouts mimic vanilla.

See here for an example setup that “expands” saved unit data, saves all 20 green units, and supports Colorz’s “legacy” expansion (used by debuffs) (this one also probably needs more testing, but again it seems to do fine at a glance).

Usage

See installer, it includes a handful of (hopefully helpful) explanatory comments.


Note: Those hacks may require you to have included “EAstdlib.event” before them; because I’m apparently too lazy to do it in the hack itself.

As usual (?), All sources are available in the “CHAX” GitHub repository. Report bugs or request feature by submitting an issue there or by contacting me directly here or on discord etc

13 Likes

:wave:

I have here a thing I made for a potential april fools thing that didn’t end up getting very far (it was supposed to be a hack mimicking berwick saga mechanics).


Lazberian Mercenaries

(browsable source here).

This hack allows some units to cost money to deploy… like Berwick Saga mercenaries! Hence the lazberian part of the name (however, this is much simpler than what that game would offer (no permanent recruitment mechanics or things like that)).

Even if this was kind of made in a rush, I’m fairly happy with the result which is why I am releasing this here.

HACK-12

how2:

  • A Unit with CAttribute (Class/Character Attributes/Abilities, this field goes by many names) CA_LM_MERCENARY (defined by default as 0x40000000, which is bit 30) will be considered as a mercenary, and will require to be hired to be deployable.
  • On the prep screen unit selection screen, mercenaries are marked with a blinking coin icon. You can hire mercenaries on that screen by attempting to deploy them.
    • Feel free to edit the coin graphics, restrictions are 8x8 pixels 15 colors. You may want to change the insertion method.
  • This hack changes auto-deploy to only deploy force-deployed units (this is because I was lazy and didn’t feel like changing the thing to deploy units that specifically aren’t mercenaries).
  • Force-deployed mercenaries don’t need to be hired.
  • You will be silently refunded any mercenary you hired but didn’t end up deploying upon starting the chapter.
  • A Mercenary’s cost is computed by one simple function. This is the only function provided as pure ASM (GetUnitDeployCost.s) to allow its modification to perhaps be more accessible.

/!\ This requires a save unit expansion that saves the entirety of the unit state bits:

  • The latest github version of the skill system comes with a EMS (see previous post for details) setup that includes such expansion. It is, however, disabled by default (reasoning behind it is: it will break existing saves), you need to enable it by defining USE_SAVE_EXPANSION in Custom Definitions (or somewhere else included early in the build).
  • FEBuilder ships that very same EMS-based save unit expansion as a standalone patch under the ExModularSave name (I think).

If you don’t have such expansion installed, the hired status of units will be lost on chapter restart (and your money won’t come back!).


I said that I was happy enough with this to release it here, but there’s also a bunch of other things that I was a bit less satisfied with. I’m not releasing them here but sources are nevertheless available in my CHAX repository (look for LazberianBattleFlow and LazberianWeaponry specifically).

Lazberian Turn Flow (see a few posts above) also got a small bugfix update (fixing some relatively minor AI related issues).

Report bugs or request features by submitting an issue on CHAX, or by contacting me directly here or on discord.

21 Likes

Langrisser time?

3 Likes

This is an extremely cool concept/implementation. Gave me a few ideas to consider.

can we just praise Stan

1 Like

Daily PSA: Play Berwick Saga

1 Like

:wave:

It’s time for my bi-yealry dump of random half-rushed-and-barely-tested stuff. Lot’s of AI stuff this time for some reason.


Fixed Autolevels

This is an absurdly trivial hack that makes autoleveled stats non-random (it makes it a static (growth * level + 50) / 100 instead). I didn’t plan on making a proper release of it like that ever but I was told that it might be of use to other people. So here it is.

This is not compatible with Zeta’s AutolevelTweaker it seems.


Ferry AI

(You’ll need both of these hacks to be installed at once, in that order).

This is a custom AI I made for the communist blitz (yes) that allows you to set AI units to “ferry” units from a rescuer to a drop point.

The AiPerfromExtension hack allows hacks to add in “ai perform” actions (or just Ai actions). It’s only really interesting to other wizards but tl;dr FerryAi uses it to allow AI to Take and Drop.

This hack uses 2 perform ids, one AI1 id and one trap id (the trap is used to store locations of drop points); all of which can be configured through definitions before including the installer (see installer for details).

Using FerryAi mostly consists of setting the Ai1 of the ferry units to FERRY_AI1 and using ASMCs to setup drop points:

  • ASMC_AddFerryDropTile will add drop point at coords in sB
  • ASMC_AddFerryDropTiles will add drop points based on null-terminated list of short pairs pointed to by s2.

FerryAi also comes with a helper ASMC that allows you to load a unit rescued by another:

  • ASMC_LoadRescued: loads UNIT pointed to by s1 (it’s coords and REDA doesn’t matter, doesn’t need to be preceded by UNIT) and makes the unit corresponding to character in s2 rescue it. Returns 0 in sC if it fails, otherwise 1.

See CommBlitz Ch10 events for example usage.

Both of those hacks also come with (and use) AiScrDefinitions.event, which fulfils the same role as Extensions/AI Assembly.txt, but is more complete and also not broken (but FE8 only).


Talk AI

This is also custom AI I also made for the communist blitz (also yes). Well, it’s not that custom, as it is mostly just a port of the functionality from FE6 and FE7 that allows AI-controlled characters to seek talking to specific units.

This defines a single macro, AiTryTalkToCharacter, which is basically an entire AI script.

Example:

ALIGN 4
DanAi:
	AiTryTalkToCharacter(Eirika)

	InjectAi2(CH10_DAN_AI2, DanAi) // Use whatever macro you use to inject AIs

This would make anyone with Ai2 CH10_DAN_AI2 seek talking to Eirika. Note that they will seek talk even if they cannot talk to the target character, which will result in a freeze when they try.


AI doesn’t attack if it can’t do damage

This is something I made this morning at like 1AM “yesterday” on a whim after the fact that this feature exists in FE4/5 was mentioned in VC.

It just checks whether attack - target_defense is lesser or equal to 0 and if so sets target weight to 0 (making it not attack). This means that it may not take into account stuff like pierce procs and whatnot.


LTF Update

Lazberian Turn Flow is not a new hack as you know of course but I updated it to include a cool new featurey thing:

turn-waterturn

I hope you’re all jealous of my quality art (read: If anybody wants to make something that doesn’t look like garbage I will gladly include it as default).

Guide to changing the graphics

Starting at line 268 (currently) of LazberianTurnFlow.event is this:

ALIGN 4
gLTFTurnSwitchSheetImg:
	#incbin "Data/TurnSwitchSheet.4bpp.lz"

ALIGN 4
gLTFTurnSwitchSheetPal:
	#incbin "Data/TurnSwitchSheet.gbapal"

This is where the graphics are getting included. If you so wish you can change those to incexts like so:

ALIGN 4
gLTFTurnSwitchSheetImg:
	#incext Png2Dmp "Data/TurnSwitchSheet.png" --lz77

ALIGN 4
gLTFTurnSwitchSheetPal:
	#incext Png2Dmp "Data/TurnSwitchSheet.png" --palette-only

Edit the Data/TurnSwitchSheet.png file and rebuild using EA.

The LTF update also probably includes some other minor fixes and changes, as I’ve been occasionally adding small polish bits to the thing.

The download a couple of posts above has been updated to include this.


Also LolStats has been updated to not make autoleveled generics stats turbo wack (hopefully) (which in turn makes it also incompatible with both the above Fixed Autolevel and Zeta’s AutolevelTweaker).


That’s it for now! As always, all up-to-date sources and more are in my FE-CHAX repository.

Ask questions and report bugs here blah blah blah (nobody ever does that there anyway) or hit me here or on the discord.

:evaw:

12 Likes

:wave:

LTF Update (again)

It’s been like 5 minutes since I last posted but for the first time in its year+ of existence I got some feedback on LTF (Lazberian Turn Flow, see the original post), which got me to fix and change and add a few notable things:

  • LTF is now toggleable. It’s on a per-chapter basis by default, but that can be changed if you don’t mind a bit of asm (see main installer for details). You can now mix in chapters using LTF with chapters using traditional turn flow in your hack (or enable LTF as a different mode, whatever floats your boat). The default installer enables it for only the prologue by default (for demonstration purposes).
  • Fixed turn count when using LTF (it used to start at 0 instead of 1). Sorry about that.
  • The turn switching thing updates the turn order display properly. Also map sprites stay gray for a bit longer. It’s just a visual change, but also something that was pointed out as being weird.

There. Download link was updated in the original post. Please report any issues thank (there probably still are some).

5 Likes

:wave:

Classic RNG

image
There you go @L95 =)

This hack replaces the random number generator with one that accurately (hopefully) replicates the one from FE1-3. This is a joke hack (that RNG is hilariously bad).

This only changes the core Random Number Generator, it does not remove 2RN or whatnot.

Installer for FE8U, contains offset for FE6 commented out. Install using Event Assembler.


Thanks to @oziphanto for confirming that C04E in FE1 is indeed the random number generator. Check out his fix for the RNG in FE1, as well as his video explaining how the FE1 RNG works and why it sucks! check out my wip fe1 disassembly while you’re at it

13 Likes

What have I done

7 Likes

I did and it is amazing.

Oh,also…what actually is so bad about the old RNG? I only know from the linked recources that the FE1 version is an abomination.

what’s “the old RNG” if it’s not FE1’s RNG?

FE2 and 3? FE1-3 is listed.

I understood from oziphanto’s stuff that they are the same

FE2 and FE3 have the same garbage RNG as FE1. Even on the SNES version when a programmer had to port the code to SNES and and make it ‘rtl’ safe. IT STILL ADDS A SINGLE NUMBER IN A LOOP MULTIPLE TIMES GAHHHHHHHHHHHHHHHHHHHHH

However 1 has the extra bad notion of not scaling things properly, which was fixed in 2 and 3.

To make my first play-through of FE6 more interesting/hopefully entertaining for viewers; I was thinking of giving it “Classic” 1RN and No weapon triangle. I’ve been pulling FE7 apart a lot, but if anybody has the offsets/patch already for FE6, love to know.

1 Like

YES, YES, YES BERWICK STUFF IN FE 8 HACKS, I’m going to put that stuff in whatever future project, I’m shoving in.