Vesly's ASM



all downloads:

for the dozen of us that don’t just use febuilder patches


By StanH
Given a coordinate in sB, returns a non-0 value to slot C if any enemy can attack that tile. (It returns the number of ways enemies can attack that coord, actually.)

(Stan wrote this ASMC for me but I had to bugtest it & fix a couple things to make it work and afaik he never released it.)


By Tequila, Vesly
Given s1 as Nth player unit, return their unit ID to slot C. Eg. say you want the 4th deployed unit - this will do that while ignoring empty slots.


Originally by Tequila, rewritten by Vesly
Given s1 unit ID and s3 state (eg. 0x42: acted already, cantoing), this sets, unsets, or flips the condition of that unit. This version works on units of memory slots (eg. 0xFFFD) and doesn’t mess with anything inline.


Originally by 7743, rewritten by Vesly

Want to give A Rank swords to all units that have acted this turn?
SetUnitStatusAll(AnyUnit, SwordExp, 181, 0x02, AnyArmy, AnyClass, AnyRange, AnyItem)

Or want to give +6 mov to all enemies with unit IDs 0xAA-0xBD with classes ranging from 0x52-0x66 in the range 1x 3y to 12x 15y that are holding vulneraries?
It can do that too:
SetUnitStatusAll(0xAABD, MovBonus, 6, AnyDeployed, EnemyArmy, 0x5266, Area(1,3,12,15), Vulnerary)

Similar in function to the febuilder patches, except:

  • can now do on mem slot units (eg. 0xFFFD, 0xFFFE)
  • conditionally ignore units of certain states (eg. ignore units that have acted, or units that are rescuing)
  • unit ID is now a range: eg. affect units 0x02 to 0x0F
  • same with class eg. affect monster classes (IDs 0x52-0x66)

someday I will write something original





This changes the select button and the SetAllDangerRadius ASMC to only set it for nearby units, as otherwise it becomes too laggy. Download in the first post.

I’ve set it to enable danger radius for units within 14 tiles, but you can pretty easily change this.
Feel free to add this to your own code & thread, @Huichelaar





  • Terrain type (eg. grass only)
  • Range of enemies to affect
  • Range to place enemies within

this hack randomizes their placement.

in the above gif I set it to run 12 times just for fun.

Idk if anyone else will find this useful, but here it is anyway!



Given memory slot 1 as the number of levels to increase by, this autolevels units. I wrote this to autolevel units above lvl 31.

I’ve set it to just autolevel all enemy units for convenience, but if you want it to autolevel only a single unit let me know and I’ll make a version for that. Maybe in the future I’ll add more config options, eg. make it autolevel each unit by a configurable amount, or make it only affect units in a certain range, etc.

Note that this uses the GrowthGetters hack, included with skill systems.

To go along with this, I’ve added in how I save levels above 31 on suspend+resume to the ExpandedModularSave folder.

By default, Eirika has these support values:

Enemies that have a commander have their commander’s unit ID saved to Support 7. So if Eirika was an enemy with a commander, she could not have a 7th support partner.

I don’t need many support partners, so I save the unit’s level to Support Partner 6 during suspend+resume, then I set support 6 to 0 just in case.

save level on suspend

There is certainly a better way to do this that doesn’t overwrite anything, but this works fine for me.


Not asm but here’s stuff for expanding the AI1 and AI2 lists.

EA folder already had AI Assembly.txt in it which you can use for creating new AIs.

I added macros for AI1 and AI2 entries.


// Vanilla entries take up 0 - 20 
NewAI1Entry(21, TestAI1)

Which POINs to your new entries, such as this one:

Goto(0) //Exit / terminator ? 

Can find it in usual link in first post.

1 Like

Debug Place Units

When flag 0xAA is ON, you can freely pick up units that haven’t acted and put them where you please.

Enjoy! Link in first post.

Here’s an ingame menu command. Requires anti-huffman, obviously.

