Vesly's ASM

Arena ASMC

This 10 min hack just lets you start the arena in events (for the active unit). If you use the vanilla unit menu arena effect, then your events keep running, leading to some amusing glitches.

mGBA_86EzzhpfQk

.macro blh to, reg=r3
  ldr \reg, =\to
  mov lr, \reg
  .short 0xf800
.endm
.thumb 
push {r4, lr} 
mov r4, r0 @ proc 
ldr r0, =0x3004E50 
ldr r0, [r0] 
blh 0x8031874 @ prepare Arena 
ldr r0, =0x8A394DC 
mov r1, r4 @ parent 
blh 0x8002CE0 @ proc start blocking 
pop {r4} 
pop {r0} 
bx r0 
.ltorg 

Note that the player can just exit the arena. You can loop this by giving the arena enemy 0xFD a battle quote flag and/or a defeat quote flag - when the flag is on, you know that the player actually fought / defeated the arena enemy. If the flags are off, then show a message like “C’mon, let’s fight!” and goto to start of your event again.

6 Likes

Here’s one for you. Can you make it so Rally skills give EXP when used? You are using a turn to buff an ally afterall, much like the Nills Grace of Thor’s Ire items from dancers. Shouldn’t it work like that or a staff?

Also could you take a look at Vengeance and Skybreaker? The first is always misfiring. I either get the animation trigger with no bonus damage or in the next turn i get a massive damage number on my screen that doesn’t translate to reality. And then Skybreaker straight up doesn’t work. I’ve seen this happen in two distinct hacks that had these skills.

Rally skills giving exp would be stupid busted since you can just do it every turn, you dont even need to leave enemies alive like with phantoms

just start the event engine with an event to give the active unit exp in the relevant part of the rally skill

Summary
	.equ EventEngine, 0x800D07C
RallyCommandEffect:
	push {lr}

	ldr r0, =gActiveUnit
	ldr r0, [r0] @ arg r0 = active unit

	bl GetUnitRallyBits

	mov r1, r0 @ arg r1 = user argument

	adr r0, RallyCommandEffect_apply
	add r0, #1 @ arg r0 = function
	ldr r2, =gActiveUnit
	ldr r2, [r2] @ arg r2 = active unit
	bl ForEachRalliedUnit

	ldr r3, =StartRallyFx
	bl  BXR3

