Modding => Help! => Topic started by: Emmy on June 19, 2016, 04:54:36 pm
Title: HELP! (Immortal flag immune formula asm, eventing)
Post by: Emmy on June 19, 2016, 04:54:36 pm
1. I managed to create a couple formulas which check for immortal, and fail if the unit is immortal. They work, except for the display. Will display a 100% and fail if an immortal unit is targeted. Even worse is with the Endeavor formula I made, since it displays 100% regardless of whether or not it'll work on the target. I'm probably missing something really dumb here. Before I work on another formula that fails on immortal targets, is there a way to make it display 0% if it will fail?
2. How do you use the Upgraded Event Instructions to apply Petrify to a target? Give an example. (Was trying to do this today and yesterday and it was failing) :( http://ffhacktics.com/wiki/Event_Instruction_Upgrade
3. How do you change whether or not Ramza is mandatory?
Title: Re: HELP! (Immortal flag immune formula asm, eventing)
Post by: Pride on June 19, 2016, 10:11:58 pm
For the ASM, the issue is with how you have it laid out. You need to run the check for Immortal, run the forced missed routine, /then/ branch to the end. Look at formula 5a to see what I mean.
001875bc: 3c028019 lui r2,0x8019 001875c0: 8c422d98 lw r2,0x2d98(r2) Load Target's stats 001875c4: 27bdffe8 addiu r29,r29,0xffe8 001875c8: afbf0010 sw r31,0x0010(r29) 001875cc: 9042015e lbu r2,0x015e(r2) Load Target's Graphic 001875d0: 00000000 nop 001875d4: 2442fff1 addiu r2,r2,0xfff1 Target's Graphic - E 001875d8: 2c420002 sltiu r2,r2,0x0002 Set to 1 if Target's Graphic is E, F, or 10 001875dc: 14400003 bne r2,r0,0x001875ec Branch to end if target is using Graphic E, F, 10 001875e0: 00000000 nop 001875e4: 0c0610c3 jal 0x0018430c Force Attack Miss 001875e8: 00000000 nop 001875ec: 8fbf0010 lw r31,0x0010(r29) 001875f0: 27bd0018 addiu r29,r29,0x0018 001875f4: 03e00008 jr r31 001875f8: 00000000 nop
Title: Re: HELP! (Immortal flag immune formula asm, eventing)
Post by: Emmy on June 20, 2016, 02:11:13 am
Yay got it to display 0% if miss. :) Separated it into a different routine for efficiency, since I'm going to be using the immortal check in several places/running out of long formulas to write over.
Not sure why it displays kinda strangely (will say 100% if it's capable of hitting a target) if the immortal check routine is used in other formulas. Here's the routine and another formula to check:
**Edit** I'm a dummy, figured out the problem.
Title: Re: HELP! (Immortal flag immune formula asm, eventing)
Post by: Pride on June 20, 2016, 10:30:49 am
Uou need a nop command after lbu x0005. This isn't your error most likely but it is an error
Title: Re: HELP! (Immortal flag immune formula asm, eventing)
Post by: Emmy on June 20, 2016, 05:05:41 pm
Fixed that error too. Thanks. :)
Error I ended up finding on my own was something extremely dumb, like a bne instead of a beq somewhere. Stuff like that is easy to make/hard to catch when you're tired.
Title: Re: HELP! (Immortal flag immune formula asm, eventing)
Post by: Emmy on June 25, 2016, 05:57:17 pm
I'm putting this here as to not put too many topics up. How do I check multiple values in a range efficiently? Is there a way to branch if, for example, r5 is between 1 and 6?
Title: Re: HELP! (Immortal flag immune formula asm, eventing)
Post by: Glain on June 25, 2016, 06:16:00 pm
There isn't an instruction for that specifically, but you can do some clever things to make the most of the instructions that do exist. For example, to test if 1 <= X <= 6, you could test that an unsigned (X - 1) <= 5, and if we're comparing unsigned integers then that's the same as testing that (X - 1) < 6.
In your example, you could do something like this:
Title: Re: HELP! (Immortal flag immune formula asm, eventing)
Post by: Emmy on June 26, 2016, 10:49:31 am
Thank you for your help. :) Routine I wrote didn't work at all, but I thought of a different way to accomplish what I need to.
Looking at Chakra formula, what is all this shifting doing? http://ffhacktics.com/wiki/34_Heal_(PA*Y)_HealMP_(PA*Y/2)
00189ee0: 00031c00 sll r3,r3,0x10 00189ee4: 00031403 sra r2,r3,0x10 00189ee8: 00031fc2 srl r3,r3,0x1f 00189eec: 00431021 addu r2,r2,r3 00189ef0: 00021043 sra r2,r2,0x01 <-- I know this line is divide by 2, but what purpose does all that stuff above it serve?
Title: Re: HELP! (Immortal flag immune formula asm, eventing)
Post by: Glain on June 29, 2016, 10:49:44 pm
That shifting is to handle negative numbers, which is interesting because the damage and healing values are never meant to be negative, as far as I'm aware. The first two lines sign-extend the register and the next two change the way a negative result rounds (up instead of down, e.g. -11 / 2 produces -5 instead of -6).