Taking over the Chapter Menu is commented out by default, so just uncomment this line if you want it installed.

Credits to Huichelaar for the chapter menu installer.

Another edit:
Okay, made it so the “Toy Box” menu option will only be displayed if flag 0xAB is on. This means that febuilder users can leave this hack installed but have it hidden for public releases.

Also a note - due to differences in ColorzCore vs Nintenlord’s Core, quotation marks may appear around the text entries. FEBuilder users will have to manually delete the quotation marks in text entries 0x9B7 and 0x9B8 after installing for now.

& fixed a minor graphical glitch that would sometimes occur


Repair Items


available now

Zane decided to rewrite it for fun and add a couple features. His code is found here:

I made it only work on weapons (eg. equippable) but not staves/items. I figure there are some staves you might not want repaired (eg. Warp or Hammerne).
It’s also set to ignore weapons that are unbreakable or unsellable. I figure most people don’t want the player being able to repair Garm or whatever with this.
It can easily be changed to simply repair all items regardless of the above - you’d just delete a few lines of code.

To actually use this you’ll have to call the two asmcs provided. I made an example event in the Installer for you to reference.

ComputeRepairCost gets the amount to charge you and stores the result in memory slot C.
RepairItemsForACost charges you the gold based on the value in memory slot 1 and repairs your weapons. This returns 0 to slot C if not enough gold. This way you could easily have dialogue afterwards like “Tcch, you don’t have enough.”


Negate Def

55% of the Fighter’s 5 def is ignored, so it’s as if he has 2 def. With WTA Eirika would deal 12 which is subtracted by 2, so she deals 10 dmg.


You can make weapons ignore some percentage of def/res with this.


Compatible with skill sys. Enjoy


Very epic sauce as usual.

1 Like

Wait AI

(Found inside the ExpandAI folder.)

Ever wanted stationary AI to trigger range/always events?
Well, this let’s you do that.

For your convenience, it also writes the active unit’s coordinates to memory slot B and their unit ID to memory slot 2 right before running your events.

It is a very simple hack but took a little while to figure out via trial and error.
All we do is call this function as your AI1 or AI2.
AiSetDecision(int xPos, int yPos, int actionId, int targetId, int itemSlot, int xPos2, int yPos2);
And we put your xPos and yPos to your current location and set the actionId to 5.
Why 5? I don’t really know, but it makes them wait.
This hack touches nothing inline and should not conflict with anything.

Note that AI1 takes precedence over AI2, so you can easily do something like AI1 - ActInRange (0x00), AI2 - WaitAI.


If you’re using febuilder, select AdvancedMenu->Insert EA and select WaitAI.event.
Then open the .sym file and paste the given address into an AI1 or AI2 slot and hit write to rom.




Modular Summon


What it do?

  • Give summons to units/classes that meet the level req

  • then when they summon, it loads the units you specify nearby

  • includes AI so the enemy can summon, too. (ApproachEnemySummonAI and RunAwaySummonAI: note that I’ve set the approach enemy one to only summon if they can summon 50% or more of their group of summons. This way they’ll attack if they can only summon a minority of the unit group.)

  • you can also summon them in formations for coolness factor (if there’s stuff in the way then it’ll do its best to adapt)

  • fixed position mode summons to the coords you specify in the unit load, or nearby if units are in the way

  • relative position mode summons relative to where you could walk from

  • if a unit is entirely surrounded by walls and tries to summon relative to them, it will place the summoned unit at a totally random valid coord. If you want locked up enemies to summon, just use fixed coords mode tbh. Unless you really want random coords I guess (5)

  • optionally have the summons scale based on your level
  • optionally have the summons keep stats & level up between chapters (unless they die)

This is by far my most complex hack that I’ve written to date. AI scary, haha. I have tested it pretty extensively for bugs, though.



Prevent Attacking

