Modding => Help! => Topic started by: Emmy on April 17, 2016, 03:30:14 pm
Title: Help me figure out why this formula isn't working.
Post by: Emmy on April 17, 2016, 03:30:14 pm
So, I'm trying to write a formula that deals caster's MP in damage to the target, and effective MP cost = damage dealt; accepting status effect (19%) and element. Can't figure out why this doesn't work. :(
Title: Re: Help me figure out why this formula isn't working.
Post by: Glain on June 13, 2016, 07:43:09 pm
So, I happened to give this a look. Aside from some redundancy (you don't need to re-load the return action 0x80192d8c twice at the end of the routine, for example), there are 2 issues that I see:
1. [0x7c] lhu r1, 0x2c(r3)
This line is loading an unpredictable value into r1 because we no longer know what's in r3, as there have been several subroutine calls between this line and where r3 was set above. You'll need to re-load the attacking unit's pointer into r3 before running this line.
2. [0x90] sh r1, 4(r4)
This is setting the [HP Damage] of the return action equal to the value of r1. You'll want to set the [MP Damage], which is offset 8, not 4, thus: sh r1, 8(r4).
Essentially, as it is now, you've told the game that the action's display type (0x25) is MP Damage but then told it to deal HP Damage instead. Typically that will cause the action to deal HP Damage without actually displaying it (though it will show the 0 MP Damage). I suspect if you fixed the first issue without fixing the second that the attacking unit would just keel over after using that ability as it would stealth deal 569 damage to itself.
Title: Re: Help me figure out why this formula isn't working.
Post by: Emmy on June 15, 2016, 01:31:01 am
Yay! I got something to work. :) Thanks! :)
Only downside is it doesn't actually cap the MP damage done to self, but does cap the hp done to the target. Mini screenshot series: