For some reason, I'm unable to reproduce it. I don't know why, it just won't work.
The Death Counter script now looks like this:
0x000Self.Status:Haste <- 0
0x00ASelf.Status:Regen <- 0
0x014LocalVar:0000 <- 0
0x01A If ( (FlagBit(LocalVar:0000).Status:Imprisoned == 1) )
0x01A {
0x028 Display String: "imprisoned enemy"
0x03A TargetMask <- (LocalVar:0020.FormationNumber == LocalVar:0000)
0x049 Perform("Delete Pyramids"[0197], EnemyAttack)
0x04F TargetMask.Flag:Enabled? <- 0
0x059LocalVar:0000 <- LocalVar:0000 + 1
0x063 If ( (LocalVar:0000 >= 3) ) // Else goes to 0x01A
0x063 {
0x06C TargetMask <- Self
0x073 Perform("(Report)"[0164], EnemyAttack)
0x079 SCRIPT END
What's strange is that the test message "imprisoned enemy" is displayed correctly, but Reno shows no signs of using his ability at all. The If query also works as the message is not displayed if no character is trapped when Reno dies. The ability also seems to work since I had him use it on himself in the Pre-Battle script and he did show his hurt animation - which he doesn't do in the Death Counter. It's as if for some odd reason he just doesn't use the ability at all. And as a result of that the battle doesn't end. (It does if there's no imprisoned enemy). Actually, since the Pyramid becomes untargetable, he might even be using the ability, but he neither visibly does his hurt animation, nor does the battle end. Then again, that is probably just because of the Enabled=0 line. I don't get it.
The ability itself has Attack Damage Type 40h (also tried 42h, doesn't seem to matter) and is Shout-elemental but besides also being targetable is a clone of the (Report) move. I also tested giving Reno a Shout Death Weakness and he DID die when using it on himself so yeah, no problem there.
And simply setting HP to 0 didn't work either. In fact, the Pyramid stayed targetable and would refuse to die (Sephi's Yummy Mummy A comes to mind), so I quickly abandoned the idea.
And before someone assumes it's because of the LocalVar0020:FormationNumber == LocalVar0000 targeting, I have the same targeting system in my Use Pyramid routine and it works fine there (I use a different variable because 0000 is my turn counter):
0x01A LocalVar:0040 <- Random MOD 3
0x022 LocalVar:0040 <- LocalVar:0040 + 1 MOD 3
0x02F TargetMask <- FlagBit(LocalVar:0040)
0x037 If ( ( (TargetMask.Status:Death == 0) And (TargetMask.Status:Imprisoned == 0) ) )
0x037 {
0x04F LocalVar:0060 <- (LocalVar:0020.FormationNumber == LocalVar:0040)
0x05E LocalVar:0060.Flag:Enabled? <- 1
0x068 LocalVar:0060.Flag:MainScriptActive <- 1
0x072 LocalVar:0060.Status:Death <- 0
0x07C LocalVar:0060.HP <- LocalVar:0060.MHP
0x08B Perform(349 + LocalVar:0040, EnemyAttack)
I'm kind of stumped.