Vesly's ASM

doot

image

all downloads:

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

CheckInDanger

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.)

GetNthUnit

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.

UNCMv2

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.

SetUnitStatus

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

14 Likes

reserved

3 Likes

SetNearbyDangerRadius

vf0hqUNwls
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

4 Likes

RandomizeCoords

o0h0gAvMGp

Provided:

  • 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!

6 Likes

AutoLevelUnits

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.

Edit:
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.

4 Likes

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.

eg.

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

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

TestAI1:
ActionInRange
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.

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

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

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

7 Likes

Repair Items

RepairItems

available now

Zane decided to rewrite it for fun and add a couple features. His code is found here:
https://github.com/ZaneAvernathy/RepairItems/blob/main/RepairItems.event

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.”

8 Likes

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.

SW04Gpjmbn

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

image

Compatible with skill sys. Enjoy

7 Likes

Very epic sauce as usual.

1 Like

Wait AI

(Found inside the ExpandAI folder.)
9dEssAlw2V

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.

cEuIstxe2t

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.
image

EWWwW3cF8Z

Enjoy!

2 Likes

Modular Summon

bLQvsY6gBO

What it do?

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

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

  • 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

ezgif.com-gif-maker (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.

tqm7S1dZUP

6 Likes

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.)

Eg.

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

IFS8icW6Po

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

It is compatible with skill sys.

Enjoy!

Edit:
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.

2 Likes

AutoLvlUnit

G8s4OCF3zV

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.

6 Likes

Item Special Effect

P8jOZEitbs

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.

ALG0LX4kR2

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

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.

6 Likes

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