S
Sega Chief
Guest
Hey all, I'm approaching the end of getting NT's last major build overhaul finished but I've a very important AI to roll out to most of the enemies in the game that's going to be handling a lot of NT's stat adjustments, Arrange Mode tweaks, and the SP system. I'd like to get a few sets of eyes to have a look at this script and tell me if they spot any errors or have ideas on how to make it more efficient:
Script
Code: [Select]
Disassembly
Code: [Select]
In the older build, defensive values for characters get doubled through the character AI in the kernel and the level synch is made there as well. This created a problem of limited space for innate ability AI, but it's now also made it tougher to dole out SP based on the character's level compared to the enemy level as Pre-Battle seems to be processed based on the actor bit (so chara AI, and therefore level, is always set first which buggers any Level check I want to make later on).
So my plan is to move all of this into the enemy AI where there's a lot more room (hopefully, I don't know if the scene.bin has an upper ceiling on how big it can be before problems arise). But as this means copying the AI into every single enemy, I wanted to get some second opinions on how this AI looks, if there's any problems with it I've missed, or suggestions on a more efficient way to arrange it all. It'll take a while to implement it into each enemy's pre-battle as I've got to get rid of the old one and navigate around any other scripts they have so just want to make sure I've got it right.
One thing I'd really like is a way to improve the level comparison at 0x0AB so that the game reads the enemy level and correctly compares it to the character level. I've tried it a few different ways, like loading the monster's bit, but I can't seem to get it to work; changing the compared number to match the monster's level every time will be a huge time sink so I'd appreciate it if anyone knows of a way to do this. It might be that I'm using the wrong set of codes, I was never 100% sure when to use 03, 02, or 01 for these things.
Script
Code: [Select]
Code:
12 026060 00879012 028060 01879012 02A060 02879013 022002 026002 41008060 02329012 026012 41008003 02209013 022002 026002 41108060 02329012 026012 41008003 02209013 022002 028002 41008060 02329012 028012 41008003 02209013 022002 028002 41108060 02329012 028012 41008003 02209013 022002 02A002 41008060 02329012 02A012 41008003 02209013 022002 02A002 41108060 02329012 02A012 41008003 02209002 026001 40488060 094502 028001 40488060 09455002 02A001 40488060 09455070 00E711 02C060 019093 Level Check Debug02 026001 40488060 2C4470 00FE12 026011 40488060 2C9002 028001 40488060 2C4470 011512 028011 40488060 2C9002 02A001 40488060 2C4470 012C12 02A011 40488060 2C9001 201060 014070 016112 206011 40488002 206001 40488060 05309011 022060 019093 Arrange Mode Debug
Code: [Select]
Code:
0x000LocalVar:0260 <- FlagBit(0)0x007LocalVar:0280 <- FlagBit(1)0x00ELocalVar:02A0 <- FlagBit(2)0x015LocalVar:0220 <- LocalVar:0260.PhysDefense * 20x023LocalVar:0260.PhysDefense <- LocalVar:02200x02ELocalVar:0220 <- LocalVar:0260.MagDefense * 20x03CLocalVar:0260.PhysDefense <- LocalVar:02200x047LocalVar:0220 <- LocalVar:0280.PhysDefense * 20x055LocalVar:0280.PhysDefense <- LocalVar:02200x060LocalVar:0220 <- LocalVar:0280.MagDefense * 20x06ELocalVar:0280.PhysDefense <- LocalVar:02200x079LocalVar:0220 <- LocalVar:02A0.PhysDefense * 20x087LocalVar:02A0.PhysDefense <- LocalVar:02200x092LocalVar:0220 <- LocalVar:02A0.MagDefense * 20x0A0LocalVar:02A0.PhysDefense <- LocalVar:02200x0AB If ( ( ( (LocalVar:0260.Level < 9) And (LocalVar:0280.Level < 9) ) And (LocalVar:02A0.Level < 9) ) )0x0AB {0x0CE LocalVar:02C0 <- 10x0D4 Display String: "Level Check Debug"0x0E7 If ( (LocalVar:0260.Level > 44) )0x0E7 {0x0F4 LocalVar:0260.Level <- 440x0FE If ( (LocalVar:0280.Level > 44) )0x0FE {0x10B LocalVar:0280.Level <- 440x115 If ( (LocalVar:02A0.Level > 44) )0x115 {0x122 LocalVar:02A0.Level <- 440x12C If ( (GlobalAddress == 1) )0x12C {0x135 Self.Level <- Self.Level + 50x147 LocalVar:0220 <- 10x14D Display String: "Arrange Mode Debug"0x161SCRIPT END
So my plan is to move all of this into the enemy AI where there's a lot more room (hopefully, I don't know if the scene.bin has an upper ceiling on how big it can be before problems arise). But as this means copying the AI into every single enemy, I wanted to get some second opinions on how this AI looks, if there's any problems with it I've missed, or suggestions on a more efficient way to arrange it all. It'll take a while to implement it into each enemy's pre-battle as I've got to get rid of the old one and navigate around any other scripts they have so just want to make sure I've got it right.
One thing I'd really like is a way to improve the level comparison at 0x0AB so that the game reads the enemy level and correctly compares it to the character level. I've tried it a few different ways, like loading the monster's bit, but I can't seem to get it to work; changing the compared number to match the monster's level every time will be a huge time sink so I'd appreciate it if anyone knows of a way to do this. It might be that I'm using the wrong set of codes, I was never 100% sure when to use 03, 02, or 01 for these things.