ldr r0, =MyEvent @ these 
mov r1, #1 @ three
blh EventEngine @ lines  

	ldr  r0, =gActionData
	mov  r1, #1
	strb r1, [r0, #0x11]

	mov r0, #0x17

	pop {r1}
	bx r1

I’m not interested in fixing bugs for skills I didn’t write unless I actually want to use the skills myself, sorry. Please report bugs to the skill system thread instead.

It’s the same principle as a staff use or a Dancer ring use. Both give EXP without the need to kill an enemy.

Display Obtainable Item

Building off of the work by @Mkol and @Huichelaar, this adds an icon to display over units that you can steal from (the previous version was only for droppable items).

mGBA_Tdkf09xBXR

Additional Details

It turns out searching through every unit’s inventory for stealable items every frame lags the game, so I had to complicate things and use 8 bytes of ram as a cache to avoid any lag. By default, I’ve used 0x203B1F0 which is also used by the Unit SFX patch:
image

If you use that patch, please find a different ram address to use for this hack. Additionally, if you use Huichelaar’s Danger Radius hack then you’ll want to change this part:
image

The cache is refreshed each phase and after stealing. If you’re loading units and the icon doesn’t show up immediately, you can ASMC SetupCacheForStealableItems to fix it, or just wait until the next phase. The cache is not saved on suspend, so resetting will turn it off for that phase.

Note that the SystemIcon used is based on the current SkillSys default.
image

Enjoy!

Edit: Emmett brought it to my attention that this wasn’t working with non-skill sys. The issue is that most builds of SkillSys change the function IsItemStealable to be given r0 = unit, r1 = item slot instead of r0 = item id.

My solution is to check if the bytes at 0x8017054 are the vanilla ones of 0x1C01B500 and if not, give the function the skillsys parameters. This feels very much like a cursed solution. Oh well, if it works, it works.

14 Likes

Tile Call Event

When pressing A on specific terrain, unitID, classID, or trapID, call some event. It can be set by chapter ID and the event can have a completion flag for convenience.

mGBA_1LTzpGRJ93

The events are up to you. Enjoy.

Edit:
Added CharID, ClassID, and TrapID as possible usabilities, too.

mGBA_meZcqbaoNB

In case you wanted to press A on a tent or whatever.

15 Likes

Cannot Die Updates

  • Added “Near Death” quotes (that resets the unit to full hp and immediately ends the battle)
  • Added flag to be set upon someone being saved
  • Old functionality of just dodging lethal attacks still works
  • (Battle and death quotes are unaffected)

mGBA_DVll8XgxBH

It turns out the way vanilla displays death quotes is very complicated. This was a lot harder than I thought!

Having bosses immediately revive when the player kills them is akin to using ambush spawns if you don’t give the player any notice of this. I highly recommend you use my IconDisplay patch to show a special icon on any units that do this. I think FE: Engage does something like this.

You can give a unit however many extra lives you want by having multiple entries for the same unit but with different flags.

Edit: It now works with SkillSystems, too. Please note that after installing/updating SkillSys, you must re-install this hack. I am fighting over the efxHPBar routine, which SkillSys needs for healing effects, while I need it for the near death quote (yes, vanilla death quotes are in the battle hp bar routine).

22 Likes

Update Fog

mGBA_9CGkVKNw1c

This just hooks the vanilla VCWF (change fog level) command to immediately update. If you try it on vanilla, the fog won’t actually update until the next turn.

Ominous countdown using @Contro’s modular objective window lol

mGBA_U1HyPSD2Qa

4 Likes

Generic Portrait Fixes

A playable unit is “generic” if it has no portrait (in this context).
image

When using these units, you’d normally encounter this sort of graphical issue:

image

Gamma made a fix while attacking, which you likely have installed already:
image

But this also happens while:

  • healing
  • in the item menu
  • leveling up
  • trading
  • promoting

image

I’ve fixed it in the above places, but there are likely more that have been missed. But it’s a start, at least. This is compatible with SkillSystem and its 32 hooks related to loading mugs. (Yes, I counted.)

12 Likes

Hi. I’ve been using this feature in my hack and a player recently provided some feedback I thought you would like to hear.

Apparently, yellow/green is not a good combination for colorblind people, so maybe it would be better to use one of the colors they suggested? Not imposing or anything, just relaying the info.

1 Like

It’d probably be ideal to have an artist create alternate graphics for the icons instead of just a recolour.

Your system icon uses this palette:
image

Here’s a simple recolour:
SystemIcon2

You can edit it here:

Hope that helps.

3 Likes

I’ve added a 2nd ASMC for the Draw Anim patch. This version does not pause your event while the animation plays, so it should be useful for some cases.

7743’s port loads the unit the frame after the animation ends, causing it to look like the unit has disappeared for a frame or two. But by loading the unit 23 frames after the animation has started, it now looks smooth.

mGBA_f3S2sMecWm

mGBA_V3Ue1Bwi0p

7 Likes

@Contro never got around to releasing his ai3 fix to make it account for doubling, so I made my own inline edit. It turns out the AI does account for doubling when granting a bonus for lethal damage and for bonus points when getting the opponent below 20 hp, but not for regular damage. Since opponent’s remaining hp is already calculated as part of a simulated battle which includes doubling, this fix uses that data to determine total damage dealt. (Eg. Opponent’s Initial HP - Opponent’s Expected HP After Battle). This is only multiplied by accuracy % once regardless of doubling, but it is an improvement at least.

// AI to account for doubling 
PUSH 
ORG $3DF4A
BYTE $72 $22 $D2 $18 $12 $78 $D8 $7C $12 $1A $C0 $46 $C0 $46 $C0 $46 $C0 $46
POP 
/*
mov r2, #0x72; add r2, r3 @ dfdr + 0x72 (initial hp) 
ldrb r2, [r2]; ldrb r0, [r3, #0x13] @ curr hp after battle 
sub r2, r0 @ dmg dealt; nop; nop; nop; nop 
*/
4 Likes

make prep screen scroll right instead of left (idk if it affects anything else)

// Make things that normally scroll left instead scroll right (such as the prep screen bg) 
ORG $86B84 
SHORT $3801 
ORG $86B8C
SHORT $46c0 $46c0 $46c0 
ORG $86BA2 
SHORT $46C0 $46c0 $46c0 

mGBA_orqUDpuADC

9 Likes

image
thanks to decomp goal window src

// make goal window text slightly longer 
ORG $8D2A6 
BYTE 10 // Width of line 1 (Vanilla is 8)
ORG $8D2B2 
BYTE 10 // Width of line 2 (Vanilla is 8)
ORG $8D2F6 
BYTE $48 // length in pixels for centering? (Vanilla is 0x40)
ORG $8D3E8 
BYTE $48 // length in pixels for "Last turn" (Vanilla is 0x40)
3 Likes

Hi, I’m struggling to make this work. I installed it via EA, but I don’t see where I can edit events for specific items. Where do I do this?

This is available as a patch within builder, I feel that would be easier than trying to modify the EA installer.

2 Likes

Thank you i managed to find it.

Hi. I’m trying to install the modular summoning, but it says there’s a .txt file missing?