1 -
By adding the AttackEffect to 7743’s “Special Command per unit” I can run an event right before battle. It gives you a nice table to use, too.
AttackUsability
ldr r0, =0x80249ac @attack usability
mov lr, r0
.short 0xf800
cmp r0, #1
bne Exit
AttackEffect
ldr r2, =0x8022b30 @attack
mov lr, r2
.short 0xf800
Of course, certain events should not happen at the same time as AttackEffect. But this part works fine if the events are limited to say, only editing memory slots. (Only side effect is that it removes the attacker’s portrait when selecting your weapon.)
2 -
In the PreBattleLoop I can take over a skill, load the memoryslot to a register, and edit the battle that way. If the unit has this skill, it will always add the ldrh
of memory slot B to the unit’s avoid.
Replaced Quickburn
.thumb
.equ QuickBurnID, SkillTester+4
push {r4-r5, lr}
mov r4, r0 @attacker
ldr r5,=#0x30004E4 @sB
ldrh r5, [r5,#0x0]
@has skill
ldr r0, SkillTester
mov lr, r0
mov r0, r4
ldr r1, QuickBurnID
.short 0xf800
cmp r0, #0
beq End
mov r0, #0x62
ldrh r1, [r4,r0] @load avoid
add r1, r5 @add sB to avoid
strh r1, [r4,r0] @store
End:
pop {r4-r5, r15}
.align
.ltorg
SkillTester:
@Poin SkillTester
@WORD QuickBurnID
When I attack regularly, O’Neil has 8 hit, and when I run the event (through Mercy) he has 0 hit (and Eirika’s portrait disappears when the event that says SVAL 0x1 0xA
runs. Of course, you could just back out of the attack and s1 would still be 0xA, giving you the 10 avoid anyway.
3 -
I want to make a modular battle command that requires no asm to edit. I see that I can do so with the above 2 things I’ve made edits to, though it clearly has some issues. It would make more sense to create a table of entries to edit for each command, and abandon the idea of running an event at all. Eg. + or - Hit rate, + or - Mt, etc.
Actual questions:
a)
How do I check and set global flags? I don’t really understand the below example.
CasualMode uses 0xB0 flag
@hook: ORG 0x18418; jumpToHack(CasualMode)
.thumb
.org 0
CasualMode:
@check for something
push {r4}
mov r4,r2
bl CasualCheck
cmp r0, #0
bne Retreat
mov r3, #5
b Main
Retreat:
mov r3,#9
@original code:
Main:
ldr r0,[r4,#0xc]
mov r1,#5
mvn r1,r1
and r0,r1 @unkill unit (needed for pair up compatibility)
mov r1,r3 @5 for dead, 9 for retreated
orr r0,r1
str r0,[r4,#0xc]
mov r0,r4
ldr r3,=0x80283e1
bl goto_r3
pop {r4}
ldr r3,=0x801842d
goto_r3:
bx r3
CasualCheck:
push {lr}
mov r0, #0xb0 @unused permanent event id
ldr r3,=0x8083da9
bl goto_r3
pop {pc}
b)
Tables scare me. Could anyone recommend some simple examples to look at? Basically all I know about Nightmare is that it’s ran while processing tables in a buildfile. I don’t understand the csvmacro things - are those generated for you?
Magic Growths
#define csvmacro019(arg000,arg001) "BYTE arg000 arg001 "
PUSH
POP
ALIGN 4
MagCharTable:
csvmacro019(0x0,0x0)
csvmacro019(0x0,0x19)
c)
I know that storing data in memory slots between the event and the attack immediately after might be a bad idea. But this data could be stored permanently anyway via a table. How do I retrieve data from my own table that I create? I believe you’re supposed to use stuff like .equ
, but is there a way to just give it a permanent address and reference that? Or is a fixed address a bad idea?
d)
SpecialCommand only has 1 menu option. How would I expand it to have around 7 options, just showing the ones available? I took a brief look at Sme’s combat arts but I don’t really understand it yet.
e)
Any suggestions on how I should be tackling this? I feel like I’m in over my head, but hey I got a very flawed event+attack to work. I’d honestly prefer to just magically make it an febuilder patch and continue working on my hack, but I think this will save myself work in the long run if I want to make tons of arbitrary edits to the active battle based on a bunch of parameters set up, similar to the SpecialCommand patch, except it initiates battle & has fields for stuff like bonus Mt, Hit, Avo, etc.
Thanks in advance for any advice given. I’m still pretty inexperienced with ASM, but I’ll do my best to understand your suggestions.