This hooks 0x8024eac ForEachUnitInRange to prevent the player from attacking/targeting units by character id, class id, or enabled flag. Please note that this does not effect counter-attacks at all. (Give the enemy an item with the uncounterable bitflag if you want that behaviour.)


  • Prevent the player from attacking O’Neil
  • Prevent the player from attacking Paladins
  • Prevent the player from attacking while flag 0x8 is on


(I think the AI uses 0x803ac3c CouldStationaryUnitBeInRangeHeuristic, which I have not touched, so this doesn’t effect AI.)

It is compatible with skill sys.


Turns out the original version also prevents trading/rescuing/etc., so I made a 2nd version just now that instead hooks 802517c AddUnitToTargetListIfNotAllied such that it only prevents attacking.




As part of modular summon I had to figure out a way to autolevel units but be easily compatible with febuilder & str/mag split without needing you to re-install skill sys or anything like that.

So here’s AutoLvlUnit now as a standalone ASMC.

Compatible with skill sys

It can also have levels be invisible, akin to hard mode bonus levels.


Item Special Effect


Inspired by @Myi64’s request and 7743’s “Special Effect Per Unit”, this lets you attach an event to an item. Note that on certain items, the regular “use” command will still appear, so you might want to name this something different like “Special”, for example.

Important: This is not the regular “Use” command. This is an additional command being added that is also called “Use”. Below I called it “Sword” because the regular “Use” command also shows up for this item.


You’ll need to uncomment this part if you want it to take over your item menu:

My example event is just showing text, but since you’re running the event engine, I think it should be pretty convenient and flexible. Enjoy!

Note that the colour of text in the item menu is based on the real use/equip options. If you want it to not show up as greyed out, then I think it needs to also be usable or equippable.

This should not conflict with anything & is compatible with skill systems.


I think this patch has an interesting point of view, but I think it lacks functionality.

There is no function to dynamically change the menu name.
In the patch I made for the unit, there is a function to change the menu item name dynamically.
I don’t always want to use the name Use, so there should be a feature in the settings to change it for each item.

It is not good to always Wait after using an item, as it reduces convenience.
It should be selectable by the user.

It is not possible to set the conditions under which an item can be used.
For example, there may be cases where you need a condition to use the item, such as when you are low on HP, or when you have friends who are low on HP, or when there are enemies around.
Vanilla items have a variety of conditions for use.
It would be hard to cover all of these, but I think it would be better to support the most commonly used features.
This is because these are difficult to represent with flags.
It would be more convenient to add method and args arguments to the structure.

3 is difficult to implement, so I think you should solve 1-2 first.

1 Like


AoE (10)


I think maybe you can try to port the lightning that I previously released here. To make things coooooooooooler. XP


Area of Effect (AoE)


I have added support for the vanilla rocks animation, as above. But additional animations are up to the user for now. If we as a community figure out more map animations, I would like to include them in this.

There are many config options.




MagBased (for StrMag users)

Of course, you can also choose the animation, event, and/or sound to happen as part of an AoE attack. I’ve set up a few basic cases for the rocks animation, and written asm to search for where to start displaying the animation (as it does not originate from your selection).

POIN RocksEvent_MiddleVertical

You can also decide on the range mask (the area effected).

BYTE 3 3 // Size (1-indexed, so this is a 3x3y array) 
BYTE 1 1 // Center (0-indexed as coordinates, so [1,1] is the center)

BYTE 1 0 1
BYTE 0 1 0 
BYTE 1 0 1 

This is a small X, for example.

This should not conflict with anything that I’m aware of. It hooks these two addresses in order to display purple tiles instead of blue ones: $1DA98 and $1D9DC.

Febuilder users please note that you should update to the latest febuilder version before installing this for it to recognize your SkillTester. Also note that this is also compatible with vanilla, as it will simply skip the SkillTester in that case.

With thanks to: StanH, Mokha, Huichelaar, Teraspark, Pikmin1211, Sme, 7743, Snek, and anyone else who answers my questions, suggests reference files, or shares code snippets.



This is really cool ASM Vesly, well done!

1 Like