26
Scripting and Reverse Engineering / (FF7) Enemy AI: Referring to other enemies
« on: 2013-09-16 20:52:50 »
I seriously do not get how this works. As far as I can tell, there are two different lines that end up storing another enemy in a variable:
Both of them are used quite a bunch of times. The Rufus battle uses both; Rufus uses the top version, Dark Nation uses the bottom version. And yet, I can't quite see through it. Sometimes it randomly stops working, especially when using "manipulation" - as in changing the Self variable for a moment to have another enemy execute an attack. And what is does that line in the middle actually do?
To give a more concrete example, I have modified Dark Nation to use a custom skill (ID 03E9h/1001) on Rufus if it dies and Rufus is still alive. The following code comes into play:
Dark Nation's Pre-Battle Script:
and Dark Nation's Death Counter Script, naturally:
And yet, Dark Nation did nothing. How come?
Code: [Select]
LocalVar:00XX <- (AllyMask.EnemyID == ???)
and
LocalVar:00XX <- (BitCount(Self.FormationNumber) == ActiveMask.FormationNumber)
LocalVar:00XX <- (LocalVar:00XX.EnemyID == ???)
Both of them are used quite a bunch of times. The Rufus battle uses both; Rufus uses the top version, Dark Nation uses the bottom version. And yet, I can't quite see through it. Sometimes it randomly stops working, especially when using "manipulation" - as in changing the Self variable for a moment to have another enemy execute an attack. And what is does that line in the middle actually do?
To give a more concrete example, I have modified Dark Nation to use a custom skill (ID 03E9h/1001) on Rufus if it dies and Rufus is still alive. The following code comes into play:
Dark Nation's Pre-Battle Script:
Code: [Select]
0x000LocalVar:0020 <- (BitCount(Self.FormationNumber) == ActiveMask.FormationNumber)
0x014LocalVar:0020 <- (LocalVar:0020.EnemyID == 68)
0x022TargetMask <- AllyMask
0x029Perform("Reflect"[0011], EnemyAttack)
0x02FSCRIPT END
and Dark Nation's Death Counter Script, naturally:
Code: [Select]
0x000 If ( (LocalVar:0020.Status:Death == 0) )
0x000 {
0x00D TargetMask <- LocalVar:0020
0x014 Perform(1001, EnemyAttack)
0x01ASCRIPT END
And yet, Dark Nation did nothing. How come?